Create partition in Linux that size larger than 2TB

Install parted: sudo apt-get install parted Use parted to create partition: parted /dev/sdb Inside parted cli, follow these steps: (parted) mklabel gpt Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes (parted) unit GB (parted) mkpart primary 0.0GB … Read more

SSH tunneling to your secured server through bastion/jump server with forwarded port

This is a quick guide will show you how to open ssh tunnel to ssh into your target server that can only be accessed from jump server. So this is how to do it: ssh -v -t -L 10443:localhost:20443 <jump_server> ssh -t -L 20443:localhost:443 user@<target_server> jump_server is the host that accessible from you and the … Read more

Start forticlient VPN only with command line

If your VPN client office using forticlient, you might want to run your VPN client with only command line, so you don’t have to see the small window just for connect your servers from home. With this bash script you can run your forclient VPN client only with CLI. Install expect first if you’re using … Read more

Post twitter using python script

$ pip install –upgrade pip $ pip install tweepy import tweepy def get_api(cfg): auth = tweepy.OAuthHandler(cfg[‘consumer_key’], cfg[‘consumer_secret’]) auth.set_access_token(cfg[‘access_token’], cfg[‘access_token_secret’]) return tweepy.API(auth) def main(): cfg = { “consumer_key” : “xxxxx”, “consumer_secret” : “xxxxx”, “access_token” : “xxxxx”, “access_token_secret” : “xxxxx” } api = get_api(cfg) tweet = “my status here” status = api.update_status(status=tweet) if __name__ == “__main__”: main()

Build ELK stack on ubuntu 16.04

Logstash Elasticsearch Kibana Filebeat ELK server: $ sudo add-apt-repository -y ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get -y install oracle-java8-installer Install Elasticsearch $ wget -qO – https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add – $ echo “deb http://packages.elastic.co/elasticsearch/2.x/debian stable main” | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list $ sudo apt-get update $ sudo apt-get -y install elasticsearch Config … Read more

Fix cannot access internet in your docker container

I use docker for testing environment. Somehow I found out that the docker container cannot access the internet and the solution is really simple: $ sudo ifconfig docker0 down $ sudo service docker restart $ sudo ifconfig docker0 up Or $ sudo vim /etc/default/docker DOCKER_OPTS=”–dns 10.10.4.14 –dns 8.8.8.8 –dns 8.8.4.4″ Which: 10.10.4.14 in my localhost/laptop

Play mp3 with command line

This is how to play your favorite music with command line, no UI bullshit $ sudo apt-get install mpg321 $ cd ~/Music/ ~/Music$ mpg321 Pink Floyd – Comfortably Numb.mp3

Kubernetes cheatsheet

To list all deployments: kubectl get deployments –all-namespaces To delete deployment: kubectl delete -n NAMESPACE deployment DEPLOYMENT To get admin user token dashboard kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk ‘{print $1}’) Allow master to run pod kubectl taint nodes –all node-role.kubernetes.io/master- To join master node kubeadm … Read more