Skip to content

Instantly share code, notes, and snippets.

View defp's full-sized avatar

lidashuang defp

View GitHub Profile
@defp
defp / Makefile
Created September 12, 2017 09:10 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
// define supported target platform macro which CC uses.
#define CC_PLATFORM_UNKNOWN 0
#define CC_PLATFORM_IOS 1
#define CC_PLATFORM_ANDROID 2
#define CC_PLATFORM_WIN32 3
#define CC_PLATFORM_MARMALADE 4
#define CC_PLATFORM_LINUX 5
#define CC_PLATFORM_BADA 6
#define CC_PLATFORM_QNX 7

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
@defp
defp / gittp.go
Last active August 29, 2015 14:08 — forked from shanzi/gittp.go
/*
gittip: a basic git http server.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright 2014 Chase Zhang <yun.er.run@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
@defp
defp / gist:e34ebae338b17ea4edb5
Last active August 29, 2015 14:07 — forked from Digi-Cazter/gist:3352312
emulate_booleans
#
# config/application.rb
#
require 'active_record/connection_adapters/mysql2_adapter'
module App
class Application < Rails::Application
ActiveRecord::ConnectionAdapters::Mysql2Adapter.emulate_booleans = false
end
end
#
# config/application.rb
#
require 'active_record/connection_adapters/mysql2_adapter'
module App
class Application < Rails::Application
ActiveRecord::ConnectionAdapters::Mysql2Adapter.emulate_booleans = false
end
end
#!/bin/sh
#
# Script to prepare and restore full and incremental backups created with innobackupex-runner.
#
# This script is provided as-is; no liability can be accepted for use.
#
INNOBACKUPEX=innobackupex-1.5.1
INNOBACKUPEXFULL=/usr/bin/$INNOBACKUPEX
TMPFILE="/tmp/innobackupex-restore.$$.tmp"
curl -XDELETE 'localhost:9200/test'
curl -XPUT 'localhost:9200/test/doc/1' -d '
{
"sentence" : "Hi!",
"value" : 1
}
'
create two directory: `/config/mmseg`, `/plugins/analysis-mmseg`
1. got to [`https://github.com/medcl/elasticsearch-rtf/tree/master/config/mmseg`](https://github.com/medcl/elasticsearch-rtf/tree/master/config/mmseg)`, download the files:
chars.dic, units.dic, words-my.dic,words.dic, mv them to `/config/mmseg`
2. go to [`https://github.com/medcl/elasticsearch-rtf/tree/master/plugins/analysis-mmseg`](https://github.com/medcl/elasticsearch-rtf/tree/master/plugins/analysis-mmseg), download the jar:
elasticsearch-analysis-mmseg-1.2.2.jar, mv them to `/plugins/analysis-mmseg`
3. add the following configuration to `elasticsearch.yml`:
defmodule Hygiene do
defmacro interference do
quote do: var!(a) + var!(b) + var!(c)
end
end
defmodule HygieneTest do
def go do
require Hygiene
a = 10