Skip to content

Instantly share code, notes, and snippets.

@andrzejwaw
andrzejwaw / README.md
Last active December 12, 2017 13:15
POC WeatherStation

Execute:

g++ -o mybinaryfile WeatherStation.c && ./mybinaryfile

Output:

Stable temperature:
temp: 15.00 HIH4030: 120 => 120.00 % humidity
temp: 15.00 HIH4030: 108 => 108.00 % humidity
defaults read -g com.apple.mouse.scaling
defaults write -g com.apple.mouse.scaling 5
echo "url" | sed -e 's/%/%25/g' -e 's/ /%20/g' -e 's/!/%21/g' -e 's/"/%22/g' -e 's/#/%23/g' -e 's/\$/%24/g' -e 's/\&/%26/g' -e 's/'\''/%27/g' -e 's/(/%28/g' -e 's/)/%29/g' -e 's/\*/%2a/g' -e 's/+/%2b/g' -e 's/,/%2c/g' -e 's/-/%2d/g' -e 's/\./%2e/g' -e 's/\//%2f/g' -e 's/:/%3a/g' -e 's/;/%3b/g' -e 's//%3e/g' -e 's/?/%3f/g' -e 's/@/%40/g' -e 's/\[/%5b/g' -e 's/\\/%5c/g' -e 's/\]/%5d/g' -e 's/\^/%5e/g' -e 's/_/%5f/g' -e 's/`/%60/g' -e 's/{/%7b/g' -e 's/|/%7c/g' -e 's/}/%7d/g' -e 's/~/%7e/g'
@andrzejwaw
andrzejwaw / arduino_datatype_sizes.txt
Last active January 20, 2017 12:06
arduino datatype sizes
sizeof(byte)=1
sizeof(char)=1
sizeof(short)=2
sizeof(int)=2
sizeof(long)=4
sizeof(long long)=8
sizeof(bool)=1
sizeof(boolean)=1
sizeof(float)=4
syntax on
set number
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
user=${1:-'example'}
pass=${2:-'password'}
remote=${3:-'localhost'}
db=${4:-'dbname'}
created=$(date +%Y%m%d)
echo 'To export to file (data only)'
mysqldump -u ${user} -p${pass} --no-create-info ${db} > bck_${db}_data_${created}.sql
echo 'To export to file (structure only)'
mysqldump -u ${user} -p${pass} --no-data ${db} > bck_${db}_struct_${created}.sql
@andrzejwaw
andrzejwaw / bash_sigterm_process
Created December 20, 2016 08:07
process sigterm in bash
#!/bin/bash
function terminate {
echo $(date) All done, exiting cleanly
exit 0
}
trap terminate SIGTERM
echo $(date) Start service running, pid $$
@andrzejwaw
andrzejwaw / docker_install.sh
Created May 25, 2016 12:35
install docker on ubuntu
apt-get update
apt-get install docker.io
ln -sf /usr/bin/docker.io /usr/local/bin/docker
sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
apt-get install linux-image-server
mv /etc/grub.d/06_OVHkernel /etc/grub.d/25_OVHkernel