Skip to content

Instantly share code, notes, and snippets.

@huyng
huyng / reflect.py
Created February 7, 2011 17:57
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@Newky
Newky / HaskellRandom.hs
Created January 3, 2012 10:59
Haskell random generator demonstrating state monad.
import System.Random
newtype State s a = State {
runState :: s -> (a, s)
}
returnState :: a -> State s a
returnState a = State (\s-> (a, s))
bindState :: State s a -> (a -> State s b) -> State s b

Coqはじめる人に説明する用文章

Coqとは何か?

形式的定理証明をするためのプログラミング言語と開発環境のセットです。

Coqで何ができるの?

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 21, 2024 01:45
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@bouk
bouk / dijkstra.hs
Created January 6, 2013 14:17
Dijkstra's algorithm implemented in Haskell. Example input: 5 7 0 1 2 0 2 7 0 3 6 1 4 6 1 2 3 2 4 5 3 4 1
import Data.List (insert)
fst3 (x,_,_) = x
snd3 (_,x,_) = x
trd3 (_,_,x) = x
toTuple2Int :: String -> (Int, Int)
toTuple2Int s = (read $ takeWhile (/=' ') s :: Int, read $ dropWhile (==' ') $ dropWhile (/=' ') s :: Int)
toTupleTuple2Int :: String -> (Int, (Int, Int))
void drawFolder(int sides, float rad) {
float ang = (frameCount * 2 * PI * 0.05) / sides;
PVector maxy = new PVector(0, 0);
PVector[] v = new PVector[sides];
for (int i = 0; i != v.length; ++i) {
float angle = ((2 * PI * i) / sides) + ang;
float x = sin(angle) * rad;
@hoto17296
hoto17296 / snowfall.css
Last active December 31, 2015 17:19
こなああああああゆきいいいいいい ねぇ!!!
@charset "utf-8";
/* labelと:checked擬似クラスで擬似onClick実装 */
#snowfall label {
font-size: xx-large;
fon-weight: bold;
color: #fff;
background-color: #99f;
padding: .5em 1em;
margin: 1em 0;
@kumar8600
kumar8600 / lingr-api-memo.md
Last active October 27, 2015 04:59
Lingr API メモ

ここでは、Lingr Bot APIについての情報を取り扱わず、Lingr APIについてのみ扱う。

参照

@Wunkolo
Wunkolo / ASCIIRayTrace.cpp
Last active June 13, 2021 05:36
Just a fun ASCII raytracer I made one day.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <initializer_list>
#include <thread>
#include <chrono>
@Psycojoker
Psycojoker / a.md
Last active October 10, 2017 17:51
Github's pages targeted by porn industry DMCA request to google

Apparently the porn industry is going after github pages (by sending DMCA to google), you can read the story here (found there).

Using https://www.chillingeffects.org/notices/search?page=1&sort_by=&term=github.com (https://github.com/berkmancenter/chillingeffects/blob/master/doc/api_documentation.mkd#example-successful-response-2) (and an horribly quick and dirty script), here is the list all the concerned users and repositories page (you can find the data bellow):

Users pages