Skip to content

Instantly share code, notes, and snippets.

View apsun's full-sized avatar

Andrew Sun apsun

View GitHub Profile
@apsun
apsun / delet_tweets.md
Last active September 10, 2023 05:06
Delete your old tweets with this disgusting bash script

100% free. Runs completely locally on your machine. Bypasses the 3200 tweet limit. May require some eye bleach for the script. Here's how to use it:

  1. Go to settings -> account -> your Twitter data and request a download. This may take a few hours. You'll get an email with a link to download a zip file. Extract the zip file and navigate to the data directory.

  2. Go to Twitter in a web browser and find any Tweet you want to delete. We're going to use it to extract your authentication credentials for the next step. Open developer tools, delete the tweet, and find the request

#!/bin/sh
old=""
while :; do
new="$(curl -s 'https://www.apple.com/shop/retail/pickup-message?parts.0=MWP22AM%2FA&location=94043' | jq '.body.stores[:4][].partsAvailability["MWP22AM/A"] | select (.pickupDisplay == "available") | .storePickupQuote' -r | head -n1)"
if [ "$new" != "$old" ]; then
if [ "$new" != "" ]; then
notify-send 'AirPods' "$new"
fi
old="$new"
fi
@apsun
apsun / tmenu.go
Last active February 13, 2020 05:12
A super bare-bones fzf clone. Inspired by https://github.com/sgtpep/pmenu
package main
import (
"bufio"
"flag"
"fmt"
"os"
"regexp"
"strings"
@apsun
apsun / aac2mp3.sh
Last active February 15, 2020 23:01
#!/bin/bash
FFMPEG_EXEC=./ffmpeg.exe
for f in *.{m4a,wav}; do
"$FFMPEG_EXEC" -i "$f" \
-codec:a libmp3lame \
-b:a 320k \
-ar 44100 \
-map_metadata -1 \
"${f%.*}.mp3"
@apsun
apsun / dmv.py
Created February 27, 2019 18:23
import datetime
import random
import time
import requests
import bs4
DATE = "Wed, 3 Apr 2019"
TIME = "0900"
COOKIE = """
<your cookie here>
@apsun
apsun / client.sh
Created January 3, 2019 22:44
Measure network speed and packet loss between two hosts
#!/bin/bash
set -euo pipefail
ADDR=natsume.crossbowffs.com
PORT=4123
TIME=15
OUT=client-log.csv
tmpfile=$(mktemp)
start=$(date +%s%3N)
timeout $TIME nc -d $ADDR $PORT > $tmpfile || true
@apsun
apsun / debugme.c
Last active February 13, 2020 06:47
/*
* debugme.c - why is my program not running?!
*
* Dumps the following outputs:
* /tmp/debugme.args: uid, euid, gid, cwd, argv, envp
* /tmp/debugme.std{out,err}: corresponding output streams
*
* Usage:
* debugme <original command and arguments>
*
@apsun
apsun / c-style.md
Last active December 14, 2019 19:16

Whitespace

Tabs or spaces, pick one and be consistent. If choosing spaces, use either 2 or 4 spaces (4 preferred). Do not use 8 spaces. This style guide is written to avoid all "alignment" issues that you may get from mixing tabs and spaces.

Try to keep lines within 80 characters. Note that this is not a hard limit; do not break up long lines just to meet the limit if it means reducing readability. That said, if you are nearing 100 characters, you should consider whether you actually need this much space or if you're just being lazy.

#!/bin/bash
#
# sighub.sh: signal + github = censorship bypass
#
# This script builds the Signal Android client from source,
# and injects a custom update URL so that censorship on
# the main website can be circumvented (unless GitHub is
# also blocked, in which case... RIP). After building the
# APK, simply push it to GitHub Pages to make it visible to
# other clients. Obviously, modify the URL below to point
@apsun
apsun / arpspoof.rs
Last active October 20, 2022 06:41
//! arpspoof.rs: ARP spoofing attack PoC for Linux
//!
//! Mostly just an experiment for me to learn Rust.
//! Depends on the pnet crate.
//! Run it as root; no command-line arguments required.
//! Obviously, don't use this without the consent of others on your network.
//! To see the traffic, use a packet capture program like Wireshark.
extern crate pnet;
use std::io::{Result, BufRead, BufReader, ErrorKind, Write};