This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo tcpdump -i en0 -n -s 0 -w traffic.pcap tcp or port 53 | |
# see code.google.com/p/pcaphar/wiki/CaptureMobileTraffics | |
# NB: en0 is for ethernet connections, en1 for Airport | |
# see also support.apple.com/kb/HT3994 | |
# can analyze .pcap output with pcapperf.appspot.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// php 5 | |
print_r( get_headers( "http://example.com", 1 ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function( $ ) { | |
var title, authors, price, url, | |
loc = document.location; | |
title = $( '#btAsinTitle' ).text().replace( /\s\[(Paperback|Hardcover|Bargain Price|Mass Market Paperback)\]/g, '' ); | |
// authors' names, skip over role e.g. (editor) | |
if ( $( '.contributorNameTrigger' )[ 0 ] ) { | |
if ( $( '.contributorNameTrigger' ).length > 1 ) { | |
authors = $( '.contributorNameTrigger a' )[ 0 ].text(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- just replace {{id}} with the video's ID | |
e.g. 9bZkp7q19f0 --> | |
<div style="width:100%;position:relative;padding:0;padding-top:75%"> | |
<iframe | |
style="position:absolute;top:0;left:0;width:100%;height:100%;" | |
src="http://www.youtube-nocookie.com/embed/{{id}}?rel=0" | |
frameborder="0" allowfullscreen mozallowfullscreen webkitallowfullscreen> | |
</iframe> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Top 10 BASH commands used | |
# from stackoverflow.com/questions/68372/what-is-your-single-most-favorite-command-line-trick-using-bash#answer-68390 | |
function top10() { | |
history | awk 'BEGIN {FS="[ \t]+|\\|"} {print $3}' | sort | uniq -c | sort -nr | head | |
} | |
1393 gs - alias for git status | |
1272 g - alias for git | |
1121 l - alias for ls -l | |
1003 - can't explain this...why would an empty space show up as a command? Bug in the top10 function maybe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[<span id="fn$1">[$1]</span><a href="#note$1">^</a> $2 | |
$0]]></content> | |
<tabTrigger>fn</tabTrigger> | |
<scope>text.html.markdown.multimarkdown, text.html.markdown</scope> | |
<description>Footnote at Bottom</description> | |
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
// Wikipedia ships with jQuery v1.8.3 as of 5/14/13 | |
// will only count edits on the page | |
// if editor has >50 edits need to up the display limit | |
var numEdits = $( 'ul' ).eq( 0 ).find( 'li' ).length, | |
bytesChanged = 0; | |
$( '.mw-plusminus-pos, .mw-plusminus-neg' ).each( function ( el, index ) { | |
// text looks like (+###) where # of digits is variable | |
// e.g. (+3), (-45), (+1,479) | |
// so remove any commas, first 2 chars, last char, & parse as int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def RainbowTest(wall): | |
print "RainbowTest" | |
rainbowColors = [ colors["red"], colors["orange"], colors["yellow"], colors["green"], colors["baby blue"], colors["blue"], colors["purple"] ] | |
i = 0 | |
for y in range( wall.height ): | |
color = rainbowColors[ i ] | |
i += 1 | |
if i == 7: | |
i = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# usage: | |
# sum-majors.py "LI - Library students per term.csv" > "YEAR majors total.csv" | |
import csv | |
import fileinput | |
import sys | |
majors = csv.DictReader(fileinput.input(mode='rb')) | |
# mapping of degree codes to majors will change over time | |
# as will the "totals" dict below listing our majors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// a utility script for CCA to check for duplicate syllabi in VAULT | |
let defaults = { | |
uuid: '9ec74523-e018-4e01-ab4e-be4dd06cdd68', | |
// 50 is max length | |
length: 50, | |
term: 'Spring 2018', | |
} | |
// .equellarc file with credentials for API use | |
let options = require('rc')('equella', defaults) |