Skip to content

Instantly share code, notes, and snippets.

View tani's full-sized avatar
:octocat:
LISP interpreter

TANIGUCHI Masaya tani

:octocat:
LISP interpreter
View GitHub Profile
@yunazuno
yunazuno / skk.py
Created January 18, 2012 06:44
Python port of libskk/tools/tool.vala (prototype)
#!/usr/bin/python
# -*- coding: utf-8 -*-
from gi.repository import Skk
import sys
Skk.init()
dictionaries = []
dictionary = Skk.FileDict.new("/usr/share/skk/SKK-JISYO.L", "EUC-JP")
dictionaries.append(dictionary)
@mumoshu
mumoshu / Amb.scala
Created March 7, 2012 15:05
Scalaの限定継続で四天王問題を解く例にprintlnを仕込んで解析してみた
// papamitraさんの「Scalaの限定継続で四天王問題解いてみた」
// http://d.hatena.ne.jp/papamitra/20100912/continuations
//
// について、何が起こっているのかわからなかったので、println仕込んで解析してみた。
//
// 実行方法
// scalac -P:continuations:enable Amb.scala
import scala.util.continuations._
@kmizu
kmizu / Amb.scala
Created March 13, 2012 12:48
Minimal implementation of amb by shift/reset
//scalac -P:continuations:enable
import scala.util.continuations._
object Amb{
def amb[T](elements: T*):T @suspendable = shift{k:(T=>Unit) => elements.foreach(k)}
def block(body : => Unit @suspendable): Unit = reset(body)
def main(args: Array[String]) {
block {
val a = amb(1, 2, 3)
val b = amb("A", "B", "C")
println(a, b)
@nyuichi
nyuichi / gist:3320261
Created August 11, 2012 03:01
delimited continuation in post increment
// 後置インクリメントは限定継続を使って表せるし、
// 逆に限定継続の一番身近な例が後置インクリメント
// http://www.kmonos.net/pub/Presen/fltv/FLTV.pdf
class BigInt {
BigInt&/<noreturn> operator++(int) {
var f = rest_of_full_expression();
var g = after_full_expression();
var r = f(*this);
this->incr();
g(r);
@vorburger
vorburger / gist:3429822
Created August 22, 2012 22:03
How to find an available (free) TCP port in Java
/**
* Returns a free port number on localhost.
*
* Heavily inspired from org.eclipse.jdt.launching.SocketUtil (to avoid a dependency to JDT just because of this).
* Slightly improved with close() missing in JDT. And throws exception instead of returning -1.
*
* @return a free port number on localhost
* @throws IllegalStateException if unable to find a free port
*/
private static int findFreePort() {
@tatsuro-ueda
tatsuro-ueda / GitHub Pagesの開設のしかた.md
Created September 3, 2012 10:49
GitHub Pagesの開設のしかた

##GitHub Pagesの開設のしかた(2012年9月版)

  1. username.github.comという名前のリポジトリをつくる

  2. つくったリポジトリに入る

  3. 「Admin」をクリック

  4. 下にスクロール

@willurd
willurd / web-servers.md
Last active June 13, 2024 14:37
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@kurotaky
kurotaky / gist:6435921
Last active April 14, 2023 14:41
Pull Request 後にfork 元リポジトリのmasterの変更を rebase で追随してpush する。
hippo-password-strength の master の最新の変更を取り込んでPRする。
(すでにPR出している場合)
```
git remote add upstream git@github.com:kurotaky/hippo-password-strength.git
git checkout master
git pull upstream master
git checkout using-img-src
git rebase master using-img-src
git push -f origin using-img-src
@nlothian
nlothian / Penn Treebank II Tags.md
Last active June 11, 2024 19:06
Penn Treebank II Tags
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active May 19, 2024 19:25
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.