Skip to content

Instantly share code, notes, and snippets.

View ekd123's full-sized avatar

Mice Super ekd123

View GitHub Profile
@ekd123
ekd123 / 地圖.tcl
Last active August 29, 2015 13:56
世界地圖
#!/usr/bin/env tcl
package require Tk
package require http
set universes [encoding convertfrom utf-8 [http::data [http::geturl http://ekd123.org/map.tcl]]]
set universe {}
set lastIDs {}
wm title . "地圖"
ttk::combobox .switcher -values [dict keys $universes] -state readonly
@ekd123
ekd123 / Rational.java
Created October 2, 2014 14:38
a Rational class implementation which corresponds to Algs4 1.2.16
public class Rational {
private long n;
private long d;
public Rational (long numerator, long denominator) {
n = numerator;
d = denominator;
}
public long gcd(long p, long q) {
if (q == 0) return p;
long r = p % q;
@ekd123
ekd123 / install-fpack-fedora.sh
Last active December 19, 2015 13:40
Install fpack for 64bit Fedora users
#!/bin/sh
echo Installing NekoVM for 64-bit users
wget http://s.dropcanvas.com/1000000/173000/172490/nekovm-2.0.0-1.fc19.x86_64.rpm -O /tmp/nekovm.rpm
yum localinstall /tmp/nekovm.rpm
unlink /tmp/nekovm.rpm
echo Installing fpack
wget https://github.com/fpack/fpack/releases/download/v1.0/fpack.n -O /tmp/fpack.n
nekotools boot /tmp/fpack.n
mv /tmp/fpack /usr/bin/fpack
@ekd123
ekd123 / cl-xmppgame.lisp
Created August 11, 2013 16:41
My CL-XMPPGAME rc file
(setf cl-xmppgame:*domain* "xmppdomain.org")
(setf cl-xmppgame:*username* "bot")
(setf cl-xmppgame:*password* "your password here")
(require :drakma)
(require :cl-json)
(require :bordeaux-threads)
(cl-xmppgame:add-command-handler
""
@ekd123
ekd123 / 提取文本中的漢字.tcl
Created August 28, 2013 07:12
提取文本中的漢字,不包含標點。支持所有Unicode標準區和擴展 AB 區。
#!/usr/bin/env tclsh
package require Tk
pack [ttk::label .l1 -text "在下面的框中輸入要檢查的文本"] -fill x
pack [text .input] -fill both -expand 1
pack [ttk::label .l2 -text "結果"] -fill x
pack [text .output] -fill both -expand 1
pack [ttk::button .start -text "開始" -command startFind] -side right
proc charIsChinese {ch} {
@ekd123
ekd123 / stopwatch.tcl
Last active December 24, 2015 13:49
秒錶
set seconds {}
set timetext 00:00:00
set id {}
ttk::label .time -textvariable timetext -font {Arial 32}
ttk::button .reset -text 清零 -command reset
ttk::button .start -text 計時 -command {
reset
set seconds -1
setSeconds
}
@ekd123
ekd123 / 全角到半角.tcl
Last active December 24, 2015 19:19
把全角符號變成半角符號。
pack [text .input] -fill both -expand 1
pack [ttk::button .start -text "開始" -command {
set contents [.input get 1.0 end]
.input delete 1.0 {end -1c}
.input insert 1.0 [join [lmap char [split $contents {}] {
switch -exact -- $char {
a {return -level 0 a}
b {return -level 0 b}
c {return -level 0 c}
d {return -level 0 d}
@ekd123
ekd123 / 發圖.tcl
Last active December 24, 2015 21:09
package require Tk
package require tkdnd
pack [ttk::label .drop -text "拖放到此處"] -fill both -expand 1
pack [ttk::button .browse -text "或選擇文件" -command chooseFileToUpload]
tkdnd::drop_target register .drop *
bind .drop <<Drop>> {
upload %D
}

Keybase proof

I hereby claim:

  • I am ekd123 on github.
  • I am ekd123 (https://keybase.io/ekd123) on keybase.
  • I have a public key whose fingerprint is EB9B 2ABA 008A B0C5 5590 A315 9BE0 1CF3 26ED A05F

To claim this, I am signing this object: