Skip to content

Instantly share code, notes, and snippets.

View JackDanger's full-sized avatar

Jack Danger JackDanger

View GitHub Profile
@JackDanger
JackDanger / mi-5.script
Created July 27, 2012 03:54
MI-5 has the worst technobabble ever.
Actual dialogue between two characters in MI-5 Volume 9 Episode 1
Boss: You crack the code?
"Techie": Not exactly. Each message between Habib and Talwar has a different dynamic signature.
I have to trawl the non-indexed deep web to construct a cipher. It requires a lot of
computing power; takes time.
Boss: And you're waiting for...?
(ns crawler.crawler
(:gen-class)
(:require [net.cgrand.enlive-html :as html]
org.bovinegenius.exploding-fish))
(def crawled (atom #{}))
(defn fetch
"Retrieve contents of a page at a given url"
(ns palindrome
(:use clojure.test))
(with-test
(defn is-palindrome?
"is true if the given argument is a palindrome"
[string]
(loop [string string]
(cond
(= \space (first string))
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title></title><meta http-equiv="refresh" content="0;url=/wordpress/" /></head><body></body></html>
@JackDanger
JackDanger / riak_keys.sh
Created January 14, 2012 05:58
List all keys in Riak
curl -s $riak/$bucket?keys=stream | `which ruby` -rubygems -e "gem 'yajl-ruby'; require 'yajl'; Yajl::Parser.parse(STDIN) {|set| set['keys'] && set['keys'].each {|key| puts key } }"
# Delete them all:
# curl -s $riak/$bucket?keys=stream | `which ruby` -rubygems -e "gem 'yajl-ruby'; require 'riak'; require 'yajl'; riak = Riak::Client.new; bucket = riak.bucket('$bucket'); Yajl::Parser.parse(STDIN) {|set| set['keys'] && set['keys'].each {|key| p bucket.delete(key) } }"
diff --git a/src/profiles.c b/src/profiles.c
index 4f16ae7..9410b5e 100644
--- a/src/profiles.c
+++ b/src/profiles.c
@@ -204,14 +204,14 @@ av_profile_get_codecs (AVFormatContext *ctx)
for (i = 0; i < ctx->nb_streams; i++)
{
- if (audio_stream == -1 &&
- ctx->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO)
@JackDanger
JackDanger / flogdir.sh
Created September 20, 2011 18:50
Flog score for an entire directory
# torture your app directory
for source in $*; do
score=`flog $source | grep total | cut -d = -f 1`
echo "$score : $source"
done
@JackDanger
JackDanger / flay.sh
Created September 20, 2011 18:46
Flay score for an entire directory
# torture your app directory
for source in $*; do
score=`flay $source | grep Total | cut -d = -f 2`
echo "$score : $source"
done
@JackDanger
JackDanger / ruby.sh
Created August 3, 2011 23:19
Run multiple ruby tests
alias rtest="ruby -I\"lib:test\" `echo \`gem which rake\` | sed s/.rb$// | awk '{print $1\"/rake_test_loader.rb\"}'`"