Skip to content

Instantly share code, notes, and snippets.

View bmannix's full-sized avatar

Brendan Mannix bmannix

View GitHub Profile
@bmannix
bmannix / GitHub curl.sh
Created March 28, 2016 22:32 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@bmannix
bmannix / gist:9112111e1048c3e6b3d5
Last active August 29, 2015 14:27 — forked from callmephilip/gist:3519403
[JavaScript] Dispatching keyboard event
// gecko and webkit
// details here https://developer.mozilla.org/en-US/docs/DOM/event.initKeyEvent
var keyboardEvent = document.createEvent("KeyboardEvent");
var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? "initKeyboardEvent" : "initKeyEvent";
keyboardEvent[initMethod](
"keydown", // event type : keydown, keyup, keypress
true, // bubbles
@bmannix
bmannix / gist:10301435
Last active August 29, 2015 13:58 — forked from aurynn/gist:10121896
from twisted.internet.protocol import Factory
from twisted.internet.endpoints import TCP4ClientEndpoint, connectProtocol
from twisted.internet import reactor, defer, stdio
from twisted.protocols.basic import LineReceiver
import json
your_name = "bmannix"
class NotConnectedError(BaseException): pass
#!/bin/bash -xe
#THIS SCRIPT MUST BE RUN AS ROOT
ADMIN_USER=admin
ADMIN_GROUP=admin
#add admin group
(cat /etc/group | grep -E '\b$ADMIN_GROUP\b') || sudo groupadd $ADMIN_GROUP