Skip to content

Instantly share code, notes, and snippets.

/* Base fragment to ensure the parent activity implements a contract interface. */
public abstract class ContractFragment<T> extends Fragment {
private T mContract;
@Override
public void onAttach(Activity activity) {
try {
mContract = (T)activity;
} catch (ClassCastException e) {
throw new IllegalStateException(activity.getClass().getSimpleName()
@MichaelEvans
MichaelEvans / app.rb
Created December 24, 2013 16:42 — forked from will3942/app.rb
require 'openssl'
require 'base64'
require 'json'
require 'httpclient'
http = HTTPClient.new(:agent_name => useragent)
key = "" #The Private key
login_info = {:guid => "00000000-0000-0000-0000-000000000000,
:password => "PASSWORD",
:username => "USERNAME",
package com.cyrilmottier.android.citybikes.provider;
import android.net.Uri;
import com.cyrilmottier.android.avelov.BuildConfig;
/**
* @author Cyril Mottier
*/
public class CityBikesContract {
package main
import (
"crypto/sha1"
"fmt"
"io"
"bytes"
"os/exec"
)
require 'digest/sha1'
tree = `git write-tree`
parent = `git rev-parse HEAD`
puts "Tree: #{tree}"
puts "Parent: #{parent}"
def test(start, tree, parent)
sha1 = "9403248290"
counter = start
@MichaelEvans
MichaelEvans / horace.rb
Created January 23, 2014 04:02
horace.rb
require 'digest/sha1'
class Miner
attr_reader :tree, :parent, :timestamp
def initialize
@tree=`git write-tree`.chomp
@parent=`git rev-parse HEAD`.chomp
@timestamp=12345
end
/**
* From a file that contains
* doc_id w1 w2 w3 ... lines, separated by tabs
* return an inverted index Map of w -> Set(doc_id)
*
* @param filename well isn't it obvious
* @return Map[String,Set[String]]
*/
import scala.collection.immutable.Map
@MichaelEvans
MichaelEvans / colors.rb
Created February 11, 2014 19:22 — forked from nhocki/colors.rb
module Colors
def colorize(text, color_code)
"\033[#{color_code}m#{text}\033[0m"
end
{
:black => 30,
:red => 31,
:green => 32,
:yellow => 33,
@MichaelEvans
MichaelEvans / gist:9096421
Created February 19, 2014 17:03
Programming Joke
A man flying in a hot air balloon suddenly realizes he’s lost. He reduces height and spots a man down below. He lowers the balloon further and shouts to get directions, "Excuse me, can you tell me where I am?"
The man below says: "Yes. You're in a hot air balloon, hovering 30 feet above this field."
"You must work in Information Technology," says the balloonist.
"I do" replies the man. "How did you know?"
"Well," says the balloonist, "everything you have told me is technically correct, but It's of no use to anyone."
#!/usr/bin/python
# Connects to servers vulnerable to CVE-2014-0160 and looks for cookies, specifically user sessions.
# Michael Davis (mike.philip.davis@gmail.com)
# Based almost entirely on the quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import select