Skip to content

Instantly share code, notes, and snippets.

(function FakeNewsify() {
String.prototype.sarcasm = function(x) {
return ((x || this).match(/.{1,2}/g) || []).map(s => s[0].toUpperCase() + (s[1] || '').toLowerCase()).join('');
};
var el = document.getElementsByTagName('body')[0];
var n,
a = [],
walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false);
while ((n = walk.nextNode())) a.push(n);
@scragg0x
scragg0x / changelog.py
Created April 25, 2018 20:59
Get commit history grouped by tag / user
import argparse
from subprocess import check_output
from datetime import datetime
parser = argparse.ArgumentParser()
parser.add_argument('--dir', default='.', help='Git Directory')
parser.add_argument('--start', help='From Date YYYY-MM-DD')
args = parser.parse_args()
if args.start:
@scragg0x
scragg0x / meanConsole.js
Created October 10, 2017 20:06
Mean Console
(function () {
const you = ['idiot', 'dumbass', 'dipshit', 'moron', 'shithead'];
const consoleError = console.error;
console.error = function () {
[].push.call(arguments, you[Math.floor(Math.random() * you.length)]);
consoleError.apply(null, arguments);
};
})();
@scragg0x
scragg0x / pg.sql
Created October 3, 2017 13:58
Postgresql: setting up user / database without super user
CREATE USER username WITH CREATEDB;
GRANT username TO postgres;
SET ROLE username;
CREATE DATABASE databasename OWNER username;
SET ROLE postgres;
ALTER USER username WITH NOCREATEDB;
\password username
const objectChangeHandler = {
get(target, property) {
globalState.touched.push(target.id);
return target[property];
},
set(target, property, value, receiver) {
target[property] = value;
const cbs = globalState.callbacks[target.id];
if (cbs) {
@scragg0x
scragg0x / xterm.scss
Created December 12, 2016 22:25
Xterm theme
$default-theme:
#2e3436,
#cc0000,
#4e9a06,
#c4a000,
#3465a4,
#75507b,
#06989a,
#d3d7cf,
#555753,

Keybase proof

I hereby claim:

  • I am scragg0x on github.
  • I am scragg (https://keybase.io/scragg) on keybase.
  • I have a public key whose fingerprint is 7E54 3FD5 C59F 33C8 04DC B271 C8D2 CCFD 1B8F 21D0

To claim this, I am signing this object:

sudo:
group:
- present
file.managed:
- name: /etc/sudoers.d/nopasswd
- contents: |
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
- mode: 0440
deploy:
@scragg0x
scragg0x / geo_block.sh
Last active August 29, 2015 14:04
Geo Blocker
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments supplied. Example: sudo bash geo_block.sh cn af"
exit 1
fi
IPT=/sbin/iptables
IPDENY="http://www.ipdeny.com/ipblocks/data/countries"
@scragg0x
scragg0x / proxy.conf
Created July 15, 2014 14:40
Nginx proxy
# This looks like a infinite loop but it proxy requests sent
# to the 'old' webserver during dns propagation to the new one.
# Make sure the webserver with this code knows the updated
# IP for the domain by adding a record to /etc/hosts
server {
listen 80;
server_name domain.com;