Skip to content

Instantly share code, notes, and snippets.

View anroots's full-sized avatar

Ando David Roots anroots

View GitHub Profile
@anroots
anroots / handler-fleep.rb
Created March 14, 2016 18:10
Fleep.io handler for Sensu monitoring
#! /usr/bin/env ruby
#
# DESCRIPTION:
# This handler formats Sensu alerts and sends them off to a Fleep.io webhook.
#
# OUTPUT:
#
# PLATFORMS:
# All
#
@anroots
anroots / emoticons.php
Last active December 27, 2015 18:06
A list of Fleep emoticons
<?php
return [
'Smile, life is beautiful' => [':-)', ':)', ':=)'],
'Sad, not OK' => [':-(', ':(', ':=('],
'Winky smile' => [';-)', ';)', ';=)'],
'Laughing out loud, LOL' => [':-D', ':D', ':=D'],
'Oh, surprise!' => [':-O', ':O', ':=O'],
'I’m worried' => [':-S', ':S'],
'Meh, don’t care' => [':-/', ':/'],
'I’m angry, grrr!' => ['X-(', 'X(', ':@', ':-@', ':=@', 'X=('],
@anroots
anroots / check_ee_domain.py
Created December 13, 2015 13:20
Sensu / Nagios check that detects .ee domains that are about to expire
#!/usr/bin/env python
# Sensu / Nagios check for detecting .ee domains that are about to expire
# Uses the JSON HTTP WHOIS API of internet.ee (Estonian TLD registrar).
#
# JSON API: http://rwhois.internet.ee
# Documentation: http://www.eis.ee/registrars/new-registry-system
#
# Note: This is a quick 30-minute script: untested, with bugs.
#
# Author: Ando Roots <ando@sqroot.eu> 2015-12-13
@anroots
anroots / run.php
Last active November 4, 2015 13:45
What does this do?
<?php
use GuzzleHttp\Client; include 'vendor/autoload.php'; define('ROOT', 'https://stash.local'); $sp7a9ef4 = array('API', 'AD', 'AP', 'SERVICE', 'API-UTIL'); $sp33c1bb = array(); foreach ($sp7a9ef4 as $sp0e38ee) { $sp09795d = new Client(); $sp6171a0 = sprintf(ROOT . '/rest/api/1.0/projects/%s/repos', $sp0e38ee); $sp8e6701 = $sp09795d->request('GET', $sp6171a0, array('auth' => array(getenv('LDAP_USER'), getenv('LDAP_PASS')))); $sp1478c4 = json_decode($sp8e6701->getBody(), true); foreach ($sp1478c4['values'] as $spb0932d) { if (!isset($sp33c1bb[$sp0e38ee])) { $sp33c1bb[$sp0e38ee] = array(); } $sp33c1bb[$sp0e38ee][] = $spb0932d['slug']; } } $sp976d5b = array(); foreach ($sp33c1bb as $sp0e38ee => $spf4b9a8) { foreach ($spf4b9a8 as $sp5f4662) { $sp6171a0 = sprintf(ROOT . '/rest/api/1.0/projects/%s/repos/%s/pull-requests', $sp0e38ee, $sp5f4662); $sp09795d = new Client(); $sp8e6701 = $sp09795d->request('GET', $sp6171a0, array('auth' => array(getenv('LDAP_USER'), getenv('LDAP_PASS')))); $sp1478c4 = json_decode($sp8
@anroots
anroots / .bashrc
Created January 21, 2015 08:49
Commit like a pro
alias commit='git add . && curl --silent https://raw.githubusercontent.com/ngerakines/commitment/master/commit_messages.txt | shuf | head -n 1 | git commit --file -'
@anroots
anroots / my_pc_wants_to_kill_me.cpp
Created July 6, 2014 21:55
MyPCWantsToKillMe - Teensy Keyboard Prank Firmware
/**
* MyPCWantsToKillMe
*
* Teensy 2.0 (Keyboard mode) office prank sketch.
*
* Plug into victims USB port. The sketch will start with periodically (random intervals) locking
* the victims workstation (Ctrl + Alt + L, phase 1) and will then start to output random creepy messages (phase 2).
* The messages are typed into whatever text area has focus. Ideally, the victim thinks that his computer has
* suddenly gained intelligence and wants to kill him.
*
@anroots
anroots / 91-razer-udev.rules
Last active August 29, 2015 14:02
razercfg udev rule to automatically set DPI when the mouse is connected
# UDEV rules for razer devices
# Change script path!
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0015", RUN+="/home/david/bin/razer-connect.sh"
ACTION=="remove", SUBSYSTEM=="usb", RUN+="/usr/local/bin/razercfg -B -S1 -s"
@anroots
anroots / ping.ps1
Created March 7, 2014 22:23
A PowerShell script that pings a list of static IP-s to determine the UP / DOWN status of each IP
# A PowerShell script to check the status (online / offline) of NODE-s
# Pings each NODE with a ICMP packet to get its status
#
# Author Ando Roots <ando@sqroot.eu> 2014-03-05
# -------------- CONFIG ------------------- #
# Node numbers to ping
$NodeList = 11,12,13,14,15,16,17,18,24
@anroots
anroots / pomodoro.py
Created February 19, 2013 18:43
A Pomodoro circuit for Raspberry Pi. http://sqroot.eu/2013/02/pomodoro-on-a-breadboard
#!/usr/bin/python
# A Pomodoro timer!
# Built for the Raspberry Pi
#
# http://en.wikipedia.org/wiki/Pomodoro_Technique
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_LEDBackpack/Adafruit_7Segment.py
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_LEDBackpack/Adafruit_LEDBackpack.py
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_I2C/Adafruit_I2C.py
#
@anroots
anroots / err.py
Created February 2, 2013 19:17
Show the number of online viewers of ETV on a 7-segment display. For Raspberry Pi and Adafruit LED Backpack
#!/usr/bin/python
# Show the number of viewers of ERR ETV online TV-channel on a 7-segment LCD
# Built for the Raspberry Pi
#
# http://otse.err.ee/etv/
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_LEDBackpack/Adafruit_7Segment.py
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_LEDBackpack/Adafruit_LEDBackpack.py
# https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_I2C/Adafruit_I2C.py
#