Skip to content

Instantly share code, notes, and snippets.

View JulienSansot's full-sized avatar

Julien Sansot JulienSansot

View GitHub Profile
@JulienSansot
JulienSansot / ssh through a bastion bounce proxy server
Created May 14, 2015 05:22
ssh through a bastion/bounce/proxy server
# in the .ssh/config file
Host internalvia
HostName final.hostname.com
User secretdeployuser
IdentityFile ~/.ssh/id_rsa
ProxyCommand ssh public-server.com -W %h:%p
@JulienSansot
JulienSansot / update node app on the server with ansible and forever
Created May 19, 2015 12:02
update node app on the server with ansible and forever
---
- hosts: all
remote_user: ubuntu
vars:
app_repo: [email protected]:*******/******.git
app_id: app_name
app_folder: /home/ubuntu/app_name
log_folder: /home/ubuntu/app_name_logs
tasks:
- name: git clone
@JulienSansot
JulienSansot / ansible playbook for deploying a node app on ubuntu
Created June 3, 2015 06:29
ansible playbook for deploying a node app on ubuntu
---
- hosts: all
remote_user: ubuntu
vars:
app_repo: [email protected]:****/****.git
app_id: my_app
app_folder: /home/ubuntu/my_app
log_folder: /home/ubuntu/my_app_logs
tasks:
- name: git clone
@JulienSansot
JulienSansot / deploy docker container
Last active August 29, 2015 14:23
deploy docker container
You will need to save the docker image as a tar file:
sudo docker save -o <save image to path> <image name>
Then copy your image to a new system with regular file transfer tools such as cp or scp. After that you will have to load the image into docker:
sudo docker load -i <path to image tar file>
@JulienSansot
JulienSansot / enter docker container
Created June 16, 2015 01:58
enter docker container
Where do I get nsenter?
Check jpetazzo/nsenter on GitHub. The short version is that if you run:
docker run -v /usr/local/bin:/target jpetazzo/nsenter
… this will install nsenter in /usr/local/bin and you will be able to use it immediately.
nsenter might also be available in your distro (in the util-linux package).
How do I use it?
First, figure out the PID of the container you want to enter:
@JulienSansot
JulienSansot / use docker without sudo
Created June 16, 2015 05:45
use docker without sudo
sudo usermod -aG docker $user
then you need to login logoff
@JulienSansot
JulienSansot / quickly create a big file
Created July 2, 2015 05:27
quickly create a big file
fallocate -l 1G one_gig_file
@JulienSansot
JulienSansot / web_scrapping_with_casper
Last active August 29, 2015 14:25
web scrapping with casper
var casper = require('casper').create();
var content = null;
var url = 'http://www.google.com';
casper.start(url, function() {});
casper.then(function() {
content = this.getHTML();
});
server {
listen 80;
server_name bets.sansot.fr;
access_log /var/log/nginx/bets.log combined;
error_log /var/log/nginx/bets.log;
location / {
@JulienSansot
JulienSansot / docker usage
Created August 10, 2015 06:21
docker usage
# disk space used by docker
sudo du -sh /var/lib/docker