Skip to content

Instantly share code, notes, and snippets.

View itxx00's full-sized avatar
✈️
keep working

itxx00 itxx00

✈️
keep working
View GitHub Profile
@itxx00
itxx00 / gist:de5178e2566e270c4567daff62094582
Created June 24, 2016 03:14
network interface interrupts customize
# https://www.qcloud.com/doc/product/215/2238
3. 配置优化
公网网关主机会默认配置iptables的nat规则,以及打开kernel的ip_forward,基本的公网网关功能已经完全具备。建议经过下述配置,以达到更好的性能。
1) 通过以下命令将net.ipv4.ip_forward配置写到/etc/sysctl.conf文件中
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
2) 通过以下命令将nf_conntrack配置参数调大
@itxx00
itxx00 / qcloud_api.sh
Last active June 22, 2016 06:54
qcloud_api.sh
# Before you can use the tool,
# you need to install following software.
# curl openssl gawk
if [ "$mode_qcloud_api" ];then
return
fi
export mode_qcloud_api=1
function urlencode(){
@itxx00
itxx00 / autoban.sh
Last active February 5, 2016 03:37
A simple script to protect system from DOS attack
#!/bin/bash
# A simple script to protect system from DOS attack
# create a crontab conf file /etc/cron.d/autoban like this:
# * * * * * root /sbin/autoban.sh ban >/dev/null 2>&1 &
# */10 * * * * root /sbin/autoban.sh unban - 5 >/dev/null 2>&1 &
# 01 * * * * root /sbin/autoban.sh unban 6 20 >/dev/null 2>&1 &
# 01 09 * * * root /sbin/autoban.sh unban 21 - >/dev/null 2>&1 &
#
PATH=/bin:/usr/bin:/usr/sbin:/sbin
export PATH
@itxx00
itxx00 / gist:7565843
Created November 20, 2013 16:11
check_httpd_limits
#!/usr/bin/perl
# Copyright 2012 - Jean-Sebastien Morisset - http://surniaulula.com/
#
# This script is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# This script is distributed in the hope that it will be useful, but WITHOUT
@itxx00
itxx00 / show_bar
Created October 19, 2013 04:54
progress bar in bash
function show_bar() {
local i=0;local p=1;local c=">"
echo;echo
while true;do
local x=$(($(tput cols)-3));local y=$(($(tput lines)-2));i=$((i+1))
[ $(($i%$x)) -eq 0 ] && {
[ "$c" = ">" ] && c="<" || c=">"
}
[ "$c" = ">" ] && {
p=$((p+1));[ "$p" -ge $x ] && p=$x
@itxx00
itxx00 / flashpolicyd.py
Created October 14, 2013 15:09
flashpolicyd.py
#!/usr/bin/env python
# Flash access policy server based on gevent
# Jan-Philip Gehrcke, June 2011
# Listen on port 843; send acess policy to client; disconnect.
from gevent.server import StreamServer
import datetime
@itxx00
itxx00 / README.md
Created October 13, 2013 09:08 — forked from jpetazzo/README.md

Unionize: network superpowers for your docker containers

Unionize lets you connect together docker containers in arbitrarily complex scenarios.

Note: I recommend to use https://github.com/jpetazzo/pipework instead.

  • pipework is a better name than unionize
  • it's hosted on a "real" github repo instead of a small gist :-)

Now if you want Unionize, it's still here. Just check those examples.

@itxx00
itxx00 / core-emu
Last active December 25, 2015 02:19
http://stackoverflow.com/questions/12671587/isolated-test-network-on-a-linux-server-running-a-web-server-lightttpd-and-cu
https://code.google.com/p/coreemu/
http://stuff.onse.fi/man?program=ip-netns&section=8
http://blog.kghost.info/2013/03/01/linux-network-emulator/
http://blog.kghost.info/2013/03/27/linux-network-tun/
http://seravo.fi/2012/virtualized-bridged-networking-with-macvtap
http://blog.csdn.net/kl222/article/details/8513593
set nocompatible "关闭vi兼容
set enc=utf-8
"set number "显示行号
filetype plugin on "文件类型
set history=500 "历史命令
syntax on "语法高亮
"set autoindent "ai 自动缩进
"set smartindent "智能缩进
set showmatch "括号匹配
set ruler "右下角显示光标状态行
#!/bin/bash
# send named metrics to falcon-agent
RNDC_BIN=/usr/sbin/rndc
STATS='/var/named/data/named_stats.txt'
rm -f $STATS
if ! $RNDC_BIN stats; then
exit 1