Skip to content

Instantly share code, notes, and snippets.

View defp's full-sized avatar

lidashuang defp

View GitHub Profile
@defp
defp / nginx.conf
Last active December 31, 2015 03:28 — forked from thewebfellas/nginx.conf
user nobody;
worker_processes 5;
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
@defp
defp / nginx.conf
Last active December 31, 2015 03:29
rails nginx this conf
upstream todo {
server 127.0.0.1:4000;
}
server {
listen 80 default;
server_name todo;
root /todo/public;
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
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`:
curl -XDELETE 'localhost:9200/test'
curl -XPUT 'localhost:9200/test/doc/1' -d '
{
"sentence" : "Hi!",
"value" : 1
}
'
#!/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"
#
# config/application.rb
#
require 'active_record/connection_adapters/mysql2_adapter'
module App
class Application < Rails::Application
ActiveRecord::ConnectionAdapters::Mysql2Adapter.emulate_booleans = false
end
end
@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
@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

##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 可用,但端口一致,就设置这个