Skip to content

Instantly share code, notes, and snippets.

View TheWaWaR's full-sized avatar
🌀
Focusing

LingFeng TheWaWaR

🌀
Focusing
View GitHub Profile
@knowtheory
knowtheory / sql.citrus
Created May 20, 2011 16:24
A Parsing Expression Grammar for parsing an SQL subset. Written as a start to parsing SQL and generating Veritas relations (see: https://github.com/dkubb/veritas )
grammar SQL
rule statement
select_statement <Veritas::SQL::Select>
| set_operation_statement <Veritas::SQL::SetOperation>
| "(" [\s]* statement [\s]* ")"
end
rule set_operation_statement
"(" [\s]* left:select_statement <Veritas::SQL::Select> [\s]* ")"
[\s]* set_operator ([\s]+ distinct:`DISTINCT`)? [\s]*
@lrvick
lrvick / flask_geventwebsocket_example.py
Created September 1, 2011 07:17
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@danaspiegel
danaspiegel / gist:3105761
Created July 13, 2012 16:19
Git pre-commit hook to check pep8 and pyflakes
#!/usr/bin/python
# borrowed from https://github.com/lbolla/dotfiles/blob/master/githooks/pre-commit
import os
import sys
import re
import subprocess
@elpuri
elpuri / gist:3753756
Created September 20, 2012 03:12
A collapsible nested list example in QML
import QtQuick 1.1
Item {
width: 200
height: 300
ListView {
anchors.fill: parent
model: nestedModel
delegate: categoryDelegate
@ralph-tice
ralph-tice / gist:4252866
Last active October 13, 2015 20:38
swapping out OpenJDK for Oracle JDK on Amazon EC2
#download the JDK
#oracle's rpm.bin gets pulled down as corrupt..zzz
#wget --no-cookies --header "Cookie: gpw_e24=xxx" "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64-rpm.bin" -O jdk-7-linux-x64-rpm.bin
#updated for version 7u11
wget --no-cookies --header "Cookie: gpw_e24=xxx" http://download.oracle.com/otn-pub/java/jdk/7u11-b21/jdk-7u11-linux-x64.rpm -O jdk-7u11-linux-x64.rpm
sudo rpm -ivh jdk-7u11-linux-x64.rpm
sudo alternatives --install /usr/bin/java java /usr/java/default/bin/java 20000
@danielholmstrom
danielholmstrom / crash_syslog.py
Created January 31, 2013 18:09
Crash syslog.syslog() in python by logging an empty zip-file.
"""How to crash syslog.syslog
File: crash_syslog.py
Running this will product this output:
Traceback (most recent call last):
File "./crash_syslog.py", line 12, in <module>
syslog(LOG_INFO, base64.b64decode(b64))
TypeError: [priority,] message string
@rve
rve / gist:5652087
Last active December 25, 2017 08:42
纪念p神
p神注销了!从此对我来说豆瓣就是一个没有男神的地方的。现在我能做的,就是让p神的神迹在新注册的友邻中流传“从前豆瓣上有一个p神,他读过了cs领域每一本书,当然,他很不喜欢(formal) semantics ...
p神真正地神格化了,它已经与CS类书评数据合为一体,融入了推荐系统的AI里,活在了每一次豆瓣猜中。而我永远怀念的,却是他那品味算不高的AV番号……
许多年之后,面对豆瓣猜,X君准会想起那个P神注销的遥远的上午。
想起评论区曾经一度被p神所支配的恐怖,还有被囚禁于p神阅读面里的那份屈辱 -
@dcrystalj
dcrystalj / startup.bat
Created December 12, 2013 11:12
windows conEmu startup aliases
doskey subl="C:\Program Files\Sublime Text 2\sublime_text.exe" $*
doskey ls=ls $1 --color
doskey ll=ls -la --color
doskey sbl = sublime $*
doskey sshs = ssh [email protected]
doskey oocd = openocd-x64-0.6.1 -f .\stm32f4discovery.cfg
doskey oocd7 = openocd-x64-0.7.0 -f .\stm32f4discovery.cfg
doskey sshkey = type C:\Users\dcrystalj\.ssh\id_rsa.pub | clip & echo "ssh key in clipboard"
:: Git
@byronhe
byronhe / modern_crypto.md
Last active March 28, 2022 07:51
现代密码学实践指南[2015年]

现代密码学实践指南[2015年]

标签(空格分隔): 密码学


本文介绍目前现代密码学的最先进技术, 前半部分主要翻译自 《Cryptographic Right Answers》,附上收集的资料,和byron个人的理解。

@campaul
campaul / tarnish.rs
Created December 11, 2015 01:52
Simple HTTP proxy in Rust.
/*
Simple HTTP proxy in Rust. Hard coded to proxy rust-lang.org.
*/
extern crate hyper;
use std::io::Read;
use hyper::Client;
use hyper::header::Connection;