Skip to content

Instantly share code, notes, and snippets.

View Turux's full-sized avatar

Turux

View GitHub Profile
@Turux
Turux / unique.py
Created January 27, 2021 09:21
A Python function that returns a list of unique elements in a list
def unique(input_list):
result=list(set(input_list))
return result
@Turux
Turux / summary.py
Last active January 27, 2021 09:18
Summary of a Python list
# @Brief: A function that takes a python list and returns a Dict of a summary of entries and thier number of occurrences
# @Param: input_list -> Any list of elements
# @Return: result -> A Dict containig as many keys as the unique elements of input_list
# The value for each key is the number of occurance of each unique element
def summary(input_list):
result=dict()
keys=list(set(input_list))
for key in keys:
result[key]=input_list.count(key)
@Turux
Turux / SOCKSinthemiddle.sh
Created January 9, 2018 16:33
Bash script to open a Proxy SOCKS tunnel from your machine to a remote server (B) passing through another machine (A)
ssh -v -N -D 8888 -oProxyCommand="ssh -W %h:%p userA@machineA" userB@machineB
@Turux
Turux / deg2revs.m
Created January 9, 2018 16:22
A MATLAB function that converts a 1D array from degrees to revolutions
function [ revs ] = deg2revs( deg )
% @Brief: A function that converts a 1D array from degrees to revolutions
% @Param: deg -> 1D array of angles expressed in degrees
% @Return: revs -> 1D array that counts how many revolutions have been
% completed. Starts from 1 for future grouping.
% A revolution
d = diff(deg);
revs = ones(length(deg),1);