Skip to content

Instantly share code, notes, and snippets.

View dplord's full-sized avatar

Deng Pan dplord

View GitHub Profile
#论坛
127.0.0.1 www.hupu.com
127.0.0.1 bbs.hupu.com
#social社交
127.0.0.1 www.qzone.qq.com
127.0.0.1 qzone.qq.com
127.0.0.1 wx.qq.com
127.0.0.1 weibo.com
function find_git_branch {
local dir=. head
until [ "$dir" -ef / ]; do
if [ -f "$dir/.git/HEAD" ]; then
head=$(< "$dir/.git/HEAD")
if [[ $head == ref:\ refs/heads/* ]]; then
git_branch=" ${head#*/*/}"
elif [[ $head != '' ]]; then
git_branch=' (detached)'
else
var Base64 = (function(obj) {
// private property
_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
// public method for encoding
obj.encode = function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
@dplord
dplord / tenMillionFile.rs
Created April 23, 2015 07:47
tenMillionFile.rs
use std::rand;
use std::rand::Rng;
use std::old_io::BufferedReader;
use std::old_io::File;
fn write_file(path: &str, s: &str)
{
use std::old_io::{BufferedWriter, File};
@dplord
dplord / oneMillionPrime.c
Last active August 29, 2015 14:19
oneMillionPrime.c
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#define MAX 1000000000
int main()
{