Skip to content

Instantly share code, notes, and snippets.

View maestrofx's full-sized avatar
🎯
Focusing

Franheit Sangapta maestrofx

🎯
Focusing
  • Root in the shell!
  • Jakarta, Indonesia
View GitHub Profile
@maestrofx
maestrofx / shipyard_deploy.sh
Created February 18, 2016 05:05
shipyard_deploy.sh
#!/bin/bash
if [ "$1" != "" ] && [ "$1" = "-h" ]; then
echo "Shipyard Deploy uses the following environment variables:"
echo " ACTION: this is the action to use (deploy, upgrade, node, remove)"
echo " DISCOVERY: discovery system used by Swarm (only if using 'node' action)"
echo " IMAGE: this overrides the default Shipyard image"
echo " PREFIX: prefix for container names"
echo " SHIPYARD_ARGS: these are passed to the Shipyard controller container as controller args"
echo " TLS_CERT_PATH: path to certs to enable TLS for Shipyard"

-- SCP (secure copy) cheatsheet --

copy from local machine to remote machine

scp localfile ser@host:/path/to/whereyouwant/thefile

copy from remote machine to local machine

scp user@host:/path/to/remotefile localfile
@maestrofx
maestrofx / install.sh
Created December 17, 2015 18:47 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@maestrofx
maestrofx / .tmux.conf
Last active August 26, 2016 03:15
my .tmux.conf configuration
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# set window split
bind-key v split-window -h
bind-key b split-window
# default window title colors
@maestrofx
maestrofx / beautiful_idiomatic_python.md
Created December 17, 2015 17:53 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@maestrofx
maestrofx / 0_reuse_code.js
Created December 17, 2015 17:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@maestrofx
maestrofx / add_sudoer.sh
Created December 17, 2015 17:47
script to add sudoers
#!/bin/bash
# Usage
# $ sudo chmod +x add_sudoer.sh
# $ ./add_sudoer.sh username
#
# add a number of users saved in txt
# $ ./add_sudoer.sh `cat list_of_users.txt`
#
# --> list of users to add separated by space
@maestrofx
maestrofx / install_latest_docker.sh
Created December 11, 2015 09:41 — forked from parente/install_latest_docker.sh
Install Docker latest on Ubuntu 14.04 with AUFS as the storage driver
#!/bin/bash
sudo apt-get update
sudo apt-get -y install linux-image-extra-$(uname -r)
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get -y install lxc-docker
@maestrofx
maestrofx / static_ip_trusty.sh
Created December 11, 2015 08:35
trusty static ip
#!/bin/bash
# This is a bash script to set a static IP.
# Tested in Ubuntu 14.04, added more
readInfo() {
read -p "Type static IP (eg - 10.10.10.2) : " staticip
read -p "Type Default Gateway (eg - 10.10.10.1) : " gateway
read -p "Type Netmask (eg - 255.255.255.0) : " netmask
read -p "Type DNS (eg - 8.8.8.8) : " dns
}