Skip to content

Instantly share code, notes, and snippets.

View wangyufeng0615's full-sized avatar

Alan Wang wangyufeng0615

View GitHub Profile
@ptigas
ptigas / gist:2820165
Created May 28, 2012 17:21
linked list implementation in python
class Node :
def __init__( self, data ) :
self.data = data
self.next = None
self.prev = None
class LinkedList :
def __init__( self ) :
self.head = None
@ebridges
ebridges / edit-commits
Created February 11, 2013 19:14
git edit commit author
$ git rebase f034498fbcf4e728d022e1511d630191f2f5ee67^ --interactive
# mark each commit that needs updating with "edit" or "e"
Then, for each commit:
$ git commit --amend --reuse-message=HEAD --author="Edward Bridges <ebridges@squarespace.com>"
$ git rebase --continue
@jiananlu
jiananlu / gist:9258032
Last active May 11, 2023 00:14
upgrade openwrt kernel and reinstall all packages manual

upgrade the system

Make sure you can ssh to the router by root and type in the command:

cd /tmp
wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-mw4530r-v1-squashfs-sysupgrade.bin
sysupgrade -v openwrt-ar71xx-generic-mw4530r-v1-squashfs-sysupgrade.bin
@hwdsl2
hwdsl2 / README.md
Last active May 22, 2020 07:50
List of malware collected in my Kippo SSH Honeypot
@snakevil
snakevil / howto-setup-transparent-proxied-router.md
Last active April 1, 2024 01:28
如何在路由器中实现透明代理?

如何在路由器中实现透明代理?

0 互联网现状

目前整个互联网环境,被破坏最严重地部分,是 Web 服务体验。当直接破坏难以实现时,就会从流程链的上下游着手,如:DNS 污染。

其它地互联网服务类型,例如:邮件,可能小部分会受到 Web 服务上下游破坏地余震,但整体上基本不受影响。

@ammario
ammario / ipint.go
Last active May 25, 2024 21:43
Golang IP <-> int conversion
func ip2int(ip net.IP) uint32 {
if len(ip) == 16 {
return binary.BigEndian.Uint32(ip[12:16])
}
return binary.BigEndian.Uint32(ip)
}
func int2ip(nn uint32) net.IP {
ip := make(net.IP, 4)
binary.BigEndian.PutUint32(ip, nn)
@jhoblitt
jhoblitt / memory.groovy
Created January 11, 2017 16:13
Jenkins console groovy script to report jvm memory usage
int mb = 1024*1024
Runtime runtime = Runtime.getRuntime()
out.println runtime.freeMemory() / mb
out.println runtime.totalMemory() / mb
out.println runtime.maxMemory() / mb
@mustafaturan
mustafaturan / chunk.go
Created February 5, 2019 07:00
Go / Chunk Slice
# https://play.golang.org/p/JxqibtHkuO-
func chunkBy(items []string, chunkSize int) (chunks [][]string) {
for chunkSize < len(items) {
items, chunks = items[chunkSize:], append(chunks, items[0:chunkSize:chunkSize])
}
return append(chunks, items)
}