Skip to content

Instantly share code, notes, and snippets.

View mlc's full-sized avatar

mike castleman mlc

View GitHub Profile
diff --git a/app/models/asset_terms.rb b/app/models/asset_terms.rb
index 7969cd8..78e2688 100644
--- a/app/models/asset_terms.rb
+++ b/app/models/asset_terms.rb
@@ -4,22 +4,28 @@ class AssetTerms < ActiveRecord::Base
define_index do
indexes :identifier
indexes :title
- indexes :subject
+ # indexes :subject
@mlc
mlc / gist:738742
Created December 13, 2010 07:12
wikileaks nameservers
mlc@palm:~$ dig @a.nic.ch -t NS wikileaks.ch
; <<>> DiG 9.7.1-P2 <<>> @a.nic.ch -t NS wikileaks.ch
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16048
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 4
;; WARNING: recursion requested but not available
@mlc
mlc / test-client.rb
Created December 20, 2010 19:45
Demonstrating using XREP/XREQ to talk to a specific client. An abuse of ØMQ?
#!/usr/bin/env ruby
require 'rubygems'
require 'ffi-rzmq'
unless ARGV.size == 1
$stderr.puts "please provide your client identifier on the command-line."
exit 1
end
@mlc
mlc / gist:760245
Created December 30, 2010 20:21
sample nginx config for proxying rails.
upstream thin {
server 127.0.0.1:9000;
server 127.0.0.1:9001;
server 127.0.0.1:9002;
}
server {
listen 80;
server_name pbcore.vermicel.li;
@mlc
mlc / gist:825106
Created February 13, 2011 20:49
it's now trivial to crash almost any application written in Java. http://blogs.oracle.com/security/2011/02/security_alert_for_cve-2010-44.html
mozilla's spidermonkey is written in C++ and has no problem:
mlc@palm:~$ smjs
js> "2.2250738585072012e-308" * 2
4.450147717014403e-308
js>
but try with rhino, which is written in Java:
mlc@palm:~$ units
2411 units, 71 prefixes, 33 nonlinear units
You have: tempC(22)
You want: USD
conformability error
295.15 K
1 US$
mlc@palm:~$ units
2411 units, 71 prefixes, 33 nonlinear units
You have: 40 rod / hogshead
You want: mi / gal
* 0.001984127
/ 504
@mlc
mlc / download-tal.sh
Created April 11, 2011 00:16
Script to download This American Life episodes.
#!/bin/sh
#
# This script downloads episodes of This American Life. It is useful
# because it downloads from the server normally use for streaming
# episodes in the flash player, so you can downoad episodes that are
# newer or older than the one currently available for podcast
# listening.
#
@mlc
mlc / index.haml
Created August 3, 2011 15:39
quick barcode generation in Rails
# put into your Gemfile
gem 'chunky_png'
gem 'barby', :require => ['barby', 'barby/outputter/chunky_png_outputter']
@mlc
mlc / javasample.java
Created April 24, 2012 17:09
Accessing the Meetup API, setting the Accept-Charset header
public class Meetup {
public HttpResponse get(String url, List<? extends NameValuePair> params) throws IOException {
DefaultHttpClient cli = new DefaultHttpClient();
cli.addRequestInterceptor(new HttpRequestInterceptor() {
@Override
public void process(HttpRequest httpRequest, HttpContext httpContext) throws HttpException, IOException {
httpRequest.addHeader(HttpHeaders.ACCEPT_CHARSET, "utf-8");
}
});