Skip to content

Instantly share code, notes, and snippets.

@ottosch
ottosch / restore-grub.md
Created February 25, 2025 02:02
How to restore GRUB using Arch Linux ISO

How to restore GRUB using Arch Linux ISO

Partitions

  • /dev/sda1: ESP (EFI System Partition)
  • /dev/sda2: system + home
  • /dev/sda3: swap

Script

@ottosch
ottosch / verify-grapheneos-signature.md
Created February 10, 2025 23:16
How to verify GrapheneOS releases

Verifying GrapheneOS releases

Instructions taken from Obtaining Factory Images.

Get the signers' public keys

curl -O https://releases.grapheneos.org/allowed_signers
@ottosch
ottosch / twitter-revanced.md
Last active January 15, 2025 00:11
How to patch Twitter (X) with ReVanced

How to patch Twitter (X) with ReVanced

Benefits:

  • Hide ads;
  • Remove tracking when sharing links;
  • Enable video download;
  • Other benefits;

Download X apk

@ottosch
ottosch / laptop-lid.md
Last active January 13, 2025 21:57
Settings to avoid laptop sleeping after lid is closed

Laptop lid configuration

Ignore the lid being closed

sudo nano /etc/systemd/logind.conf, change these values to ignore:

HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
@ottosch
ottosch / dimm.sh
Created January 9, 2025 13:52
Change screen brightness for the terminal
#! /usr/bin/env bash
# Sets brightness to parameter level [0, max_brightness]
# Default: 10_000
default=10000
brightness=${1:-$default}
max="$(cat /sys/class/backlight/*/max_brightness)"
if test "$brightness" -eq "$brightness" 2>/dev/null; then # numeric value
@ottosch
ottosch / seed_picker.sh
Last active December 24, 2023 01:59
Find all possibilities for the last seed word
#! /usr/bin/env bash
function run() {
read_wordlist
local input
printf "Enter seed words: "
read -r input
local seed_words=()
@ottosch
ottosch / augustana-college.js
Created December 14, 2023 13:56
Extracts JPEG from transaction 033d185d1a04c4bd6de9bb23985f8c15aa46234206ad29101c31f4b33f1a0e49
#! /usr/bin/env node
const { Transaction } = require("bitcoinjs-lib");
const fs = require("fs");
const inputFile = "txhex";
const outputFile = "output.bin";
let hex = fs.readFileSync(inputFile, "utf8");
let tx = Transaction.fromHex(Buffer.from(hex, "hex"));
@ottosch
ottosch / apk-cert-fingerprint.sh
Last active February 23, 2025 22:13
Outputs apk's signing certificate hash
# 1024-bit key
keytool -printcert -jarfile apk_file 2>/dev/null | grep SHA256 | cut -f2- -d':' | tr -cd '[[:xdigit:]]:'; echo
# 4096-bit key
apksigner verify -v --print-certs --min-sdk-version 24 apk_file | grep "certificate SHA-256"
# One-liner example for Signal
test $(apksigner verify -v --print-certs --min-sdk-version 24 Signal-Android-website-prod-universal-release-7.33.2.apk | grep -m1 "certificate SHA-256" | cut -d':' -f2 | tr -cd '[:xdigit:]') = $(echo -n "4B:E4:F6:CD:5B:E8:44:08:3E:90:02:79:DC:82:2A:F6:5A:54:7F:EC:C2:6A:BA:7F:F1:F5:20:3A:45:51:8C:D8" | tr -cd '[:xdigit:]' | tr '[:upper:]' '[:lower:]') && echo "passed" || echo "failed"
@ottosch
ottosch / mempool-stats.js
Last active December 17, 2023 15:40
Mempool BRC-20 status
#! /usr/bin/env node
// To run, start a project and install the dependency with:
// `npm init` and `npm i node-bitcoin-rpc`.
const rpc = require("node-bitcoin-rpc");
const fs = require("fs");
const opMap = new Map();
const tickMap = new Map();
@ottosch
ottosch / sats-token.js
Created September 2, 2023 20:50
Identify BRC-20 sats in mempool
#! /usr/bin/env node
const rpc = require("node-bitcoin-rpc");
const fs = require("fs");
const inscriptionMark = Buffer.from("0063036f7264", "hex");
const keywords = ["brc-20", "op", "mint", "tick", "\"sats\"", "amt"];
const op_endif = 0x68;
async function run() {