Skip to content

Instantly share code, notes, and snippets.

View ma6174's full-sized avatar
🤣
/

ma6174 ma6174

🤣
/
View GitHub Profile
package main
import (
"fmt"
"reflect"
"syscall"
"unsafe"
)
func a() int {
@kaleksandrov
kaleksandrov / global-protect.sh
Last active November 10, 2025 13:15
Simple script that starts and stops GlobalProtect.app on Mac OSX.
#!/bin/bash
case $# in
0)
echo "Usage: $0 {start|stop}"
exit 1
;;
1)
case $1 in
start)
@booherbg
booherbg / gist:f812c9145d157d8945b2
Last active May 23, 2025 03:08
Cross compiling a simple go server for windows

How to build Golang windows/arm static binaries from linux

Alternate title: Cross compiling Windows/Darwin/Linux amd64/386/arm all from linux

After fumbling around trying to figure out the go toolchain and cross compilation configuration, I ran across the wiki page on Go's homepage. It's super helpful, and worked out of the box. I'm including the necessary scripts here in case they get changed or lost, and we can help Google find it (since it's the first real source I've found that "Just Worked"). http://code.google.com/p/go-wiki/wiki/WindowsCrossCompiling

qboxserver@nb5:~$ curl -v 'http://www.buxuxiao.net/wp-content/uploads/2014/05/5370331b5b8d2215.jpgcover.jpg'
* About to connect() to www.buxuxiao.net port 80 (#0)
* Trying 42.121.43.98... connected
* Connected to www.buxuxiao.net (42.121.43.98) port 80 (#0)
> GET /wp-content/uploads/2014/05/5370331b5b8d2215.jpgcover.jpg HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: www.buxuxiao.net
> Accept: */*
>
< HTTP/1.1 302 Redirct
@axgle
axgle / sync.Pool.md
Last active December 18, 2022 09:56

What is sync.Pool in golang and How to use it

sync.Pool (1/2)

Many Go libraries include custom thread-safe free lists, like this:

var objPool = make(chan *Object, 10)

func obj() *Object {

select {

@takeshixx
takeshixx / hb-test.py
Last active September 8, 2025 01:16
OpenSSL heartbeat PoC with STARTTLS support.
#!/usr/bin/env python2
"""
Author: takeshix <[email protected]>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford ([email protected]).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
@golangfan
golangfan / gist:9323814
Last active August 29, 2015 13:56
Go语言的标准包 image测试说明
测试了8000张图片,30张图片无法识别,会导致以下错误
import (
"image"
_ "image/gif"
_ "image/jpeg"
_ "image/png"
_ "code.google.com/p/go.image/bmp"
_ "code.google.com/p/go.image/tiff"
)
@wen-long
wen-long / ss-redir 透明代理.md
Last active March 18, 2024 12:13
ss-redir 透明代理.md

##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 可用,但端口一致,就设置这个
@chzyer
chzyer / deadlink.sh
Last active December 30, 2016 16:46
检查本地死链接
package main
import (
"fmt"
"os"
)
import (
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"