Skip to content

Instantly share code, notes, and snippets.

View guyhughes's full-sized avatar

guy hughes guyhughes

  • /boot/efi/vmlinuz+0x0
View GitHub Profile
[Unit]
Description=slocker
Before=sleep.target
[Service]
User=gxg
Type=forking
Environment=DISPLAY=:0
ExecStart=/home/gxg/bin/thinklock
@guyhughes
guyhughes / Makefile
Last active November 10, 2015 21:43
makefile for java with run target; now with javadoc
# ___ __ __ ____ ______ _ # < // // / / __ \ / ____/ (_)____ _ _ __ ____ _
# / // // /_ / / / //___ \ / // __ `/| | / // __ `/
# / //__ __// /_/ /____/ / / // /_/ / | |/ // /_/ /
# /_/ /_/ \____//_____/ __/ / \__,_/ |___/ \__,_/
# /___/
# __ ____ _ __
# ____ ___ ____ _ / /__ ___ / __/(_)/ /___
# / __ `__ \ / __ `// //_// _ \ / /_ / // // _ \
# / / / / / // /_/ // ,< / __// __// // // __/
# /_/ /_/ /_/ \__,_//_/|_| \___//_/ /_//_/ \___/
@guyhughes
guyhughes / openvpn-client.conf
Last active October 27, 2015 02:48
OpenVPN udp tap - working ;)
client
dev tap
tun-mtu 1500
tun-mtu-extra 32
fragment 1300
mssfix
proto udp
remote 192.168.0.1
:%s:-af\W:-afg :
:%s:-ax\W:-ala :
:%s:-al\W:-alb :
:%s:-dz\W:-dza :
:%s:-as\W:-asm :
:%s:-ad\W:-and :
:%s:-ao\W:-ago :
:%s:-ai\W:-aia :
:%s:-aq\W:-ata :
:%s:-ag\W:-atg :
#!/usr/bin/env python3
# python monogodb example from Hack The North 2015
import pymongo
conn = pymongo.MongoClient()
blog_db = conn["blog"]
posts_col = blog_db["posts"]
post = {
@guyhughes
guyhughes / ooni-api-consumer.py
Created September 17, 2015 22:33
OONI API Reports consumer into python3 dict
#!/usr/bin/env python3.4
import json
import requests
url = 'http://api.ooni.io/api/reports'
r = requests.get(url)
reports = json.loads(r.text)
@guyhughes
guyhughes / bootstrap-3-tooltip-title-override.js
Created August 18, 2015 17:43
Bootstrap 3 Tooltip Title Override - Don't use "title" attribute - Works with Bootstrap-Select
// Bootstrap 3 Tooltip Title Override
// Author: Guy Hughes
// Date: 2015-08-15
// Licence: GNU GPL v3.0 http://www.gnu.org/licenses/gpl-3.0.txt
$.fn.tooltip.Constructor.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
//title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
@guyhughes
guyhughes / monday-starts-the-week-moment.js
Created August 17, 2015 18:10
Make monday the beginning of the week in moment.js persistently
// set Monday to beginning of week
moment.locale('en', {week: {dow:1}});
@guyhughes
guyhughes / bootstrap-datetimepickers-pairs.js
Created August 17, 2015 18:10
Bootstrap DateTimePicker pairs for duration
// http://eonasdan.github.io/bootstrap-datetimepicker
// setup a pair of datepickers
// Author: Guy Hughes
// Date: 2015-07-11
function addDatePickerPair(dpStart,dpEnd) {
// dpStart, dpEnd = /\#[A-z0-9]+/
// parameters are an ID for a single element
$(dpStart).on("dp.change", function (e) {
$(dpEnd).data("DateTimePicker").minDate(e.date);
@guyhughes
guyhughes / lazy-moment.js
Created August 17, 2015 18:03
momentjs humanized durations
// Uses moment js to parse human durations
// Author: Guy Hughes
// Date: 2015-08-17
function getPeriod(input) {
// returns an object {start: xxxx, end: xxxx}
// WARN: moment() methods modify object by reference
var start, end;
switch (input) {
case "Tomorrow":
start = moment().add(1,'day');