Skip to content

Instantly share code, notes, and snippets.

View overtrue's full-sized avatar
🎯
Focusing

安正超 overtrue

🎯
Focusing
View GitHub Profile
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
@overtrue
overtrue / 0_reuse_code.js
Last active September 4, 2016 04:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CSS: source.css
@overtrue
overtrue / surge_main.conf
Created October 27, 2015 07:57 — forked from jason5ng32/surge.conf
Surge Configs ( Both 2 files are needed )
[General]
loglevel = notify
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24,100.64.0.0/10
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24,100.64.0.0/10
// DNS OVERRIDE, REMOVE # IF YOU NEED
# dns-server = 223.6.6.6,223.5.5.5,114.114.114.114,114.114.115.115
[Rule]
@overtrue
overtrue / get_scroll_offset.js
Created June 18, 2018 23:43 — forked from yuktse/get_scroll_offset.js
js 获取页面滚动高度
var scrollTop = window.pageYOffset
|| document.documentElement.scrollTop
|| document.body.scrollTop
|| 0;
var scrollLeft = window.pageXOffset // netscape
|| document.documentElement.scrollLeft
|| document.body.scrollLeft
|| 0;
/*
@overtrue
overtrue / execute.php
Created July 23, 2018 10:34 — forked from fordnox/execute.php
Execute shell command with timeout and converting stderr to Exception if any
<?php
/**
* @param int $timeout - max process execution time in seconds until it is terminated
**/
function execute($cmd, $stdin = null, $timeout = 600)
{
$this->log->debug("executing: " . $cmd . " ". $stdin);
$cmd = str_replace("\n", "", $cmd);
$cmd = str_replace("\r", "", $cmd);
@overtrue
overtrue / init.fish
Last active December 6, 2023 05:24 — forked from alyssaq/config.fish
config.fish set environment variables from bash_profile
# Fish shell
egrep "^export " ~/.bash_profile | while read e
set var (echo $e | sed -E "s/^export ([A-Za-z_]+)=(.*)\$/\1/")
set value (echo $e | sed -E "s/^export ([A-Za-z_]+)=(.*)\$/\2/")
# remove surrounding quotes if existing
set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/")
if test $var = "PATH"