This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Google Reader no header | |
// @namespace https://gist.github.com/rctay | |
// @description Hides header | |
// @include http://www.google.com/reader/view/* | |
// @include https://www.google.com/reader/view/* | |
// @include http://www.google.*/reader/view/* | |
// @include https://www.google.*/reader/view/* | |
// @version 1.0 | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . \ | |
| grep -Pi '^.*\.exe-\d*(\.\d{2}){3}\.\d{3}-\d{2}\.\d{2}\.\d{4}\.LOG$' \ | |
| sed 's/.*/"&"/' \ | |
| xargs rm -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
The Pygments Markdown Preprocessor | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
This fragment is a Markdown_ preprocessor that renders source code | |
to HTML via Pygments. To use it, invoke Markdown like so:: | |
from markdown import Markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io | |
import collection.mutable | |
class PushbackBufferedStream(in: io.InputStream, lineSize: Int = 30, bufSize: Int = 4096) | |
extends io.PushbackInputStream(in, bufSize) { | |
def readLine(): String = { | |
val read_buf = new Array[Byte](bufSize) | |
val line_buf = new mutable.ArrayBuffer[Byte](lineSize * 2) | |
def loop(sz: Int): Unit = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <malloc.h> | |
#include <string.h> | |
void print_pyramid(int k) | |
{ | |
int i; | |
size_t sz = 1 + (k-1)*2; | |
char *buf = malloc(sizeof(char) * sz); | |
memset(buf, '*', sz); | |
for (i = 1; i < k; i++) | |
printf("%*.*s\n", k + i - 1, 1 + (i-1) * 2, buf); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "list.h" | |
int | |
list_head(list *the_list, node_val *ret) | |
{ | |
if (!the_list) | |
return 1; | |
*ret = the_list->val; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/awk | |
# a1234567b@nus is not a valid address, but a1234567@nus is. Hence this | |
# script. | |
# Expects: lines of nus matric no, like a1234567[...] | |
# Outputs: comma-separated nus email addresses on a single line, like | |
# [email protected],[...] | |
{ printf "%[email protected],", substr($0,0,8) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# user-specific info | |
API_KEY= | |
USER_ID="" # be careful about escaping! | |
PASSWORD="" # ditto | |
# add additional curl options here - eg. -v | |
CURL='curl' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Translated from Haskell: | |
let sieve(p:xs) = p : sieve (filter (\ x -> x `mod` p /= 0) xs) in sieve [2..] | |
""" | |
from itertools import ifilter | |
def ints(k): | |
while True: | |
yield k | |
k+=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cache | |
def split(addr) | |
x = addr >> 3 | |
return [x & 3, x >> 2] | |
end | |
attr_reader :misses, :hits | |
def initialize | |
@misses = 0 |