Skip to content

Instantly share code, notes, and snippets.

View sjourdan's full-sized avatar

Stephane Jourdan sjourdan

View GitHub Profile
@sjourdan
sjourdan / le-auto.sh
Created March 24, 2017 16:15
le-auto.sh crontab
#!/usr/bin/env bash
# 2015/12/19 initial version
# 2016/05/22 bugfix non-www domains
LE_BIN="/home/sjourdan/letsencrypt/letsencrypt-auto"
EMAIL="lala@lala.com"
DOMAINS="domain1.com domain2.com"
function generate_common_certs(){
root@sm1:~/sm# ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:07:cb:03:95:c8 brd ff:ff:ff:ff:ff:ff
inet 10.1.66.45/31 brd 10.255.255.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::207:cbff:fe03:95c8/64 scope link
valid_lft forever preferred_lft forever
root@sm1:~/sm# docker run -ti --net=host alpine ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:07:cb:03:95:c8 brd ff:ff:ff:ff:ff:ff
@sjourdan
sjourdan / debug.log
Last active August 13, 2016 21:56
terraform 0.7.0 RC4 digitalocean_ssh_key bug
```
docker run -it --rm -e TF_LOG=DEBUG -v `pwd`:/data sjourdan/terraform:0.7.0-rc4 validate
2016/08/01 10:38:44 [INFO] Terraform version: 0.7.0 rc4 abfd2c1daf914867b8737ac9419f3bd2ecc7a822
2016/08/01 10:38:44 [DEBUG] Detected home directory from env var: /root
2016/08/01 10:38:44 [DEBUG] Detected home directory from env var: /root
2016/08/01 10:38:44 [DEBUG] Attempting to open CLI config file: /root/.terraformrc
2016/08/01 10:38:44 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/08/01 10:38:44 [DEBUG] Detected home directory from env var: /root
2016/08/01 10:38:44 [DEBUG] plugin: waiting for all plugin processes to complete...
docker run -it --rm -e TF_LOG=DEBUG -v `pwd`:/data sjourdan/terraform:0.7.0-rc4 get
@sjourdan
sjourdan / tmux.conf
Created October 22, 2015 08:52
tmux.conf
set -g default-terminal 'screen-256color'
set -g prefix C-a
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display "Reloaded!"
bind C-a send-prefix
bind | split-window -h
bind - split-window -v
@sjourdan
sjourdan / mailgun_gandi_dns_spf
Created October 11, 2015 07:36
Mailgun & Gandi DNS SPF
email 10800 IN CNAME mailgun.org.
@ 10800 IN SPF "v=spf1 include:mailgun.org ~all"
@ 10800 IN TXT "v=spf1 include:mailgun.org ~all"
krs._domainkey 10800 IN TXT "k=rsa; p=MI...AB"
@sjourdan
sjourdan / Cloud Abacus.md
Created May 12, 2015 19:45
Cloud Abacus

Creating a Cloud Abacus Easy

This is going to be another scripting challenge.... you may use any language tools you want to solve it.

The task is to create two scripts (or one script with a symlink, whatevs) that will take as its only argument a 4 bit integer value (0-15) and create a file with a path based on the bit pattern. The directories should be created with the most significant bit first and will be named either "0" or "1" depending on the value of the bit in that position.

The first script should be called /usr/local/bin/seta and will use /var/math/a as its root directory. The second script will be /usr/local/bin/setb and use /var/math/b for its root. So, calling /usr/local/bin/seta 10 should create the directory /var/math/a/1/0/1/0/. Any files in the subdirectories will be ignored.

Your script should clear its target directory (/var/math/[a|b]) before writing files to ensure that data from previous runs will be removed. A third script called /usr/local/bin/adder has been provided and will add

@sjourdan
sjourdan / cloud-init-with-chef.yml
Created April 13, 2015 09:57
cloud-init with Chef provisionning + register
#cloud-config
users:
- name: demo
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: sudo
shell: /bin/bash
chef:
install_type: "omnibus"