Skip to content

Instantly share code, notes, and snippets.

@pl12133
pl12133 / fallout_hacking_game
Created October 30, 2015 04:45
Daily Programmer challenge 2015-10-28
'use strict';
function mastermind() {
// Requires
var fs = require('fs');
var readline = require('readline');
///
// Members
var prompts = {
banner: function() {
@pl12133
pl12133 / config.ini
Created October 11, 2015 19:34
A simple timer written in AutoIt to make a noise after a countdown.
; Escape Key = {ESC}
; End Key = {END}
; Page Down = {PGDN}
; Page Up = {PGUP}
; For more: Google "Autoit Send"
[Hotkeys]
startKey={PGDN}
stopKey={PGUP}
[Duration]
@pl12133
pl12133 / notify_no_data.sh
Created July 24, 2015 02:27
Check the last time a influxDb Series was updated
#!/bin/bash
# Returns latest measurement from a series
# $1 = Series name
__getMeasurement() {
curl "http://weatherspot.us/db/query.php?db=weather&q=SELECT+temperature+FROM+${1}+LIMIT+1" 2>/dev/null
}
# Returns latest timestamp from a series
# $1 = Series name
# Generated by iptables-save v1.4.21 on Wed Jul 8 15:12:54 2015
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:DOCKER - [0:0]
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
@pl12133
pl12133 / fake_data_scheduler.sh
Created July 1, 2015 00:47
Fake Data Scheduler script, example of POSTing data directly to the InfluxDB HTTP API
#!/bin/bash
__randomWithRange() {
# http://www.tldp.org/LDP/abs/html/randomvar.html
# USAGE: __randomWithRange FLOOR CEILING
local number=0 #initialize
while [ "$number" -le $1 ]
do
number=$RANDOM
let "number %= $2" # Scales $number down within $RANGE.