This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lisp interpreter in 90 lines of C++ | |
I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second. | |
Just for fun I wondered if I could write one in C++. My goals would be | |
1. A Lisp interpreter that would complete Peter's Lis.py test cases correctly... | |
2. ...in no more than 90 lines of C++. | |
Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "`ps aux | grep 'emacs --daemon'|grep -v grep`" ];then | |
echo "Daemon is not started,starting daemon..." | |
emacs --daemon >/dev/null 2>&1 | |
fi | |
list=`wmctrl -l|grep "emacs"` | |
if [ -z "$list" ];then | |
emacsclient -nc $* | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def fac(n): | |
if n==0: | |
return 1 | |
r=1 | |
for i in xrange(2,n+1): | |
r*=i | |
return r | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from gmpy import * | |
def fac(n): | |
if n==0: | |
return 1 | |
r=mpz(1) | |
for i in xrange(2,n+1): | |
r*=i | |
return r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from gmpy import * | |
if __name__ == '__main__': | |
print fac(int(sys.argv[1])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
traceroute to 61.184.202.221 (61.184.202.221), 30 hops max, 40 byte packets | |
1 192.168.0.1 (192.168.0.1) 0.587 ms 0.516 ms 0.525 ms | |
2 * 61.184.202.221 (61.184.202.221) 288.025 ms * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PING 61.184.202.221 (61.184.202.221) 56(84) bytes of data. | |
64 bytes from 61.184.202.221: icmp_req=1 ttl=116 time=279 ms | |
64 bytes from 61.184.202.221: icmp_req=2 ttl=116 time=278 ms | |
64 bytes from 61.184.202.221: icmp_req=3 ttl=116 time=278 ms | |
64 bytes from 61.184.202.221: icmp_req=4 ttl=116 time=280 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding:utf-8 | |
if __name__=='__main__': | |
for i in range(4): | |
raw_input() | |
count=1 | |
first='' | |
second='' | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAraUohxjNFuSC8sBJm6MlYbRDsb5H+ID20E6N6Ky1tss7oZqn/RyothoOwCAa44UmwBvV7dpD4pJ0xNtNzZAIs8hAYAH/pzmzwZOjjZqLQ+YQ6vSyoumbxq05yLr07gy7v61K4Wi8nUWlufdOpaV1QeHtEzZqsBKEVlK+hlRCTzO/8iCc7iQzIXM46jeaRwOuV7f5NdfiRLX8Xp6EfA8rRP8Qx+UPMESYVY4qLtLVhIv15sf8Lu6M0nXWW5GOmw2f1ToiNJG7krueREFNHvWXs9/yjinbzbC+ZIlyXbt/Eabyj0w/WCt7ZwT/HkDosPYMCMcPIdEF2xTdqti+PzPDxQ== [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
base64 -d << EOF | |
IyBHb29nbGUgKwoyMDMuMjA4LjQ2LjIyIHRhbGtnYWRnZXQuZ29vZ2xlLmNvbSAKCjI0MDQ6Njgw | |
MDo4MDA1Ojo3MSBwcm9maWxlcy5nb29nbGUuY29tIAoyNDA0OjY4MDA6ODAwNTo6NjUgcGx1c29u | |
ZS5nb29nbGUuY29tIAoyNDA0OjY4MDA6ODAwNTo6OGEgcGx1cy5nb29nbGUuY29tIAoyNDA0OjY4 | |
MDA6ODAwNTo6NjIgdGFsa2dhZGdldC5nb29nbGUuY29tIAoKMjAzLjIwOC40Ni4xODAgbGg2Lmdv | |
b2dsZXVzZXJjb250ZW50LmNvbSAKMjAzLjIwOC40Ni4xODAgbGg1Lmdvb2dsZXVzZXJjb250ZW50 | |
LmNvbSAKMjAzLjIwOC40Ni4xODAgbGgzLmdvb2dsZXVzZXJjb250ZW50LmNvbSAKMjAzLjIwOC40 | |
Ni4xODAgbGgyLmdvb2dsZXVzZXJjb250ZW50LmNvbSAKMjAzLjIwOC40Ni4xODAgbGgxLmdvb2ds | |
ZXVzZXJjb250ZW50LmNvbSAKMjAzLjIwOC40Ni4xODAgbGg0Lmdvb2dsZXVzZXJjb250ZW50LmNv | |
bSAKMjAzLjIwOC40Ni4xODAgd2ViY2FjaGUuZ29vZ2xldXNlcmNvbnRlbnQuY29tIAoyMDMuMjA4 |
OlderNewer