Skip to content

Instantly share code, notes, and snippets.

@fffonion
fffonion / Readme.md
Last active November 16, 2022 08:57
Simple GeoIP and ASNnum query server http://ip.yooooo.us
  • nginx with ngx_http_geoip_module, echo-nginx-module, lua-nginx-module is required; libgeoip needs to be installed and geoip database should be placed under /usr/share/GeoIP.
  • http://example.com for current GeoIP and http://example.com/ip for current IP only
  • http://example.com/x.x.x.x to query any IP.
  • http://example.com/domain-name for GeoIP of domain-name and http://example.com/domain-name/ip to return IP of domain-name only. If multiple IPs are set to single domain-name, all of them will be returned. Only A record will be used.
  • Sample requests are:
$ curl http://example.com/
x.x.x.x
Country, Region, City
ASN number
@lilongen
lilongen / tcpdump-http-capture
Created April 26, 2016 07:07
tcpdump http data packet capture examples
#dump http response
tcpdump -s 0 -A 'src port 80 and tcp[((tcp[12:1]&0xf0)>>2):4]=0x48545450'
tcpdump -s 0 -A 'src port 80 and tcp[((tcp[12:1]&0xf0)>>2):4]='$(python -c "print '0x' + ''.join(hex(ord(i))[2:] for i in 'HTTP')")
#dump http post request, following two are equal, 0x504f5354 <-> POST
tcpdump -s 0 -A 'dst port 80 and tcp[((tcp[12:1]&0xf0)>>2):4]=0x504f5354'
tcpdump -s 0 -A 'dst port 80 and tcp[((tcp[12:1]&0xf0)>>2):4]='$(python -c "print '0x' + ''.join(hex(ord(i))[2:] for i in 'POST')")
#dump http get request
tcpdump -s 0 -A 'dst port 80 and tcp[((tcp[12:1]&0xf0)>>2):4]='$(python -c "print '0x' + ''.join(hex(ord(i))[2:] for i in 'GET ')")
@borgand
borgand / git-merge-svn
Last active January 7, 2019 06:44
A helper script to set *svn:mergeinfo* property when using `git svn dcommit` on merged git branches.This makes it possible to merge two SVN branches using **git-svn**.NB! the merged-from branch **MUST** be pushed to SVN.USAGE: git merge-svn <branch name>EDIT: added exit condition when mergeinfo calculation fails to avoid pushing incomplete merge…
#!/bin/bash
function usage {
echo "USAGE: git merge-svn <from> [<to>]"
echo ""
echo " from The branch name to be merged FROM"
echo " to Optional branch name to be merged onto. Default: HEAD"
echo ""
}
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@nathansmith
nathansmith / module_pattern_init.js
Created January 11, 2010 17:08
Init + Module Pattern JS
// JS Module Pattern:
// http://j.mp/module-pattern
// Redefine: $, window, document, undefined.
var APP = (function($, window, document, undefined) {
// Automatically calls all functions in APP.init
$(document).ready(function() {
APP.go();
});