Skip to content

Instantly share code, notes, and snippets.

View jetsanix's full-sized avatar
💭
💭💭💭

jet tsang zeon-git jetsanix

💭
💭💭💭
View GitHub Profile
@justinas
justinas / 1_singlehost.go
Last active November 29, 2023 11:41
Go middleware samples for my blog post. http://justinas.org/writing-http-middleware-in-go/
package main
import (
"net/http"
)
type SingleHost struct {
handler http.Handler
allowedHost string
}
@millermedeiros
millermedeiros / osx_setup.md
Last active May 1, 2024 20:46
Mac OS X setup

Setup Mac OS X

I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.

I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...

@clowwindy
clowwindy / ssl.md
Last active April 26, 2024 03:04
为什么不应该用 SSL 翻墙

SSL 设计目标:

  1. 防内容篡改
  2. 防冒充服务器身份
  3. 加密通信内容

而翻墙的目标:

  1. 不被检测出客户端在访问什么网站
  2. 不被检测出服务器在提供翻墙服务
#!/bin/bash
if [[ "$#" < "2" || "$#" > "3" ]]; then
cat <<END
Glusterfs GFID resolver -- turns a GFID into a real file path
Usage: $0 <brick-path> <gfid> [-q]
<brick-path> : the path to your glusterfs brick (required)
@louiszuckerman
louiszuckerman / gfid-resolver.sh
Last active November 29, 2023 10:01
Glusterfs GFID Resolver Turns a GFID into a real path in the brick
#!/bin/bash
if [[ "$#" < "2" || "$#" > "3" ]]; then
cat <<END
Glusterfs GFID resolver -- turns a GFID into a real file path
Usage: $0 <brick-path> <gfid> [-q]
<brick-path> : the path to your glusterfs brick (required)
@ikbear
ikbear / NetScreen.md
Created December 5, 2012 17:17
NetScreen的往事

下面是陈首席陈临怀发表在微博上的 [NetScreen的往事],我在看的过程中将其拷贝出来,整理成文,方便想看的人一口气看完。微博见:http://weibo.com/huailinchen

[NetScreen的往事]下午要在厦门见邓锋。突然又想起了许多NetScreen的往事。我是一个能写代码的文艺青年。决定在weibo上,来写写过去,算作为逐渐老去的我们的一点纪念。。。

[NetScreen的往事(1)]2001年的9月11日的早晨。我大概7点左右被人叫醒。纽约遭遇攻击!“。在电视上我看着第2架飞机冲入Tower Building,恍惚做梦一般。。。 上午去公司。。。大家都很担心。知道NetScreen的创办人Feng和Yan也在纽约,处理公司上市的事情。大家都很担心他们。我们是兄弟。

[NetScreen的往事(2)]应该是中午的时候传来消息。他们已经跑到亚特兰大去了。在等待转机。。。大家都在等着他们的回来。记得是晚上7点左右,夏天的加州,依然天很亮。我和Shalang(现Juniper Beijing Director)在楼下抽烟。看见Feng和Yan下车了。。。我是个很感情化的人,冲上去拥抱了Feng。

[NetScreen的往事(3)]Yan是个比较严肃的人,而我的工作基本上是他和Yuming[Palo Alto创办人,今年上市,发大了]直接领导。他经常修理我。有点怕他。不敢和他拥抱。Feng很随和,喜欢开玩笑[含黄色段子]。大家都喜欢他。。。

$.fn.vectorMap('addMap', 'cn_merc_en',{"insets": [{"width": 560, "top": 0, "height": 470, "bbox": [{"y": -7092705.234177706, "x": 8197509.958779432}, {"y": -2058430.530198134, "x": 15010424.448806616}], "left": 0}],
"paths": {
aomen:{
name : "澳门特区",
path: "M413.032,414.183l-0.96,1.752c0,0,0.889,0.883,1.98,1.086s1.995-0.493,1.995-0.493L413.032,414.183z"},
hongkong:{
name : "香港特区",
path: "M417.745,409.005l3.394,0.773l3.453-2.558l1.666,4.582c0,0-5.521,2.673-3.691,1.785c1.828-0.884-4.641-0.355-4.641-0.355l-0.834-3.454L417.745,409.005z"},
taiwan:{
name : "台湾省",
@border
border / mgoExample.go
Created August 27, 2012 15:33
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@b123400
b123400 / three.php
Created August 13, 2012 21:00
3HK data usage getter
<?php
//There is no public API therefore this is not so reliable, use it at your own risk
function search_string($string , $regex , $index=1){
$pattern = "~".$regex."~";
preg_match($pattern, $string, $matches);
//var_dump($matches);
return $matches[$index];
}
function getDataUsageFromThreeAccount($mobileNo,$password){
$loginURL="http://www.three.com.hk/appCS2/verifyLogin.do?lang=eng";