Skip to content

Instantly share code, notes, and snippets.

View jesboat's full-sized avatar

Jade Sailor jesboat

  • Boston, MA
View GitHub Profile
@jesboat
jesboat / youtube-account.pl
Created July 10, 2013 17:31
Script to upload cs173 lecture videos (as seen on http://cs.brown.edu/courses/cs173/2012/Videos/) to YouTube.
$USER = '[email protected]';
$PASS = 'abc123';
@jesboat
jesboat / Eep.java
Created September 13, 2013 20:55
Don't try this at home.
public class Eep {
class Foo {
final int bar;
Foo() {
Eep.this.foo = this;
if (true) {
throw new RuntimeException("lolol");
}
bar = 42;
@jesboat
jesboat / hist.sh
Last active August 29, 2015 13:57
Simple histogram
hist() {
local sortopts1= sortopts2=
while [[ $# != 0 && "$1" == -* ]]; do
if [ "$1" = -r ]; then
sortopts2=-r
elif [ "$1" = -n ]; then
sortopts1=-n
elif [[ "$1" = -rn || "$1" = -nr ]]; then
sortopts1=-n sortopts2=-r
else
@jesboat
jesboat / ProxySample.java
Created April 3, 2014 02:13
Sample of using `java.lang.reflect.Proxy`
package scratch;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;
public class ProxySample {
#!/usr/bin/perl
use strict;
use warnings;
use Errno;
use IO::Socket::INET;
my $sock = IO::Socket::INET->new(
LocalPort => 6666,
ReuseAddr => 1,
@jesboat
jesboat / enhanced-cd.sh
Created August 14, 2014 20:09
Better version of the enhanced `cd` described in the `iselect(1)` man page
#!bash
# database scan for enhanced cd command
cds() {
(
set -o pipefail
# XXX: handle directories with newlines in their names?
find "$HOME" -type d -print \
| sort -u > "$HOME/.cdpaths"
exit $?
@jesboat
jesboat / big.html
Created August 18, 2014 19:12
You probably don't want to open this
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<title>Blah</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<body>
<script type="text/javascript">
x = "blah";
for (i=0; i<28; i++) {
@jesboat
jesboat / parse-mr-counters.pl
Created August 19, 2014 03:01
Quick script to scrape the counters from a Hadoop jobdetails.jsp page
#!/usr/bin/env perl
use strict;
use warnings;
use XML::XPath;
@ARGV == 1 or die "Usage: $0 infile.xml\n";
my ($infile) = @ARGV;
my $xp;
@jesboat
jesboat / gist:4e628ed93537b9e9ab72
Created August 30, 2014 10:40
Fix a spurious ssh error/warning message
diff -ru OpenSSH-186 2/openssh/ssh.c OpenSSH-186/openssh/ssh.c
--- OpenSSH-186 2/openssh/ssh.c 2013-07-02 16:09:16.000000000 -0700
+++ OpenSSH-186/openssh/ssh.c 2014-08-30 03:32:29.000000000 -0700
@@ -1505,6 +1505,7 @@
u_int n_ids;
char *identity_files[SSH_MAX_IDENTITY_FILES];
Key *identity_keys[SSH_MAX_IDENTITY_FILES];
+ int identity_file_userprovided[SSH_MAX_IDENTITY_FILES];
#ifdef ENABLE_PKCS11
Key **keys;
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
use autodie;
use File::Temp qw(tempdir);
use File::Spec;
use File::Slurp qw(read_dir);