Skip to content

Instantly share code, notes, and snippets.

@xbee
xbee / BlockPropagation.md
Created March 6, 2016 13:19 — forked from gavinandresen/BlockPropagation.md
O(1) block propagation

O(1) Block Propagation

The problem

Bitcoin miners want their newly-found blocks to propagate across the network as quickly as possible, because every millisecond of delay increases the chances that another block, found at about the same time, wins the "block race."

@xbee
xbee / build.gradle
Last active August 30, 2015 05:46 — forked from MarkMjw/build.gradle
build.gradle base on Android Studio, and modify manifest when building different channel.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
apply plugin: 'android'
@xbee
xbee / android_replace_in_manifest.gradle
Last active August 30, 2015 04:09 — forked from saadfarooq/android_replace_in_manifest.gradle
Gradle function to replace a placeholder string in AndroidManifest.xml with productFlavor package name
replaceInManifest = {variant, fromString, toString ->
def flavor = variant.productFlavors.get(0)
def buildtype = variant.buildType
def manifestFile = "$buildDir/manifests/${flavor.name}/${buildtype.name}/AndroidManifest.xml"
def updatedContent = new File(manifestFile).getText('UTF-8').replaceAll(fromString, toString)
new File(manifestFile).write(updatedContent, 'UTF-8')
}
@xbee
xbee / gbk_to_utf8_transcoder.py
Last active August 29, 2015 14:27
A small Python script that converts a file encoded in Code Page 936 (aka GBK) to UTF-8.
#! /usr/bin/env python3.4
# Code Page 936 (GBK) to UTF-8 Transcoder
# Author: Kristian Tang (@Krisiouz)
# A small script that converts a file encoded in Code Page 936 (GBK) to UTF-8.
def gbk_to_utf8(input_file, output_file):
# Load Files
input_file_opened = open(input_file, 'r', encoding='cp936')
input_file_read = input_file_opened.read()