Skip to content

Instantly share code, notes, and snippets.

View renoirb's full-sized avatar

Renoir Boulanger renoirb

View GitHub Profile
@renoirb
renoirb / znc_notify.md
Last active December 22, 2015 16:29
Get notification when something happens on a IRC channel

This should guide you to install a notifier when a hot word is issued while you are away.

Procedure overview

  1. Get a compiled version of ZNC
  2. Grab this external module (note: this is the one I am using)
  3. Configure as the documentation explains
  4. Create a shell script, see znc_notify.sh
  • Make executable sudo chmod +x /etc/znc_notify.sh

Testing

@renoirb
renoirb / pillar-cron-piwik.yml
Last active December 23, 2015 05:29
Modular cron definition with MAILTO environment variable
# file pillar/cron/piwik.sls
cron:
piwik_archive_cron:
name: /usr/bin/piwik-archive.sh
user: root
minute: 5
hour: *
@renoirb
renoirb / .htaccess
Last active December 23, 2015 11:39
Reproduce a file from a github repo. (i.e. Poor man github pages!)
#RewriteEngine On
#RewriteCond ^.*$ [L]
#RewriteRule ^(.*)$ /index.php?f=$1
ErrorDocument 404 /index.php
@renoirb
renoirb / init.yml
Last active March 30, 2023 03:15
How to install Oracle Java from ppa webupd8team/java using Salt stack, in ONE state file
#
# How to install automatically Oracle Java 7 under Salt Stack
#
# Thanks Oracle for complicating things :(
#
# 1. Create a java/ folder in your salt master
# 2. Paste this file in init.sls
# 3. salt '*' state.sls java
#
# Source:
@renoirb
renoirb / CLI.md
Last active August 7, 2019 19:04
Some Salt Stack Python tests

Salt and nova commands, booting typical VM

Boot new VM:

Some prebuilt images on OPS

nova boot --image 1236 --flavor 103 --key_name renoirb app6
nova boot --image 75845 --flavor 103 --key_name renoirb piwik-test

Configure new VM:

@renoirb
renoirb / mw.js
Last active December 25, 2015 05:59
Piwik tracking code
// Refactor note, use mw.loader.using('mw.user',setupTracking);
/**
* Read address GET parameters and return value assigned to the key
*
* Credits: http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values#answer-901144
**/
function getQueryParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
@renoirb
renoirb / cors.php
Created October 15, 2013 13:49
CORS header modification using PHP
<?php
/**
* CORS header manipulation handler
*
* This utility will add header in the
* HTTP response and help us execute JavaScript
* from differen sub-domains.
*
* @author Renoir Boulanger <renoir@w3.org>
@renoirb
renoirb / sequence.arithmetic.js
Created October 18, 2013 06:13
Katas: Reproducing Math formulas in a programming language
var arithmeticSequenceCalculator = function (first, times, difference) {
var a1 = parseInt(first),
n = parseInt(times),
d = parseInt(difference),
e = 0,
sequence = [],
methods = {};
//console.log('first:'+out,', difference:'+d,', n:'+n); // DEBUG
@renoirb
renoirb / wmflabs.sh
Last active December 26, 2015 08:39
Bootstrapping Salt Stack 0.17
#!/bin/bash
set -e
#
# http://intothesaltmine.org/blog/html/2013/03/04/upgrade_saltstack_installation.html
#
echo 'Updating refs'
apt-get update
@renoirb
renoirb / sample.conf
Last active January 18, 2016 10:45
Salt stack master to use remote git for both pillar and state files
##
## Use-case: Host in a remote git (on a ssh-able host) both pillars and states on Salt Stack 0.17.x
##
## See thread: https://groups.google.com/forum/#!topic/salt-users/bOz2cdY-pnY
#
# Salt stack master and minion procedure, short version:
#
# - On the Master:
#
# wget -O - http://bootstrap.saltstack.org | sudo sh -s -- -M git v0.17.0