Skip to content

Instantly share code, notes, and snippets.

View acheong08's full-sized avatar
🎯
Focusing

Antonio Cheong acheong08

🎯
Focusing
  • Cardiff University
  • Your computer
  • 08:32 (UTC +01:00)
View GitHub Profile
from yt_dlp import YoutubeDL
from mutagen.easymp4 import EasyMP4
import os
ydl = YoutubeDL()
# List files
files = os.listdir()
# Filter out non-m4a files
files = [f for f in files if f.endswith(".m4a")]
@acheong08
acheong08 / cmd.md
Created July 20, 2023 07:42
YouTube download command

yt-dlp $(xclip -o) -f m4a -o "%(id)s.%(ext)s"

@acheong08
acheong08 / tunbypass.sh
Last active August 13, 2023 16:12
Linux script to allow certain IPs to bypass VPN
#!/bin/bash
if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root."
exit 1
fi
if [ "$#" -lt 1 ]; then
echo "Usage: sudo tunbypass <add/del/list> [server_ip]"
exit 1
@acheong08
acheong08 / makeKeyHash.js
Last active August 17, 2023 08:04
Extracted hash function from Obsidian Vault. It is used at https://api.obsidian.md/vault/create and vault keyhash in websocket.
const crypto = require("crypto");
function B(e) {
return e.slice(e.byteOffset, e.byteOffset + e.byteLength);
}
async function _(e) {
const t = await j(e);
return G(t);
}
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"golang.org/x/crypto/scrypt"
)
This file has been truncated, but you can view the full file.
137c137
< 9357: (e) => {
---
> 9514: (e) => {
1096c1096
< (r.text = n(9514)),
---
> (r.text = n(1274)),
1104c1104
< var i = n(9514);
@acheong08
acheong08 / sample.js
Last active September 2, 2023 12:02
Bounty: Help grug brained dev with JS - Amount negotiable.
function foo() {
let fetchCopy = window.fetch;
return function() {
return fetchCopy('http://example.com');
};
}
let boo = foo();
function bar() {
@acheong08
acheong08 / cputemp.sh
Created September 17, 2023 15:03
CPU temperature script
#!/bin/bash
paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/'
@acheong08
acheong08 / conv.go
Created September 29, 2023 20:24
Convert Twitter Database Dump to SQLite
package main
import (
"bufio"
"database/sql"
"fmt"
"os"
"strings"
_ "github.com/mattn/go-sqlite3"