Skip to content

Instantly share code, notes, and snippets.

Matthew Scragg scragg0x

Block or report user

Report or block scragg0x

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@scragg0x
scragg0x / changelog.py
Created Apr 25, 2018
Get commit history grouped by tag / user
View changelog.py
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:
View meanConsole.js
(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 Oct 3, 2017
Postgresql: setting up user / database without super user
View pg.sql
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
View autorun.js
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) {
View xterm.scss
$default-theme:
#2e3436,
#cc0000,
#4e9a06,
#c4a000,
#3465a4,
#75507b,
#06989a,
#d3d7cf,
#555753,
View keybase.md

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:

View deploy.sls
sudo:
group:
- present
file.managed:
- name: /etc/sudoers.d/nopasswd
- contents: |
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
- mode: 0440
deploy:
View geo_block.sh
#!/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"
View proxy.conf
# 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;
@scragg0x
scragg0x / dev.conf
Last active Jan 21, 2016
Nginx proxy for Vagrant 80 to 8080
View dev.conf
server {
listen 80;
server_name *.dev;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 150;
You can’t perform that action at this time.