Skip to content

Instantly share code, notes, and snippets.

View tonicebrian's full-sized avatar

Toni Cebrián tonicebrian

View GitHub Profile
@tonicebrian
tonicebrian / orphan-branches.sh
Created January 21, 2020 08:27
Find who created the last commit in unattended remote branches
#!/bin/bash
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci\t%cr\t%cN" $branch | head -n 1` \\t$branch; done | sort -r
@tonicebrian
tonicebrian / gist:fcdf1228e31735c12c6ffc9c978a522f
Created September 17, 2019 07:30
Check for variables defined in bash script
for var in MY_ENV_VAR_1 MY_ENV_VAR_2; do
if [[ -z "${!var:-}" ]];
then
echo "You need to provide a value for env variable $var"
exit 1
fi
done

Keybase proof

I hereby claim:

  • I am tonicebrian on github.
  • I am tonicebrian (https://keybase.io/tonicebrian) on keybase.
  • I have a public key ASCRxHtGVkzN4Jafqr5R2uv0u5SniW01xVznq_VF-kidkgo

To claim this, I am signing this object:

@tonicebrian
tonicebrian / tunnel.py
Created December 15, 2015 13:09
Paramiko tunnel
# Create a SSH connection
import paramiko
import os
ssh = paramiko.SSHClient()
ssh._policy = paramiko.WarningPolicy()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_config = paramiko.SSHConfig()
user_config_file = os.path.expanduser("~/.ssh/config")