Skip to content

Instantly share code, notes, and snippets.

@lyricat
lyricat / prime_sieve.go
Created August 15, 2012 11:21
A concurrent prime sieve
// A concurrent prime sieve
// via: http://golang.org/doc/play/sieve.go
package main
// Send the sequence 2, 3, 4, ... to channel 'ch'.
func Generate(ch chan<- int) {
for i := 2; ; i++ {
ch <- i // Send 'i' to channel 'ch'.
}
@lyricat
lyricat / sieve_prime.py
Created August 15, 2012 13:00
prime sieve
def Generate():
i = 2
while True:
yield i
i += 1
def Filter(ig, prime):
while True:
i = ig.next()
if i % prime != 0:
@lyricat
lyricat / novice_killer.user.js
Created November 30, 2012 08:32
干掉V2EX上所有使用默认头像用户的发言。
// ==UserScript==
// @name v2ex novice killer
// @namespace http://shellex.info
// @author shellex([email protected])
// @description 干掉使用默认头像的人的发言
// @include http://www.v2ex.com/go/*
// @include http://v2ex.com/go/*
// @include http://www.v2ex.com/?tab=*
// @include http://v2ex.com/?tab=*
// @include http://www.v2ex.com/
package main
import (
"log"
"net/http"
"os"
"strconv"
)
func main() {
{"sig":"a293547562670c16f6255e8211142af500d8d0ce4dc089524e1afe45f15445e2df93b12643ee76cb721c0809cb5a9aacb4d1e8d6c58b6a2b4e155bd7bfe300f71","msghash":"1efc4f0adb73fc2fa4e54d23fb2f9317f961fab3de5caea280365b68c79ea285"}
https://press.one/p/address/v?s=1f32b5890f5ce82fd954e6f53c810dc69c0643fedd28256acea962104baf9e12d988a1143ce45b8c678eb4b401787117fa4900473a66911b946e3c4f886e237e0&h=291979a92f252232ff78ced04dc91624d3041fcc849b7c303b5dbbbd790dbca2&a=ab13c41cea3e9bfb7ce690f973187549884f35d0&f=P1&v=2
https://press.one/p/address/v?s=1f32b5890f5ce82fd954e6f53c810dc69c0643fedd28256acea962104baf9e12d988a1143ce45b8c678eb4b401787117fa4900473a66911b946e3c4f886e237e0&h=291979a92f252232ff78ced04dc91624d3041fcc849b7c303b5dbbbd790dbca2&a=ab13c41cea3e9bfb7ce690f973187549884f35d0&f=P1&v=2