Skip to content

Instantly share code, notes, and snippets.

View kanguki's full-sized avatar
😘
love ya

Mo Nguyen kanguki

😘
love ya
View GitHub Profile
@kanguki
kanguki / go_cpu_memory_profiling_benchmarks.sh
Created June 23, 2022 02:48 — forked from arsham/go_cpu_memory_profiling_benchmarks.sh
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
@kanguki
kanguki / nc_tar_pipe.sh
Created March 3, 2022 02:51 — forked from dwallraff/nc_tar_pipe.sh
Netcat Tar Pipe
## -z is optional. Traffic sent will be less, but CPU overhead will be higher.
# On the receiving end do:
nc -vl 12345 | tar xzv
# And on the sending end do:
tar czvf - * | nc -v <remote_host> 12345
@kanguki
kanguki / limitmem.sh
Created December 26, 2021 12:59 — forked from vgallet/limitmem.sh
#!/bin/sh
# strict mode: error if commands fail or if unset variables are used
set -eu
if [ "$#" -lt 2 ]
then
echo Usage: `basename $0` "<limit> <command>..."
echo or: `basename $0` "<memlimit> -s <swaplimit> <command>..."
exit 1
@kanguki
kanguki / 20211210-TLP-WHITE_LOG4J.md
Created December 19, 2021 04:54 — forked from SwitHak/20211210-TLP-WHITE_LOG4J.md
BlueTeam CheatSheet * Log4Shell* | Last updated: 2021-12-18 0018 UTC

Security Advisories / Bulletins / vendors Responses linked to Log4Shell (CVE-2021-44228)

Errors, typos, something to say ?

  • If you want to add a link, comment or send it to me
  • Feel free to report any mistake directly below in the comment or in DM on Twitter @SwitHak

Other great resources

  • Royce Williams list sorted by vendors responses Royce List
  • Very detailed list NCSC-NL
  • The list maintained by U.S. Cybersecurity and Infrastructure Security Agency: CISA List
@kanguki
kanguki / node_nginx_ssl.md
Created December 4, 2021 02:32 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@kanguki
kanguki / client.go
Created October 15, 2021 00:54 — forked from jordanorelli/client.go
rpc server example in go
package main
import (
"bufio"
"log"
"net/rpc"
"os"
)
func main() {