Skip to content

Instantly share code, notes, and snippets.

=== install pptpd ===

$ yum install -y ppp libpcap
$ wget "https://lnmpp.googlecode.com/files/pptpd-1.3.4-2.el6.x86_64.rpm"
$ rpm -ivh ptpd-1.3.4-2.el6.x86_64.rpm

=== vim /etc/sysctl.conf ===

net.ipv4.ip_forward = 1

@bitkevin
bitkevin / sublime.json
Created August 18, 2013 15:57
configration of sublime.json
{
// Columns in which to display vertical rulers
//列显示垂直标尺,在中括号里填入数字,宽度按字符计算
"rulers": [80],
// Set to true to insert spaces when tab is pressed
// 设为true时,缩进和遇到Tab键时使用空格替代
"translate_tabs_to_spaces": true,
// The number of spaces a tab is considered equal to
#! /bin/bash
# test
echo -e "\033[31m[FAIL]\033[0m hello world"
# \033[0m 关闭所有属性
# \033[1m 设置高亮度
# \033[4m 下划线
# \033[5m 闪烁
# \033[7m 反显
#check for root user TODO: replace this with a call to "id"
if [ `whoami` != "root" ] ; then
echo "You must run this script as root. Sorry!"
exit 1
fi
#! /bin/bash
#
# @see <http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in>
#
DIR=$(cd $(dirname "$0"); pwd)
echo $DIR
package main
import (
"flag"
"fmt"
"io"
"log"
"net"
"os"
"time"
@bitkevin
bitkevin / log2.c
Last active December 20, 2015 03:08
// ---------------------------------------------------------------------
// 来自lua源码,移植性好
int luaO_log2 (unsigned int x) {
static const lu_byte log_2[256] = {
0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <sys/resource.h>
/* Saved resource information for the beginning of an operation */
static struct rusage sBegin;
/*
** Begin timing an operation
//---------------------------------------------------------------------
// 暴雪MPQ hash函数
//---------------------------------------------------------------------
/* 使用前要先调用函数prepareCryptTable()初始化编码表。 */
DWORD cryptTable[0x500]; /* 编码表 */
void prepareCryptTable() {
DWORD seed = 0x00100001, index1 = 0, index2 = 0, i;
for( index1 = 0; index1<0x100; index1++ ) {
<?php
ini_set('memory_limit', '256M');
function bet_lucky_number($server_seed_str, $client_seed_str, $client_nonce) {
$str = $server_seed_str . $client_seed_str . '-' . $client_nonce;
// $h = hash('SHA256', hash('SHA256', $str));
$h = hash('SHA512', hash('SHA512', $str));
// $h = hash('SHA512', $str);
// $h = hash('SHA256', $str);
// $h = 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';