Skip to content

Instantly share code, notes, and snippets.

@nikcub
nikcub / clear-ga.sh
Created October 2, 2012 03:36
One-line shell script to clear all Google Analytics cookies from Chrome on OS X
#!/bin/bash
#
# shell script will clear all google analytics cookies from chrome cookie store
#
SQ3=`which sqlite3`
$SQ3 ~/Library/Application\ Support/Google/Chrome/Default/Cookies "delete from cookies where name like '__u%'"
@nikcub
nikcub / nav.js
Created September 19, 2012 09:13
keyboard nav for xkcd 1110
// get the map element
var el = $('.map')[0];
// amount in pixels we want to move each keypress/hold
var move = 200;
function fakeMouseEvent(type, x, y) {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent(type, true, true, window,
0, 0, 0, x, y, false, false, false, false, 0, null);
@nikcub
nikcub / gist:2634960
Created May 8, 2012 13:25
Comic Sansify

Comicsansify;")

@nikcub
nikcub / admin.less
Created November 11, 2011 00:13
example bootstrap file
// to build:
// lessc <filename> > site.css
// lessc <filename> > site.min.css --compress
// the swatch
@color1: #55626b;
@color2: #6c9380;
@color3: #c1ca55;
@color4: #f07d6b;
@color5: #ad5472;
@nikcub
nikcub / mails.sh
Created September 12, 2011 19:43
Send email with Mail.app from command line script
#!/bin/sh
/usr/bin/osascript > /dev/null <<ASCPT
set stdinText to "$(cat | sed -e 's/\\/\\\\/g' -e 's/\"/\\\"/g')"
set recName to "Nik Cubrilovic"
set recAddr to "nikcub@gmail.com"
set theSubject to "Email from standard input"
tell application "Mail"
@nikcub
nikcub / mails.sh
Created September 12, 2011 19:40
send email with mail.app via terminal
#!/bin/sh
/usr/bin/osascript > /dev/null <<ASCPT
set stdinText to "$(cat | sed -e 's/\\/\\\\/g' -e 's/\"/\\\"/g')"
set recipientName to "John Doe"
set recipientAddress to "nobody@nowhere.com"
set theSubject to "Email from standard input"
set theContent to "This email was created and sent using AppleScript!"
tell application "Mail"
@nikcub
nikcub / keybase.md
Created March 9, 2015 22:58
keybase.md

Keybase proof

I hereby claim:

  • I am nikcub on github.
  • I am nikcub (https://keybase.io/nikcub) on keybase.
  • I have a public key whose fingerprint is E207 612C E504 10EF B789 6E34 2E4C E6CA 3D38 5CC5

To claim this, I am signing this object:

@nikcub
nikcub / tor-upgrade.md
Last active August 29, 2015 14:10
Tor HTTP to Onion Upgrade Protocol Draft Proposal

Tor HTTP Upgrade Protocol Draft Proposal

Version 0.1

6th December 2014

This is very much a draft - there are many security, privacy and performance considerations

1. Background

$ids = array_map('trim', $_POST['ids']);
$ids = array_map('intval', $ids);
$ids = implode(',', array_values($ids));
$db->query("SELECT * from table where id IN(" . $ids . ")");
@nikcub
nikcub / disqus-xss.html
Created August 13, 2014 02:20
Disqus for Wordpress v2.7.5 XSS Exploit
<!--
Exploit for Disqus for Wordpress admin stored CSRF+XSS up to v2.7.5
Blog post explainer: https://www.nikcub.com/posts/multiple-vulnerabilities-in-disqus-wordpress-plugin/
12th August 2014
Nik Cubrilovic - www.nikcub.com
Most of these params are unfiltered/injectable. Not framable on newer Wordpress.