Skip to content

Instantly share code, notes, and snippets.

View daluu's full-sized avatar

David Luu daluu

View GitHub Profile
@developer-guy
developer-guy / main.go
Last active March 14, 2024 17:57
execve syscall in go
package main
import (
_ "embed"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"os/signal"
@citruz
citruz / QEMU_ON_M1.md
Last active May 3, 2025 17:10
Create Ubuntu and Windows VMs with QEMU on Apple Silicon

Running Linux and Windows on M1 with QEMU

30.11.2020: Updated with the new patchseries and instructions for Windows

02.12.2020: Added tweaks

08.12.2020: Updated with patchseries v4

31.01.2020: Updated with patchseries v6

@therightstuff
therightstuff / explanation.js
Last active December 3, 2024 02:01
Convert GUID (UUID) to integer numbers in Javascript (and back again)
// A UUID is a 128-bit number which is too large to be represented as a native integer in Javascript.
// The original solution I posted (based on https://github.com/uuidjs/uuid#uuidparsestr ) wasn't good,
// as it converted the given UUID into a byte array and then selected only the first four bytes to be
// used as the integer.
const uuid = require('uuid');
let convertGuidToInt = (uuid) => {
// parse accountId into Uint8Array[16] variable
let parsedUuid = uuid.parse(uuid);
@Sitin
Sitin / setup.sh
Last active May 29, 2025 14:02
Run x86-64 Docker images on Raspberry Pi 4 (QEMU/QUS)
# Setup QEMU for x86-64 Docker images on Raspberry Pi 4
# Install Python3 and Docker first: https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl
# Install QUEMU (https://www.qemu.org/)
sudo apt-get install qemu binfmt-support qemu-user-static
# Use QUS in Docker (https://github.com/dbhi/qus) to configure x86_64 architecture
docker run --rm --privileged aptman/qus -s -- -p x86_64
# Test x86-64 image:
@vjt
vjt / remote-tcpdump.md
Last active August 1, 2024 09:20
tcpdump on remote host

Running tcpdump on remote hosts with no storage

If you have tcpdump on your embedded home router and you want to see what traffic your crippled phone is doing, you can dump traffic on the router and visualise it on your main workstation using wireshark.

Ensure that you can log on to the remote host without a password, e.g. by using SSH keys.

  1. On the remote host, create a FIFO
@nooriro
nooriro / crosshatch-bootloader-baseband-mcfg-versions.txt
Last active October 20, 2021 00:49
codename initial build_number bootloader_version baseband_version system_size vendor_size product_size system_ext_size build_incremental build_timestamp mcfg_version
crosshatch P PD1A.180720.030 b1c1-0.1-4948814 g845-00023-180815-B-4956438 2952790016 805306368 314572800 0 4972053 1534988697 MCFG-g845-00023-180822-B-4971248
crosshatch P PD1A.180720.031 b1c1-0.1-4948814 g845-00023-180815-B-4956438 2952790016 805306368 314572800 0 5007156 1536792267 MCFG-g845-00023-180822-B-4971248
crosshatch P PQ1A.181105.017.A1 b1c1-0.1-5004167 g845-00023-180917-B-5014671 2952790016 805306368 314572800 0 5081125 1539988603 MCFG-g845-00023-181019-B-5080395
crosshatch P PQ1A.181205.006 b1c1-0.1-5034669 g845-00023-180917-B-5014671 2952790016 805306368 314572800 0 5108886 1541194933 MCFG-g845-00023-181019-B-5080395
crosshatch P PQ1A.181205.006.A1 b1c1-0.1-5034669 g845-00023-180917-B-5014671 2952790016 805306368 314572800 0 5148322 1543258668 MCFG-g845-00023-181019-B-5080395
crosshatch P PQ1A.190105.004 b1c1-0.1-5034669
@System-Glitch
System-Glitch / go-worker.go
Last active May 10, 2024 15:57
A resilient Go worker
package main
// This is an example of a resilient worker program written in Go.
//
// This program will run a worker, wait 5 seconds, and run it again.
// It exits when SIGINT or SIGTERM is received, while ensuring any ongoing work
// is finished before exiting.
//
// Unexpected panics are also handled: program won't crash if the worker panics.
// However, panics in goroutines started by the worker won't be handled and have
@bric3
bric3 / SSLPoke.java
Created February 10, 2020 07:17
The famous SSLPoke from Atlassian : establish a TLS connection but support http proxy and updated to Java 11
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
@topherPedersen
topherPedersen / strip_newline.go
Created February 3, 2020 20:56
How to Strip Newline Characters from a String in Golang
package main
import (
"fmt"
"strings"
)
func main() {
var string_a string = "My super \nsweet \nstring has \nmany newline\n characters"