Skip to content

Instantly share code, notes, and snippets.

View pcdinh's full-sized avatar

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

@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):
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
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;
À A
Á A
 A
à A
Ä A
Å A
Æ A
à a
á a
â a
.scrolling-element-class * {
-webkit-transform: translate3d(0,0,0);
}
@pcdinh
pcdinh / utils.js
Created December 9, 2009 09:34 — forked from bavardage/utils.js
function randomColor() {
var color = (0xffffff * Math.random()).toString(16);
return "#" + color.replace(/\./i,"").slice(0,6);
};
function fallbackFor(arg, fallback) {
return (typeof arg !== 'undefined') ? arg : fallback;
}
function require(arg, name) {
CFLAGS="-arch x86_64" \
./configure \
--with-apxs2=/usr/sbin/apxs --prefix=/usr/local/php5.2.8 --with-config-file-scan-dir=/usr/local/php5.2.8/php.d \
--with-config-file-path=/usr/local/php5.2.8/php.d \
--disable-posix \
--enable-cli \
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-jpeg-dir=/opt/local/include --with-png-dir=/opt/local/include --enable-gd-native-ttf --with-freetype-dir=/usr/local/php5.2.8 \
--with-zlib \
--enable-pdo --with-pdo-sqlite --with-sqlite=shared --enable-sqlite-utf8 \
# php 5.3 snow leopard
# need 64 bit mysql as /usr/local/mysql
# compile apache
./configure --enable-layout=Darwin --enable-mods-shared=all
make
sudo make install
# now configure php. then make; sudo make install
#!/usr/bin/env php
<?php
if( ! function_exists( 'inotify_init' ) ) {
die_with_error( 'This script needs the inotify module' );
}
// usage: $0 path [path ...] -- command
$args = $_SERVER['argv'];