Skip to content

Instantly share code, notes, and snippets.

View lzm0's full-sized avatar

Zimo Li lzm0

  • Toronto
  • 19:02 (UTC -04:00)
View GitHub Profile
/*
Instagram Unfollowers Checker
Instructions:
1. Log in to your Instagram account in a Chrome browser
2. Open your profille page (https://www.instagram.com/your_username/)
3. Open the "Console" tab in the developer tools (F12)
4. Paste the code below and press Enter
5. Wait for the script to finish
@lzm0
lzm0 / slides.sh
Last active February 28, 2023 21:16
# Convert a PDF to a tiled PDF with 9 pages per page and inverted colors
# Requires ImageMagick
tmp=$(mktemp -d)
convert -density 300 -colorspace Gray -channel RGB -negate -contrast -contrast -contrast -contrast $1 $tmp/page-%03d.png
montage -geometry +0+0 -tile 2x5 $tmp/page-*.png $tmp/tiled-%03d.png
convert -page a4 -border 7% -bordercolor white $tmp/tiled-*.png tiled-$(basename $1)
rm -rf $tmp
@lzm0
lzm0 / New Window.applescript
Created February 3, 2023 05:39
Applescript to open a new Chrome window in the current space
tell application "System Events" to tell application process "Dock" to tell list 1 to tell UI element "Google Chrome"
perform action "AXShowMenu"
tell menu "Google Chrome" to tell menu item "New Window" to perform action "AXPress"
end tell
@lzm0
lzm0 / detect.sh
Created September 6, 2022 04:14
Notify when a port is blocked by the GFW
#!/bin/bash
BOT_TOKEN=YOUR_TELEGRAM_BOT_TOKEN
CHAT_ID=YOUR_TELEGRAM_CHAT_ID
PORT=YOUR_PORT
for i in {1..5}; do nc -zvw 10 $(dig +short @1.1.1.1 google.com A | tr -d '\n') $PORT && exit 0 || sleep 1; done
ssh example.com "
curl -X POST -s https://api.telegram.org/bot$BOT_TOKEN/sendMessage \
-H 'Content-Type: application/json' \
-d '{\"chat_id\": $CHAT_ID, \"text\": \"🚨 google.com is blocked! 🚨\"}'
"