Skip to content

Instantly share code, notes, and snippets.

View scemama's full-sized avatar
🏠
Working from home

Anthony Scemama scemama

🏠
Working from home
View GitHub Profile
@scemama
scemama / ssh_gateway
Last active August 29, 2015 14:14
SSH connect through a gateway
# In .ssh/config:
Host target.host.domain target
User username_on_target
HostName target.host.domain
ProxyCommand ssh [email protected] nc %h %p
# The `nc` command should be installed on the gateway.
@scemama
scemama / ssh_rev_tunnel
Created January 26, 2015 09:21
SSH Reverse tunnel
user@home $ ssh -R 10000:localhost:22 target.machine.org
[email protected] $ ssh -p 10000 localhost # ssh to the home machine
@scemama
scemama / mac
Created January 26, 2015 09:22
Change dynamically MAC the address
$ ifconfig eth0 down
$ ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
$ ifconfig eth0 up
@scemama
scemama / ssmtp
Created January 26, 2015 09:24
SSMTP gmail configuration
# /etc/ssmtp/ssmtp.conf
AuthUser=username
AuthPass=Your-Gmail-Password
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
@scemama
scemama / screensaver
Created January 26, 2015 09:25
Turn off screen saver
$ setterm -blank 0
$ xset -q
$ xset s off
$ xset -dpms
@scemama
scemama / seafile
Created January 26, 2015 09:26
Seafile commands
init:
seaf-cli init [-c <config-dir>] -d <parent-dir>
start:
seaf-cli start [-c <config-dir>]
stop:
@scemama
scemama / install_gnu_parallel.sh
Last active August 29, 2015 14:14
GNU Parallel install script
#!/bin/bash
BIN=~/bin
wget "http://mirror.ibcp.fr/pub/gnu/parallel/parallel-latest.tar.bz2"
tar -xjvf parallel-latest.tar.bz2
cd parallel-20*/
./configure
make
cp $(find src -executable | grep '/' ) $BIN
@scemama
scemama / toggle_layout.sh
Created January 26, 2015 09:28
Change keyboard layout
#!/bin/bash
declare -A new_layout
if [[ -z $1 ]] ; then
new_layout["fr"]="us"
new_layout["us"]="us_intl"
new_layout["us_intl"]="us"
else
new_layout["us"]="fr"
new_layout["us_intl"]="fr"
@scemama
scemama / screen_config
Last active August 29, 2015 14:14
Multi-user screen configuration
user1@localhost $ # Set the setuid bit on the executable
user1@localhost $ sudo chmod u+s /usr/bin/screen
user1@localhost $ ls -l /usr/bin/screen
-rwsr-xr-x 1 root screen 360952 Jan 18 2038 /usr/bin/screen
user1@localhost $ # Update your .screenrc
user1@localhost $ cat .screenrc
multiuser on
acladd bgates,lellison,gvanrossum,dknuth,dnorman
@scemama
scemama / video_record.sh
Created January 26, 2015 09:35
Record video of the screen
#!/bin/bash
OUT=$1
ffmpeg -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec libx264 -preset ultrafast -threads 4 -y -sameq $OUT