Skip to content

Instantly share code, notes, and snippets.

View gaukas's full-sized avatar
🫖
I’m NOT a teapot

Gaukas Wang gaukas

🫖
I’m NOT a teapot
View GitHub Profile
@yurrriq
yurrriq / ipconfig.sh
Last active June 3, 2024 22:22
Get Public IP Address in Terminal
#!/bin/bash
# Slow
curl -s ifconfig.me | xargs echo -n
# Faster
curl -s icanhazip.com | xargs echo -n
# API: http://api.ident.me
@d0zingcat
d0zingcat / installChaCha20.sh
Created May 9, 2016 05:02
Install ChaCha20 Encryption for Shadowsocks On CentOS
yum install m2crypto gcc -y
wget -N --no-check-certificate https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
tar zfvx libsodium-*.tar.gz
cd libsodium-*
./configure
make && make install
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
@elico
elico / client.go
Created July 26, 2016 00:21
golang tcp client connection alive check
package main
import (
"fmt"
"io"
"net"
"time"
)
func main() {
@arsham
arsham / go_cpu_memory_profiling_benchmarks.sh
Last active June 26, 2024 13:32
Go cpu and memory profiling benchmarks. #golang #benchmark
go test -run=. -bench=. -benchtime=5s -count 5 -benchmem -cpuprofile=cpu.out -memprofile=mem.out -trace=trace.out ./package | tee bench.txt
go tool pprof -http :8080 cpu.out
go tool pprof -http :8081 mem.out
go tool trace trace.out
go tool pprof $FILENAME.test cpu.out
# (pprof) list <func name>
# go get -u golang.org/x/perf/cmd/benchstat
benchstat bench.txt
@joyrexus
joyrexus / README.md
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@er1chu
er1chu / gist:d27d89e3f9e27a157b69fd716b8b8aba
Last active October 31, 2021 06:14
china friendly jquery cdn snippet
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<!-- If jQuery object returns an error (e.g. blocked in Google CDN blocked in China) fallback to this CDN -->
<script> window.jQuery || document.write('<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"><\/script>');</script>
@MarkBaggett
MarkBaggett / scapy_helper.py
Last active March 25, 2024 21:59
Python - SCAPY - Full Packet Session Reassembly
#From here https://pen-testing.sans.org/blog/2017/10/13/scapy-full-duplex-stream-reassembly
def full_duplex(p):
sess = "Other"
if 'Ether' in p:
if 'IP' in p:
if 'TCP' in p:
sess = str(sorted(["TCP", p[IP].src, p[TCP].sport, p[IP].dst, p[TCP].dport],key=str))
elif 'UDP' in p:
sess = str(sorted(["UDP", p[IP].src, p[UDP].sport, p[IP].dst, p[UDP].dport] ,key=str))
@ankanch
ankanch / getlocalIP.go
Created October 25, 2017 13:13
[Golang] Get Public IP address via Public IP API
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.ipify.org?format=text" // we are using a pulib IP API, we're using ipify here, below are some others
// https://www.ipify.org
// http://myexternalip.com
@xavierfoucrier
xavierfoucrier / gpg-signing.md
Last active June 21, 2024 13:14
GPG signing with Git and Github Desktop

GPG signing – git github-desktop

Here is a short guide that will help you setup your environment to create signed commits or signed tags with Git locally. This has been extensively tested on Windows with Git and the Github Desktop application: I use it every day for my professional development projects.

I you face any issue, feel free to leave a comment below.

Summary

  1. Sign commits or tags
  2. Key passphrase
  3. Disable signatures
  4. Renew a GPG key
@mpalpha
mpalpha / default.pa
Last active January 8, 2021 19:28
Atomic Pi HDMI working audio Pulse Audio Configuration file /etc/pulse/default.pa from https://www.reddit.com/r/Atomic_Pi/wiki/index#wiki_fix_for_hdmi_audio
#!/usr/bin/pulseaudio -nF
#
# check if you are missing pavucontrol. run "which pavucontrol"
# If so, install it and Download a working Atomic Pi HDMI audio configuration file.
# run "sudo apt install -y pavucontrol && sudo curl -o /etc/pulse/default.pa -L https://gist.githubusercontent.com/mpalpha/5e0d87f514bca0f87769864655300c99/raw"
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by