This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Converts any integer into a base [BASE] number. I have chosen 62 | |
# as it is meant to represent the integers using all the alphanumeric | |
# characters, [no special characters] = {0..9}, {A..Z}, {a..z} | |
# | |
# I plan on using this to shorten the representation of possibly long ids, | |
# a la url shortenters | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import commands | |
import time | |
import sys | |
from socket import socket | |
import argparse | |
import os | |
import pymongo | |
from pymongo import Connection | |
import yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
root /var/www/; | |
index index.php index.html index.htm; | |
server_name example.com; | |
location / { | |
try_files $uri $uri/ /index.php; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RPM and FPM | |
Install rpm-build via yum (from CentOS Updates and Base) | |
Install fpm via rubygems (requires json gem) | |
Creating an RPM from the apache-tomcat-7.0.25 directory and installing to /opt/tomcat/${Packagestuff} | |
fpm -s dir -t rpm -n tomcat -v 7.0.25 --prefix /opt/tomcat -C apache-tomcat-7.0.25 | |
Creating a Puppet Module | |
fpm -s dir -t puppet -n tomcat -v 7.0.25 -C apache-tomcat-7.0.25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source /etc/environment | |
hostname=$(cat /etc/machine-id) | |
machines=$(etcdctl ls /consul.io/bootstrap/machines) | |
#If there are 'machines' then the cluster has been initialised. | |
if [ -z "$machines" ] | |
then | |
flags="${flags} -bootstrap" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check if leader exist (means associated session with the ) | |
hasSession=$(curl -s http://localhost:8500/v1/kv/service/migration/leader | jq -r .[] | jq 'has("Session")') | |
if [ -z "$hasSession" ] || [ "$hasSession" = false ]; then | |
# create session | |
session=$(curl -s -X PUT -d '{"Name": "migration"}' http://localhost:8500/v1/session/create | jq -r .ID) | |
echo "session=$session" | |
leaderValue=$(curl -s http://localhost:8500/v1/kv/service/migration/leader | jq -r .[].Value | base64 --decode) | |
echo "leaderValue=$leaderValue" | |
if [ -z "$leaderValue" ] || [ "$leaderValue" != "JOB_DONE" ]; then | |
# try to put a lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
tune.ssl.default-dh-param 1024 | |
defaults | |
timeout connect 10000ms | |
timeout client 60000ms | |
timeout server 60000ms | |
frontend fe_http | |
mode http |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Flipping tables! (╯°□°)╯︵ ┻━┻" | |
num_rules=3 | |
real=3 # exposed to the ELB as port 443 | |
test=4 # used to install test certs for domain verification | |
health=5 # used by the ELB healthcheck | |
blue_prefix=855 | |
green_prefix=866 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
realm=Nexus Repository Manager | |
host=nexus.company.com | |
user=admin | |
password=admin123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from xivo_auth_client import Client as Auth | |
from xivo_confd_client import Client as Confd | |
auth = Auth('127.0.0.1', username='sylvain', password='sylvain', verify_certificate=False) | |
token_data = auth.token.new('xivo_user', expiration=10) | |
token = token_data['token'] | |
uuid = token_data['xivo_user_uuid'] |
OlderNewer