Skip to content

Instantly share code, notes, and snippets.

View jim3ma's full-sized avatar
🎯
Focusing

Jim Ma jim3ma

🎯
Focusing
View GitHub Profile
@x0nu11byt3
x0nu11byt3 / elf_format_cheatsheet.md
Created February 27, 2021 05:26
ELF Format Cheatsheet

ELF Format Cheatsheet

Introduction

Executable and Linkable Format (ELF), is the default binary format on Linux-based systems.

ELF

Compilation

@ZipFile
ZipFile / README.md
Last active April 1, 2024 18:35
Pixiv OAuth Flow

Retrieving Auth Token

  1. Run the command:

    python pixiv_auth.py login

    This will open the browser with Pixiv login page.

@aojea
aojea / Dockerfile
Last active December 27, 2023 16:11
Using crio runtime in KIND
ARG IMAGE=kindest/node
ARG VERSION=1.19
ARG MINOR=1
ARG OS=xUbuntu_20.04
FROM ${IMAGE}:v${VERSION}.${MINOR}
ARG VERSION
ARG OS
@darfink
darfink / ld64
Last active November 22, 2023 15:01
Drop-in replacement/wrapper around macOS' linker (ld) that respects segprot's `max_prot` value
#!/usr/bin/python2
import argparse
import sys
import subprocess
from itertools import takewhile
from macholib import MachO, ptypes
def parse_rwx(text):
return ('r' in text and 1) | ('w' in text and 2) | ('x' in text and 4)
@vkobel
vkobel / hash_kernel_module.c
Last active August 19, 2023 13:35
Example of using the Linux Kernel Crypto API for SHA256 hashing (tested with 5.6)
#include <linux/module.h>
#include <crypto/hash.h>
struct sdesc {
struct shash_desc shash;
char ctx[];
};
static struct sdesc *init_sdesc(struct crypto_shash *alg)
{
@mrunkel
mrunkel / zfs_cheatsheet.md
Last active March 10, 2024 20:23
My ZFS cheatsheet

ZFS commands cheatsheet

Devices and Pools

List all devices in the server

lsblk -S

List all pools

zpool list

@Russtopia
Russtopia / go-cgi-upload.go
Last active February 16, 2024 11:29
Golang CGI file upload example using net/http/cgi
// Simple demo of a GO CGI program that takes
// file uploads.
//
// NOTE NOTE DANGER DANGER
// Absolutely No filename/path sanitizing is done,
// don't run this in production unless you want hackers
// to overwrite your server. This is only a demo of
// how to untangle the go stdlib form-related datatypes
// and use them to take file uploads.
//
?: your client unchoked the peer but the peer is not interested
D: currently downloading from the peer (interested and not choked)
d: your client wants to download, but peer doesn't want to send (interested and choked)
E: peer is using Protocol Encryption (all traffic)
e: peer is using Protocol Encryption (handshake)
F: peer was involved in a hashfailed piece (not necessarily a bad peer, just involved)
H: peer was obtained through DHT
h: peer connection established via UDP hole-punching
I: peer established an incoming connection
K: peer unchoked your client, but your client is not interested
@coin8086
coin8086 / using-proxy-for-git-or-github.md
Last active April 7, 2024 07:40
Use Proxy for Git/GitHub

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocol you use. And there're two common protocols: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocol. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p
@hothero
hothero / aes_cbc_pkcs5.go
Last active March 30, 2024 02:53
AES/CBC/PKCS5Padding implementation by Golang (can work with JAVA, C#, etc.)
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"encoding/base64"
"fmt"
)