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 -*- | |
# | |
# Implementation of the byterun virtual machine demo by Allison Kaptur, as described in the article | |
# "A Python Interpreter Written in Python", http://aosabook.org/en/500L/a-python-interpreter-written-in-python.html | |
# | |
import dis, collections, operator, inspect, types, sys | |
Block = collections.namedtuple("Block", "type, handler, stack_height") |
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
# Can also be put into .bashrc | |
if [ "$SSHD_STARTER" != "1" ] && [ "$SSH_CONNECTION" == "" ] | |
then | |
read -p "Start sshd? [Y/n]" answ | |
case $answ in | |
"n"|"N") | |
;; | |
*) | |
ip=`ip addr | egrep "wlan0$" | awk 'BEGIN { FS = "[ \t]+" } { print substr($3, 1, index($3, "/") - 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
#/bin/bash | |
BIGFILE="/tmp/Magician - Big Song.ogg" | |
ARTIST="The Magician" | |
EXT=".ogg" | |
IFS=" | |
" | |
tracks="0:00:00 0:08:37 Eurydice and Orpheus |
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
[Desktop Entry] | |
Name=JetBrains MPS | |
Icon=/opt/jetbrains-mps/bin/MPS_128.png | |
GenericName=Meta Programming System | |
Comment=Meta Programming System | |
Exec=/bin/mps | |
Terminal=false | |
Type=Application | |
Categories=Development;IDE; | |
StartupNotify=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
/* | |
Fig. 6.13. A fully backtracking recursive-descent parser | |
from the Book Parsing Techniques, 2nd Edition. | |
*/ | |
#include <stdio.h> | |
#define MAXSIZE 100 | |
/* some large value */ |
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 re | |
def eval(s): | |
def gen(r, prefix = "", inc = 0): | |
if not r[0][1]: | |
return prefix + r[0][0] + "\n" | |
p = r[0][1].split(",") | |
ret = "" |
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/sh | |
SEDSCR=' | |
s/\bpgnonterminal\b/pgnonterm/g | |
s/\bpg_nonterminal_/pg_nonterm_/g | |
s/\bpgterminal\b/pgterm/g | |
s/\bpg_terminal_/pg_term_/g | |
s/\bpgproduction\b/pgprod/g | |
s/\bpg_production_/pg_prod_/g | |
s/\bpg_symbol_is_nonterminal\b/pg_symbol_is_nonterm/g |
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
#!/usr/bin/python | |
import os, re, datetime | |
storepath = os.path.join(os.environ["HOME"], "storage", "shared") | |
pat = re.compile(r"\d{8}") | |
for root, dirs, files in os.walk("."): | |
for filename in files: | |
match = pat.findall(filename) |
NewerOlder