Skip to content

Instantly share code, notes, and snippets.

@assafmo
assafmo / elastic_kibana.sh
Created July 17, 2019 09:19
Easticsearch + Kibana on docker
#!/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 June 7, 2019 12:52
Fish shell configs
# ~/.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 ' > '
@assafmo
assafmo / socks_proxy_example.sh
Created June 6, 2019 08:31
Socks proxy using SSH
#!/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 March 13, 2019 17:11
i3wm 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 February 19, 2019 10:10
Safely unmount disk on ubuntu
#!/bin/bash
DEV=$(mount | grep /media/ | awk '{print $1}')
udisksctl unmount -b "$DEV"
udisksctl power-off -b "$DEV"
@assafmo
assafmo / csv
Last active February 28, 2019 11:23
Handle CSV files with awk
gawk -v FPAT=\'[^,]*|"[^"]*"\' '{print $3}' < test.csv
@assafmo
assafmo / ssh_config
Last active December 30, 2018 19:51
SSH Multiplexing
# Put in ~/.ssh/config
Host *
ControlMaster auto
ControlPath ~/.ssh/%r@%h:%p
ControlPersist yes
ServerAliveInterval 30
@assafmo
assafmo / url_to_pdf.sh
Last active December 27, 2018 16:12
Use headless chrome to print a page to pdf
#!/bin/bash
google-chrome --headless --disable-gpu --print-to-pdf="$PDF_NAME" "$URL"
@assafmo
assafmo / client.sh
Last active May 30, 2019 09:45
SSH Over TOR (Good for any service, also to expose a server behind NAT)
#!/bin/bash
sudo apt install -y tor
# get hostname from /var/lib/tor/ssh/hostname on the server
torsocks ssh [email protected]
@assafmo
assafmo / bluetooth_off.sh
Created December 13, 2018 20:55
Turn Bluetooth off on Linux
#!/bin/bash
rfkill block bluetooth