Skip to content

Instantly share code, notes, and snippets.

@akfish
akfish / q_full_adder.q
Created May 27, 2014 05:31
Quantum Full Adder
// This is a semi-quantum fulladder. It adds to b_in
// a c-number. Carry-in bit is c_in and carry_out is
// c_out. xlt-l and L are enablebits. See documentation
// for further information
proc muxfa a, b_in, c_in, c_out, xlt_l, L, total //a,
if a == 0//00
Toffoli b_in, c_in, c_out
@be5invis
be5invis / ceki-tco.js
Last active January 28, 2016 20:55
CEK interpreter with TCO example
// noprotect
function Lambda(param, body, e){
this.param = param
this.body = body
this.env = e
};
Lambda.prototype.apply = function(t, args, k0){
var e_ = Object.create(this.env);
for(var j = 0; j < this.param.length; j++){
e_[this.param[j]] = args[j];
@Ins1ne
Ins1ne / README.md
Created September 19, 2012 17:43 — forked from smileart/README.md
My ZSH Theme — Agnoster Mod

My modified fork of agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

Compatibility

adb shell appops set com.tencent.mm OP_READ_PHONE_STATE ignore
adb shell appops set com.tencent.mm COARSE_LOCATION ignore
adb shell appops set com.tencent.mm FINE_LOCATION ignore
adb shell appops set com.tencent.mm RUN_IN_BACKGROUND ignore
@weakish
weakish / 7-lang.md
Last active March 26, 2018 02:34
#跋 七周七語言 #coding

Bruce A.Tate. 七周七语言[M]. 巨成,戴玮,白明,譯. 人民邮电出版社,2012-5. ISBN 978-7-115-27611-7.

Ruby

Matz: 1993年,當我看到Perl的時候,不知怎麼的,這種混合了Lisp和Smalltalk特徵的面向對象語言讓我的靈感一下子迸發出來。我意識到Perl將成爲一門可提高我們生產力的偉大語言。於是,出於自娛自樂的動機,我着手開發一門與之類似的語言。(p. 9)

這讓我想起鳳姐的「Ruby就是沒有到處打廣告的Perl 6」.

Matz: 我喜歡它寓編程於樂的方式。說到某個具體的技術點,我最喜歡的是“代碼塊”(block)。代碼塊即是一種易於控制的高階函數,也爲DSL及其他特性的實現提供了極大的靈活性。(p. 9)

@bao3
bao3 / cert-client.sh
Created October 6, 2014 08:31
这是几个用来签发证书的脚本,请注意这需要你安装了gnutls才可以,主要当时是为了ocserv而写,纯偷懒。基本上,你只要用 ./cert-client.sh you-user-name 这种格式,就可以自动生成 you-user-name-key.pem/ your-user-name-cert.pem /your-user-name.p12
#! /bin/sh
#! /usr/bin/expect -f
certtool --generate-privkey --outfile $1-key.pem
sed -i "1ccn = "${1}"" client.tmpl
sed -i "3cemail = ${1}@abc.org" client.tmpl
certtool --generate-certificate --load-privkey $1-key.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem --template client.tmpl --outfile $1-cert.pem
openssl pkcs12 -export -inkey $1-key.pem -in $1-cert.pem -name "$1 VPN Client Cert" -certfile ca-cert.pem -out $1.cert.p12
@vadviktor
vadviktor / etc.fstab
Last active February 3, 2019 09:08
Ubuntu guest VMware shared folders using open-vm-tools package and vmhgfs-fuse
.host:/vmshared /mnt/vmshared fuse.vmhgfs-fuse allow_other,uid=1000,gid=1000,auto_unmount,defaults 0 0
@ymjing
ymjing / mesalink_release_v0.6.0_chn.md
Last active April 3, 2019 08:03
MesaLink v0.6.0 released [Chinese version]

Personal Tech stack

Go

Queue:

  • NATS for messaging queue.

Database:

@oysteinjakobsen
oysteinjakobsen / gist:e59cdd38a688ee8a418a
Last active August 7, 2019 14:38
How to get docker-compose (fig) up and running on Raspberry Pi 2

Background

I assume you already have Docker up and running on your Raspberry Pi 2. If not, see this article.

The next natural step is to install Docker Compose (formerly Fig), but there's no ARM support out of the box. This recipe will help you install Docker Compose on your Raspberry Pi 2!

The following six steps will do the trick:

  1. Get the docker-compose source code from git