Skip to content

Instantly share code, notes, and snippets.

View pcdinh's full-sized avatar

Pham Cong Dinh pcdinh

View GitHub Profile
# This file is autogenerated by the get_windows_info.py script
# Do not edit.
win_tz = {'AUS Central Standard Time': 'Australia/Darwin',
'AUS Eastern Standard Time': 'Australia/Sydney',
'Afghanistan Standard Time': 'Asia/Kabul',
'Alaskan Standard Time': 'America/Anchorage',
'Arab Standard Time': 'Asia/Riyadh',
'Arabian Standard Time': 'Asia/Dubai',
'Arabic Standard Time': 'Asia/Baghdad',
'Argentina Standard Time': 'America/Buenos_Aires',
@pcdinh
pcdinh / aes.py
Created May 13, 2014 21:51 — forked from gsakkis/aes.py
from binascii import hexlify, unhexlify
from hashlib import md5
from Crypto.Cipher import AES
try:
from M2Crypto import EVP
except ImportError:
EVP = None
def m2_encrypt(plaintext, key, iv, key_as_bytes=False, padding=True):
hashrate: 0.1053
hashrate: 0.1053
hashrate: 0.1053
hashrate: 0.1053
hashrate: 0.1053
hashrate: 0.1053
hashrate: 0.1053
hashrate: 0.0526
hashrate: 0.0526
hashrate: 0.0526

2-of-3 Escrow Example with Electrum

This is gmaxwell's 2-of-2 escrow example, adapted to Electrum and to a lesser extent, GFM.

The Scenario

Archey wants to pay Bertha 0.001 BTC for a Twitter Platinum invite, but prevent Bertha from cheating him. Archey selects Iceland to act as

@pcdinh
pcdinh / fsq-veneue.json
Created November 15, 2013 05:47
Foursquare's venue API
{
"meta":{
"code":200
},
"response":{
"venues":[
{
"id":"4bb9f69598c7ef3bc9813202",
"name":"Starbucks",
"contact":{
#!/usr/bin/env python
"""
Decrypting proxy for Snapchat
Based on mitmproxy + pysnap
https://github.com/mitmproxy/mitmproxy
https://github.com/martinp/pysnap
"""
@pcdinh
pcdinh / nginx.conf
Created October 8, 2013 18:14 — forked from plentz/nginx.conf
#don't send the nginx version number in error pages and Server header
server_tokens off;
# config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
# to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
# config to don't allow the browser to render the page inside an frame or iframe
# and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
# if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri
# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details.
"""UDP/SSL server"""
import sys
import errno
import traceback
from gevent import socket
from gevent import core
from gevent.baseserver import BaseServer
@pcdinh
pcdinh / gist:6611345
Created September 18, 2013 15:59 — forked from tmc/gist:777085
import sys
import gevent
from gevent.monkey import patch_all; patch_all()
from gevent import server, event, socket
from multiprocessing import Process, current_process, cpu_count
"""
Simple multiprocess StreamServer that proxies messages between clients.
Avoids using a multiprocessing.Event since it blocks on a semaphore.
{
"status":{
"message":"ok",
"code":200
},
"data":[
{
"distance":6,
"tags":[
"Deli",