Skip to content

Instantly share code, notes, and snippets.

@sehrgut
sehrgut / curl-output.txt
Created January 3, 2016 21:56
How to hijack a page via a <script> tag loading HTML. Real-world example in curl-output.txt.
HTTP/1.1 302 Found
Date: Sun, 03 Jan 2016 19:58:45 GMT
Server: Apache
X-Powered-By: PHP/5.4.45-0+deb7u2
Location: http://ww31.gvisit.com/record.php?sid=592101993e8b9913eb0462e5bd4d7501
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8
HTTP/1.1 200 OK
@sehrgut
sehrgut / ios-profile-certs.sh
Last active November 9, 2022 16:25
Lists certificates permitted by an iOS provisioning profile
#!/bin/bash
readonly MODE_INFO=0
readonly MODE_VERBOSE=1
readonly MODE_EXTRACT=2
PLISTBUDDY=/usr/libexec/PlistBuddy
RUNMODE=$MODE_BASIC
TMP=`mktemp -t ios-profile-certs`
@sehrgut
sehrgut / console.log-uncaught.js
Created November 24, 2015 17:22
logs uncaught exceptions which bubble up to window.onerror
window.onerror = (function () {
var old_err = window.onerror;
var new_err = function (msg, url, line, col, err) {
console.log("Line " + line + ":" + col + " - " + msg);
if (typeof err.stack !== 'undefined')
console.log(err.stack);
else
console.log(err);
@sehrgut
sehrgut / finder-toggle-hidden.sh
Created August 13, 2015 21:46
function to toggle display of hidden files in OS X's Finder (put it in your .profile)
function finder-toggle-hidden () {
mode='TRUE'
if [[ `defaults read com.apple.finder AppleShowAllFiles` = 'TRUE' ]]; then
mode='FALSE'
fi
defaults write com.apple.finder AppleShowAllFiles $mode
killall Finder
}
@sehrgut
sehrgut / gtm-cut.sh
Last active August 29, 2015 14:26
cuts a clip from a non-standard .mov file recorded by GoToMeeting
#!/bin/bash
function print_usage() {
cat <<EOF
Usage: `basename "$0"` --start time --length seconds --in path --out path
--start time: start time in 'HH:MM:SS.mmm' format
--length seconds: clip length in integer seconds
--in path: input file, must have '.mov' extension
--out path: output file, must have '.mov' extension
@sehrgut
sehrgut / get-ebay-history.js
Created July 14, 2015 16:46
reads ebay purchase history from purchase history page
function getEbayHistory() {
var jq = jQuery([1]);
function parseItem(el) {
jq[0] = el;
var $title = jq.find('a.item-title');
return {
title: $title.text(),
url: $title.attr('href')
};
@sehrgut
sehrgut / console.loghistory.js
Created June 24, 2015 20:01
console.log() with message history
console.log = (function (oldlog) {
var console_log = oldlog.bind(console);
var messages = [];
var newlog = function (msg) {
messages.push(msg);
console_log(msg);
};
@sehrgut
sehrgut / facebook-trending.abp
Created January 8, 2015 22:01
AdBlock Plus rule for Facebook "Trending" feed
@sehrgut
sehrgut / jquery.withStyles.js
Last active August 29, 2015 14:03
jQuery plugin to find elements based on computed CSS styles
/*
jquery.withStyles.js - jQuery plugin to find elements based on computed CSS styles
Copyright (C) 2014 Keith Beckman
Released under the GPLv3
## Usage
* Returns collection of all `a` tags with computed styles matching the CSS declaration
* `$('a:withStyles("font-style: bold; color: #FFFFFF;")')`
* `$('a').filter(':withStyles("font-style: bold; color: #FFFFFF;")')`
* `$('a').withStyles("font-style: bold; color: #FFFFFF;")`
@sehrgut
sehrgut / Kickstarter Spending Report README.md
Last active August 29, 2015 14:03
Kickstarter Spending Report

I wanted a quick way to see how much I'd spent on Kickstarter. These browser console scripts will convert all Kickstarter pledges to your home currency and add them up.

  1. Set homeCurr in xe.com.js and kickstarter.com.js to the same value.
  2. Run xe.com.js in a console window on http://xe.com.
  3. Set exchg in kickstarter.com.js to the output of step 2.
  4. Run kickstarter.com.js in a console window on https://www.kickstarter.com/profile/backings?ref=nav.

You should see something like: