Skip to content

Instantly share code, notes, and snippets.

@paulbaumgart
paulbaumgart / gist:f6bb71c588425f8a7487
Last active August 29, 2015 14:05
Publishing to Faye using Redis Engine from Rails, without mounting a Faye server
require 'eventmachine'
require 'faye'
require 'faye/redis'
client = Faye::Client.new(Faye::Server.new({
engine: {
type: Faye::Redis
# non-default redis connection config here
}
}))
$ echo "sid=0\nsid=1" | ruby -rzlib -e 'puts Zlib::Deflate.deflate(STDIN.read).length'
19
$ echo "sid=0\nsid=0" | ruby -rzlib -e 'puts Zlib::Deflate.deflate(STDIN.read).length'
18
@paulbaumgart
paulbaumgart / quiz.html
Created February 29, 2012 22:35
Quiz: what does this HTML file display when rendered?
<script>
<!--
//<script></script> not displayed
-->
//<script></script> displayed
</script>
<br />
<script>
<!--
var a,b;
# ps1
if true; then
OFF="\[\033[0m\]"
BLACK="\[\033[0;30m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[0;32m\]"
YELLOW="\[\033[0;33m\]"
BLUE="\[\033[0;34m\]"
MAGENTA="\[\033[0;35m\]"
CYAN="\[\033[0;36m\]"
@paulbaumgart
paulbaumgart / gist:1066845
Created July 6, 2011 08:38
Plot the length history of a file in a git repo
file_length_history() {
export filename="$1"
(
echo set xlabel \"Days Ago\"
echo set ylabel \"Bytes\"
echo plot \"-\" title \"$filename\" with lines
now=$(date +"%s")
git log --reverse --format=format:"%at %H" "$filename" | \
while read -a line; do
echo -en "$(echo scale=10\; \(${line[0]} - $now\) / 24 / 60 / 60 | bc)\t"
var SYSTEM = require('system'),
HTTP = require('http-client'),
OS = require('os');
var url = SYSTEM.args[1];
if (!url) {
print('usage:');
print('js ' + SYSTEM.args[0] + ' <fileformat.info URL>');
OS.exit(1);
(function() {
// ==UserScript==
// @name Google Code Search Improver
//
// @include http://google.com/codesearch/*
// @include http://www.google.com/codesearch/*
// @include https://google.com/codesearch/*
// @include https://www.google.com/codesearch/*
//
_XMLHttpRequest = XMLHttpRequest;
XMLHttpRequest = function () {
Object.defineProperty(this,
"__onreadystatechange",
{value: null,
writable: true,
enumerable: false});
Object.defineProperty(this,
"onreadystatechange",
require 'rubygems'
require 'fileutils'
dir = File.dirname(File.expand_path(__FILE__))
$LOAD_PATH.unshift(File.join(dir, 'lib'))
$LOAD_PATH.unshift(dir)
require 'gollum'
NUM_PAGES=1000
$ mvn -N install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building ANTLR Master build control POM
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [buildnumber:create {execution: default}]
[INFO] Storing buildNumber: Sep 25, 2010 22:48:12 at timestamp: 1285480092481
[INFO] Executing: /bin/sh -c cd /Users/paul/Documents/Work/280North/static/antlr && svn --non-interactive info
[INFO] Working directory: /Users/paul/Documents/Work/280North/static/antlr