$ssh <server> -t tmux
$ssh -t tmux a
#!/bin/zsh | |
app=$1 | |
container=$app | |
cmd="/bin/bash" | |
if [[ $2 ]]; then container=$2; fi | |
if [[ $container == "nginx" ]]; then cmd='/bin/sh'; fi | |
pod=$(kubectl get pods | grep $app | head -1 | ruby -ne 'puts $_.split(" ")[0]') |
set nocompatible | |
set termguicolors | |
set background=dark | |
filetype on | |
filetype plugin on | |
syntax on | |
set omnifunc=syntaxcomplete#Complete |
// Reference: https://golangbot.com/channels/ | |
package main | |
import ( | |
"fmt" | |
) | |
// calcSquares returns the sum of the squares of all digits of given number | |
// i.e input: 123 . output: (1*1) + (2*2) + (3*3) = 14 | |
func calcSquares(number int, squareop chan int) { |
package main | |
import ( | |
"fmt" | |
) | |
func hello(done chan bool) { | |
fmt.Println("I'm goroutine") | |
// Sends and receives to a channel are blocking by default | |
done <- true |
// Reference: https://nanxiao.gitbooks.io/golang-101-hacks/content/posts/type-assertion-and-type-switch.html | |
package main | |
import "fmt" | |
func printValue(v interface{}) { | |
switch v := v.(type) { | |
case string: | |
fmt.Printf("%v is a string\n", v) | |
case int: |
// Reference: https://golangbot.com/polymorphism/ | |
package main | |
import ( | |
"fmt" | |
) | |
type Income interface { | |
calculate() int | |
source() string |
// Reference: https://golangbot.com/inheritance/ | |
package main | |
import ( | |
"fmt" | |
) | |
type author struct { | |
firstName string | |
lastName string |
#!/bin/zsh | |
set -e | |
GIT_SRC="/path/repo1/" | |
GIT_DEST="/path/repo2/" | |
BRANCH_SRC="src-branch" | |
BRANCH_DEST="target-branch" | |
echo "Gonna rsync *$BRANCH_SRC* from $GIT_SRC on *$BRANCH_DEST* on $GIT_DEST" |
# nettools | |
FROM library/python:2.7.15-slim-stretch | |
RUN apt-get update \ | |
&& apt-get -y install net-tools inetutils-ping tcpdump inetutils-traceroute \ | |
nmap traceroute netcat dnsutils iperf3 \ | |
vim nano | |
CMD ["/bin/bash"] |