Skip to content

Instantly share code, notes, and snippets.

ParcelableMessage<Alpha> alpha = ...
Alpha a = alpha.getProto();
public class ParcelableMessage<T extends MessageMicro> implements Parcelable {
public int messageType;
public byte[] protoBytes;
private T mProto;
public T getProto() {
if (mProto == null) {
mProto = getProto(this);
}
return mProto;
public class ParcelableMessage implements Parcelable {
public int messageType;
public byte[] protoBytes;
private MessageMicro mProto;
public MessageMicro getProto() {
if (mProto == null) {
mProto = getProto(this);
}
return mProto;
public static MessageMicro getProto(ParcelableMessage message) {
switch (message.messageType) {
case ALPHA :
return Alpha.AlphaParser.parse(response.protoBytes);
case BETA :
return Beta.BetaParser.parse(response.protoBytes);
default :
return null;
}
}
public class ParcelableMessage implements Parcelable {
public int messageType;
public byte[] protoBytes;
}
$ perl -MDigest::SHA -le '$h = substr( Digest::SHA::sha1_hex($ARGV[0]) , 5 ); open F, "<SHA1.txt"; do { print "found $_" if grep(/$h/, $_) } while (<F>)' fuckyou
found 00000b87ea9eb7a32fd4057276d3a1fab861c1d5
$ perl -MDigest::SHA -le '$h = substr( Digest::SHA::sha1_hex($ARGV[0]) , 5 ); open F, "<SHA1.txt"; do { print "found $_" if grep(/$h/, $_) } while (<F>)' fuckoff
found 0000007681665f3dc017ebcab0c4cd7b1733e102
$ perl -MDigest::SHA -le '$h = substr( Digest::SHA::sha1_hex($ARGV[0]) , 5 ); open F, "<SHA1.txt"; do { print "found $_" if grep(/$h/, $_) } while (<F>)' goddamnit
found 00000de322068568e53b8b1ade5f09c1685cf1ed
$ perl -MDigest::SHA -le '$h = substr( Digest::SHA::sha1_hex($ARGV[0]) , 5 ); open F, "<SHA1.txt"; do { print "found $_" if grep(/$h/, $_) } while (<F>)' imfucked
@michael-galpin
michael-galpin / bits.c
Created February 28, 2012 16:44
K&R exercise 2-6, 2-7, 2-8. Bit shifting FTW!
/*
Exercise 2-6. Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to the rightmost n bits of y, leaving the other bits unchanged.
*/
unsigned int setbits(unsigned int x, int p, int n, unsigned int y)
{
// get n right-most bits of y only
y = ~(~0 << n) & y;
// shift those n bits p-n bits to the left
y = y << (p-n);
// zero out n bits of x starting at p
#include <stdio.h>
#include <float.h>
float calcMinFloat();
int main()
{
float f;
f = FLT_MIN;
#include <stdio.h>
#include <float.h>
#define INF 1.0/0.0
float calcMinFloat();
float calcFloatErr();
float calcMaxFloat();
int main()