Skip to content

Instantly share code, notes, and snippets.

Assaf Morami assafmo

Block or report user

Report or block assafmo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@assafmo
assafmo / setup.sh
Last active Aug 6, 2019
Setup a new ubuntu machine for performance
View setup.sh
#!/bin/bash
set -e
##
# CPU scaling_governor=performance
##
printf 'Setting scaling_governor to performance... '
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor > /dev/null
@assafmo
assafmo / elastic_kibana.sh
Created Jul 17, 2019
Easticsearch + Kibana on docker
View elastic_kibana.sh
#!/bin/bash
docker pull docker.elastic.co/kibana/kibana:7.2.0
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.2.0
docker run --name some-elastic -e 'discovery.type=single-node' -d --restart always -p 9200:9200 docker.elastic.co/elasticsearch/elasticsearch:7.2.0
docker run --name some-kibana -d --restart always --link some-elastic:elasticsearch -p 5601:5601 docker.elastic.co/kibana/kibana:7.2.0
@assafmo
assafmo / config.fish
Last active Jun 7, 2019
Fish shell configs
View config.fish
# ~/.config/fish/config.fish
set -gx GOPATH /home/lala/workspace/go
set -gx PATH $PATH /usr/local/go/bin $GOPATH/bin
function fish_prompt
set_color --bold $fish_color_cwd
echo -n (prompt_pwd)
set_color normal
echo -n ' > '
View socks_proxy_example.sh
#!/bin/bash
ssh -D 1080 -N user@proxy-server & # The & won't work with password authentication
PROXY_PID="$!"
curl -x socks5://localhost:1080 https://google.com
kill -TERM "$PROXY_PID"
@assafmo
assafmo / config
Created Mar 13, 2019
i3wm config
View config
# WinKey
set $mod Mod4
# Set resulotion
exec "xrandr --output eDP-1 --mode 1600x900"
# Set background
exec "feh --bg-fill /home/assafmo/Pictures/Wallpapers/IMG_20180929_063914.jpg"
# Natural scrolling (xinput list -> get device id -> xinput list-props $id -> get libinput Natural Scrolling Enabled id)
@assafmo
assafmo / unmount.sh
Created Feb 19, 2019
Safely unmount disk on ubuntu
View unmount.sh
#!/bin/bash
DEV=$(mount | grep /media/ | awk '{print $1}')
udisksctl unmount -b "$DEV"
udisksctl power-off -b "$DEV"
@assafmo
assafmo / csv
Last active Feb 28, 2019
Handle CSV files with awk
View csv
gawk -v FPAT=\'[^,]*|"[^"]*"\' '{print $3}' < test.csv
@assafmo
assafmo / ssh_config
Last active Dec 30, 2018
SSH Multiplexing
View ssh_config
# Put in ~/.ssh/config
Host *
ControlMaster auto
ControlPath ~/.ssh/%r@%h:%p
ControlPersist yes
ServerAliveInterval 30
@assafmo
assafmo / url_to_pdf.sh
Last active Dec 27, 2018
Use headless chrome to print a page to pdf
View url_to_pdf.sh
#!/bin/bash
google-chrome --headless --disable-gpu --print-to-pdf="$PDF_NAME" "$URL"
@assafmo
assafmo / client.sh
Last active May 30, 2019
SSH Over TOR (Good for any service, also to expose a server behind NAT)
View client.sh
#!/bin/bash
sudo apt install -y tor
# get hostname from /var/lib/tor/ssh/hostname on the server
torsocks ssh user@xxxxyyyyzzzzaaaa.onion
You can’t perform that action at this time.