Skip to content

Instantly share code, notes, and snippets.

View dmitriykuptsov's full-sized avatar
💭
Code it...

Dmitriy Kuptsov dmitriykuptsov

💭
Code it...
View GitHub Profile
@dmitriykuptsov
dmitriykuptsov / wifi_model.R
Last active April 6, 2022 15:40
WiFi protocol optimization
ECW<-c(3:300)
N<-c(2:12)
OECW=c()
for(n in N) {
S=1540
ts<-28*10^-6+254*10^-6+10*10^-6+30*10^-6
tc=28*10^-6+254*10^-6+10*10^-6
tn<-9*10^-6
pt=2/(ECW+1)
pn=(1-pt)^n
@dmitriykuptsov
dmitriykuptsov / kruskal.js
Created April 28, 2021 13:25
This gist allows to compute the Kruskal-Wallist H statistic
/*
Kruskal-Wallis test
Implemented by Dmitriy Kuptsov
Time complexity of the test is O(nlogn)
*/
/*
Space complexity: O(nlogn)
Time complexity: O(nlogn)
*/
@dmitriykuptsov
dmitriykuptsov / gist:66272908767223154ed0
Last active August 29, 2015 14:22
Insertion sorting. C++
#include <stdio.h>
#include <stdlib.h>
int arr[10];
int target[10];
int * init_arr(int * arr, int len);
void print_arr(int * arr, int len);
void sort(int * arr, int len);
void swap(int * arr, int i, int j);
int test(int * source, int * target, int len);
@dmitriykuptsov
dmitriykuptsov / gist:83a97a5c8759e40943ab
Last active August 29, 2015 14:22
Mounting shared folder inside virtualbox
#!/bin/bash
HOST_FOLDER=$1
GUEST_FOLDER=$2
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) $HOST_FOLDER $GUEST_FOLDER
@dmitriykuptsov
dmitriykuptsov / gist:4f6faadbcd7b3415d202
Last active August 29, 2015 14:21
memory usage reporter
#!/usr/bin/python
import subprocess
import re
# Get process info
ps = subprocess.Popen(['ps', '-caxm', '-orss,comm'], stdout=subprocess.PIPE).communicate()[0]
vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0]
# Iterate processes
# Tested on MAC OS and Linux
BASE="gcc-arm-none-eabi-4_9-2014q4"
if [ $1=="linux" ]
then
IMAGE=gcc-arm-none-eabi-4_9-2014q4-20141203-linux
else
IMAGE=gcc-arm-none-eabi-4_9-2014q4-20141203-mac
fi
cd ~/Downloads/
wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major/+download/$IMAGE.tar.bz2
# Copyright 2013, Harvest Exchange Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# riemann upstart file
pre-start script
mkdir -p /var/log/riemann/
end script
respawn
respawn limit 15 5
start on runlevel [2345]
f1 <-
function(x, y) {x+y}