Skip to content

Instantly share code, notes, and snippets.

@raylu
raylu / html.py
Created May 1, 2015 23:15
(x)html parser
#!/usr/bin/env python3
import html
import http.client
import re
from xml.etree import ElementTree
parser = ElementTree.XMLParser()
for entity, char in html.entities.html5.items():
parser.entity[entity[:-1]] = char
@raylu
raylu / cVimrc
Last active March 13, 2019 17:44
cVimrc
set nosmoothscroll
map <C-u> scrollPageUp
map <C-d> scrollPageDown
map t :tabnew!<Space>
map p ;
let blacklists = ["http://www.typingclub.com/*","http://www.keybr.com/*","http://en.lichess.org/*","http://vim-adventures.com/*","http://airbnb.io/*","https://coderpad.io/*","https://app.codesignal.com/*"]
@raylu
raylu / shell.py
Last active March 29, 2022 07:02
shell starter
#!/usr/bin/env python3
import os
while True:
line = input('> ')
os.execvp(line, [line])
# 0. run this code and try `ls` to make sure that much works
# 1. handle arguments (`ls /`)
@raylu
raylu / wsgi.py
Created February 10, 2015 23:12
simplest wsgi setup
#!/usr/bin/env python3
import wsgiref.simple_server
def app(environ, start_response):
start_response('200 OK', [('Content-type', 'text/plain')])
return ['hello world'.encode('utf-8')]
def main():
server = wsgiref.simple_server.make_server('0.0.0.0', 8000, app)
@raylu
raylu / gist:5417390
Created April 19, 2013 00:58
gist paster
#!/usr/bin/env python
import requests
import sys
rs = requests.Session()
if len(sys.argv) == 2:
filename = sys.argv[1]
f = open(filename, 'r')
@raylu
raylu / Makefile
Last active November 9, 2019 12:39
Go question
go: go.c
gcc -o go -O go.c -Wall -Wextra -std=c11 -ggdb