Skip to content

Instantly share code, notes, and snippets.

View fengmk2's full-sized avatar
:atom:
Coding at antgroup.com

fengmk2 fengmk2

:atom:
Coding at antgroup.com
View GitHub Profile
@atimb
atimb / agent.js
Last active May 16, 2023 12:20
Real keep-alive HTTP agent for node.js
/**
* Real keep-alive HTTP agent
*
* ------------=================----------------
* UPDATE: There are more proper implementations for this problem, distributed as
* npm modules like this one: https://github.com/TBEDP/agentkeepalive
* ------------=================----------------
*
* The http module's agent implementation only keeps the underlying TCP
* connection alive, if there are pending requests towards that endpoint in the agent
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

From db8adac19321504530e6794771ae534a238c1648 Mon Sep 17 00:00:00 2001
From: Bert Belder <bertbelder@gmail.com>
Date: Fri, 30 Dec 2011 14:36:31 +0100
Subject: [PATCH 1/1] Partial support for hash randomization
- Doesn't play nice with snapshots
- Breaks ARM and MIPS
---
deps/v8/src/flag-definitions.h | 3 +++
deps/v8/src/ia32/code-stubs-ia32.cc | 18 ++++++++++++++----
@artero
artero / launch_sublime_from_terminal.markdown
Last active January 25, 2024 16:57 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@utaal
utaal / Makefile
Created September 5, 2011 16:42
webserver using libuv
webserver: webserver.c libuv/uv.a http-parser/http_parser.o
gcc -I libuv/include \
-lrt -lm -lpthread -o \
webserver webserver.c \
libuv/uv.a http-parser/http_parser.o
libuv/uv.a:
$(MAKE) -C libuv
http-parser/http_parser.o:
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@lidaobing
lidaobing / auto_route.py
Created September 26, 2010 03:07 — forked from KidFeng/gist:584331
automatic route config
#!/usr/bin/env python
# Usage:
# This script will generate two files(vpnup and vpndown) after executing.
# Do chmod a+x on the two newly created files, and then move them to the
# openvpn config folder. then add the following two lines to the vpn config file:
# up vpnup
# down vpndown
# you might also need 'redirect-gateway' in the config file, if you don't use vpn
# as the default gateway.
@nesquena
nesquena / .bash_profile
Created May 31, 2009 07:17
simple git branch ps1 with colored dirty state
# COLORS
LIGHT_GRAY="\[\033[0;37m\]"; BLUE="\[\033[1;36m\]"; RED="\[\033[0;31m\]"; LIGHT_RED="\[\033[1;31m\]";
GREEN="\[\033[0;32m\]"; WHITE="\[\033[1;37m\]"; LIGHT_GRAY="\[\033[0;37m\]"; YELLOW="\[\033[1;33m\]";
# GIT PROMPT (http://gist.github.com/120804)
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \(\1\)/';
}
function parse_git_status {
git status 2> /dev/null | sed -e '/(working directory clean)$/!d' | wc -l;
}