Skip to content

Instantly share code, notes, and snippets.

View GZShi's full-sized avatar
🎯
Focusing

Guozhong Shi GZShi

🎯
Focusing
View GitHub Profile
# 本版� hosts 发布地址�
# https://docs.google.com/View?id=dfkdmxnt_61d9ck9ffq
# https://ipv6-hosts.googlecode.com/hg/hosts
# Google Code 项目页:
# http://code.google.com/p/ipv6-hosts/
##Google.com Google.com
2404:6800:8005::64 google.com
2404:6800:8005::54 accounts.google.com #accounts.l.google.com
2404:6800:8005::5e accounts.google.com.hk #accounts-cctld.l.google.com
@GZShi
GZShi / hosts.bat
Created October 9, 2012 13:04
a simple bat file for switch hosts to ipv4 or ipv6
cd %windir%\system32\drivers\etc
if exist hosts (rename hosts hosts.ipv4) else rename hosts.ipv4 hosts
if exist hosts (echo now:hosts) else echo now:hosts.ipv4
ipconfig /flushdns
pause
@GZShi
GZShi / find_nst_num.c
Created November 21, 2012 06:31
将一堆整数按顺序排成一串形成一个序列,例如从0到20排成一串可以得到下面这个序列: 01234567891011121314151617181920 这个序列中的每一个位置都对应一个0~9的数,例如,第16位是2。假如这堆整足够大,那么序列中第100000个数时什么?
#include <stdio.h>
#include <Windows.h>
// 计算10的整次幂
long mypower(unsigned int e)
{
long ret[10] = {
1,
10,
100,
@GZShi
GZShi / gist:5472056
Created April 27, 2013 06:03
a letter
#include <stdio.h>
char content[] = {
214, 247, 210, 170, 190, 205, 202, 199, 207, 235,
202, 212, 202, 212, 184, 248, 212, 219, 195, 199,
188, 196, 208, 197, 202, 177, 181, 216, 214, 183,
191, 201, 210, 212, 208, 180, 181, 195, 182, 224,
188, 242, 194, 212, 161, 173, 161, 173, 0
};
@GZShi
GZShi / BarCode.js
Last active December 16, 2015 19:39
// 左边的规则
function leftCode(number, o) {
if(o == '1')
return [
'0001101', '0011001', '0010011', '0111101', '0100011',
'0110001', '0101111', '0111011', '0110111', '0001011'][parseInt(number)%10];
else {
return [
'0100111', '0110011', '0011011', '0100001', '0011101',
'0111001', '0000101', '0010001', '0001001', '0010111'][parseInt(number)%10];
@GZShi
GZShi / gist:6045133
Last active December 20, 2015 00:58
二分搜索,正确性未知……
typedef int type;
int my_binary_search(type *array, int begin, int end, type key) {
int mid = 0;
if(array == NULL || begin > end || begin < 0)
return -1;
else
mid = begin + ((end - begin) >> 2);
if(array[mid] == key)
@GZShi
GZShi / binary_sqrt.c
Created July 22, 2013 03:00
二分搜索开平方
#include <stdio.h>
#include <math.h>
double m_abs(double num)
{
return (num < 0 ? -num : num);
}
double bsqrt(double begin, double end, double value, double precision)
{
@GZShi
GZShi / chrome_arc.html
Created August 7, 2013 09:36
Chrome context.arc bug
<html>
<head>
<title>chrome arc bug</title>
</head>
<body>
<canvas id="c" width="3000" height="3000"></canvas>
<script type="text/javascript">
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
@GZShi
GZShi / chrome_arc.html
Created August 7, 2013 14:01
Chrome arc函数采用贝塞尔曲线拟合圆
<html>
<head>
<title>chrome arc</title>
<meta charset='utf-8'>
</head>
<body>
<canvas id='c' width='2000' height='1500'></canvas>
@GZShi
GZShi / bezier.js
Last active December 20, 2015 19:19
绘制贝塞尔曲线
(function(){
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
var mouse = {
x: 0,
y: 0,
fx: 0,
fy: 0,
left: false,