Skip to content

Instantly share code, notes, and snippets.


Pham Cong Dinh pcdinh

View GitHub Profile

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

View Microsoft Azure VM CPU performance on Ubuntu 13
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
from binascii import hexlify, unhexlify
from hashlib import md5
from Crypto.Cipher import AES
from M2Crypto import EVP
except ImportError:
EVP = None
def m2_encrypt(plaintext, key, iv, key_as_bytes=False, padding=True):
View gist:af5bf840eb912cddff43
# This file is autogenerated by the 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',
View modx-snippets.php
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
View circus.ini
check_delay = 5
endpoint = tcp://
pubsub_endpoint = tcp://
include = *.more.config.ini
debug = true
pcdinh / fs.txt
Last active Aug 29, 2015
FileString file sharing
View fs.txt
POST /2.0/file
"file": {
"id": "<string>",
"location": {
"proto": "file",
"name": "<string>",
"path": "<string>",
"is_dir": false
View relations.sql
WITH owner_to_direct_indirect_recipient AS (
NULL AS SharedDate,
NULL AS SharingDataKey,
NULL AS Perms,
NULL AS ExpiredDate,
NULL AS IsPrinted,
NULL AS HasWatermark,
NULL AS SharingModifiedDate,
CONVERT(NVARCHAR(36), TODATETIMEOFFSET(fs.SharedDate, '+00:00'), 126) AS SharedDate2,
View infinitescroll.js
app.directive('infiniteScroll', [
'$rootScope', '$window', '$timeout', function($rootScope, $window, $timeout) {
return {
link: function(scope, elem, attrs) {
var checkWhenEnabled, handler, scrollDistance, scrollEnabled;
$window = angular.element($window);
elem.css('overflow-y', 'scroll');
elem.css('overflow-x', 'hidden');
elem.css('height', 'inherit');
scrollDistance = 0;
pcdinh / xmr-bitcoin
Last active Aug 29, 2015
View xmr-bitcoin
(1) It uses a different elliptic curve than Bitcoin for signing (EdDSA, which uses Schnorr signatures on a Twisted Edwards curve).
(2) It uses a different hashing algorithm than Bitcoin for PoW, which is AES heavy and currently performs similarly on GPUs
and CPUs. One of the main downsides to this is that sidechains are currently impossible (validation takes too long), however
as sidechains don't actually exist right now we've been ignoring this. If we want to add sidechain support in the future,
the hashing algorithm can be change to something simple. In the meantime, the algorithm is relatively "egalitarian" in that
no specialized hardware is required.
(3) One time use addresses ("stealth addressing") is mandatory for all transactions. This makes light clients very difficult
to secure or create in general, but it dramatically enhances privacy because it's impossible to ever reuse an address.
(4) All transactions are denominated in base 10, and fractionated by mantissa.
(5) Ring signatures obfuscate spe
You can’t perform that action at this time.