Skip to content

Instantly share code, notes, and snippets.

View mckelvin's full-sized avatar

GitHubLeakedPAN, GitHubLeakedMyautsai mckelvin

View GitHub Profile
@pointcom
pointcom / nginx.conf
Created January 15, 2009 17:42
Patch for Nginx 0.6.34 : Added instruction "post_to_static" (HTTP 405 error when serving static file after a POST request)
server {
listen 80;
server_name my.host.com;
location / {
root /path/to/your/root;
post_to_static on; # You allow static file after a POST request
}
}
inoremap ( <c-r>=OpenPair('(')<CR>
inoremap ) <c-r>=ClosePair(')')<CR>
inoremap { <c-r>=OpenPair('{')<CR>
inoremap } <c-r>=ClosePair('}')<CR>
inoremap [ <c-r>=OpenPair('[')<CR>
inoremap ] <c-r>=ClosePair(']')<CR>
" just for xml document, but need not for now.
"inoremap < <c-r>=OpenPair('<')<CR>
"inoremap > <c-r>=ClosePair('>')<CR>
function! OpenPair(char)
@stackia
stackia / anti-dns-spoofing-iptables.sh
Created December 11, 2014 07:17
anti-dns-spoofing-iptables
#!/bin/bash
BADIP="74.125.127.102 74.125.155.102 74.125.39.102 74.125.39.113 209.85.229.138 128.121.126.139 159.106.121.75 169.132.13.103 192.67.198.6 202.106.1.2 202.181.7.85 203.161.230.171 203.98.7.65 207.12.88.98 208.56.31.43 209.145.54.50 209.220.30.174 209.36.73.33 211.94.66.147 213.169.251.35 216.221.188.182 216.234.179.13 243.185.187.39 37.61.54.158 4.36.66.178 46.82.174.68 59.24.3.173 64.33.88.161 64.33.99.47 64.66.163.251 65.104.202.252 65.160.219.113 66.45.252.237 72.14.205.104 72.14.205.99 78.16.49.15 8.7.198.45 93.46.8.89"
for IP in $BADIP
do
hexip=$(printf '%02X ' ${IP//./ }; echo)
#echo $hexip
iptables -I INPUT -p udp --sport 53 -m string --algo bm --hex-string "|$hexip|" --from 60 --to 180 -j DROP
iptables -I FORWARD -p udp --sport 53 -m string --algo bm --hex-string "|$hexip|" --from 60 --to 180 -j DROP
done
@mckelvin
mckelvin / .gitignore
Last active October 4, 2015 01:58
One Day One Phrase since March 30,2012
config.py
*.pyc
*.swp
@zhasm
zhasm / ccc.sh
Last active December 10, 2015 06:28
像脚本语言一样运行 c 程序文件。放在 .bashrc / .bash_profile 环境中。
ccc ()
{
if [[ "$#" -lt 1 ]]; then
echo "Usage: $FUNCNAME <script.c> [optional_args]";
return;
else
file=$1;
shift;
args=$*;
out=`mktemp`;
@jasonberanek
jasonberanek / README.md
Last active January 29, 2018 18:59
Enabling VNC support in the VMware ESXi 5.x Firewall

VMware ESXi includes a built in VNC server that can be used to access a VMs console for manipulation via automated tools (e.g., veewee) or by users on platforms where the vSphere Client is not supported. In ESXi 5.x, the built-in firewall does not allow VNC traffic to be received by the VNC server, even when an individual VM is configured to support this configuration. To complete this activity, the firewall has to be modified to allow the appropriate ports.

The below script can be run via the ESXi command line to setup the firewall rules necessary to run VNC. A few items to note:

  • Scripts assumes the firewall rules file is the default provided as by 5.0.0 update 2 build 914586 and/or 5.1.0 build 799733 (may work in other versions)
  • In order to persist settings after a reboot, it is necessary to copy the firewall settings to either a specific datastore mapped to the host, or the local persistent storage linked under the /store directory. Further, the either the /etc/rc.local (ESXi 5.0) or `/etc/rc.local
@soemarko
soemarko / theme.html
Created November 26, 2011 16:18
embed github gist to tumblr
<!-- Add the following lines to theme's html code right before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script>
<!--
Usage: just add <div class="gist">[gist URL]</div>
Example: <div class="gist">https://gist.github.com/1395926</div>
-->
@kevinzhow
kevinzhow / vpnserver.sh
Last active March 19, 2019 12:59
OnClickVPNServer
#!/usr/bin/env bash
echo 'deb http://shadowsocks.org/debian wheezy main' >> /etc/apt/sources.list
# Pre-requisites
sudo apt-get -y update
sudo apt-get -y install pptpd
sudo apt-get -y install fail2ban
sudo apt-get -y install shadowsocks-libev
anonymous
anonymous / adhoc
Created July 31, 2011 17:38
Linux Ad-hoc shell script
#!/bin/bash
#####################################
#Author: Leon Lee #
#email: lendylongli@gmail.com #
#QQ: 730395591 #
#Version: 1.0 #
#Note: If you have some good ideas #
# or advice, please mail me^^ #
#####################################
@liuyu81
liuyu81 / c_extension_module.c
Created August 26, 2012 02:54
call Python callback from a non-python thread in a C extension module (in response to zed's demo, https://gist.github.com/3471699, and this question http://stackoverflow.com/questions/12116390/python-code-calls-c-library)
#include "Python.h" // should be before any standard headers
#include <errno.h>
#include <pthread.h>
static void*
non_python_thread(void *python_callback) {
//XXX without PyEval_InitThreads() it produces:
// Fatal Python error: PyEval_SaveThread: NULL tstate
//XXX with PyEval_InitThreads() it deadlocks!!
//XXX without PyGILState_*() (with/without PyEval_InitThreads()) it produces: