Skip to content

Instantly share code, notes, and snippets.

View johnelliott's full-sized avatar
🕳️
tunneling

John Elliott johnelliott

🕳️
tunneling
View GitHub Profile
@nerdcha
nerdcha / delete_tweets.sh
Last active April 2, 2020 02:33
Bash oneliner to delete tweets
#!/bin/bash
# Context: https://jamiehall.cc/2020/03/10/delete-all-your-tweets-with-one-line-of-bash/
# https://news.ycombinator.com/item?id=22689746
twurl "/1.1/statuses/user_timeline.json?screen_name=YOUR_TWITTER_HANDLE&count=200&max_id=$(twurl '/1.1/statuses/user_timeline.json?screen_name=YOUR_TWITTER_HANDLE&count=200&include_rts=1' | jq -r '.[9]|.id_str')&include_rts=1" | jq -r '.[]|.id_str' | parallel -j 10 -a - twurl -X POST /1.1/statuses/destroy/{1}.json > /dev/null
@PierBover
PierBover / index.js
Last active April 30, 2024 09:08
Micro router for Cloudflare Workers
const router = require('./router');
router.setRoutes([
{
path: '/ping',
method: 'GET',
handler: ping
},
{
path: '/hello/:name',
@danmactough
danmactough / move-music.sh
Last active April 14, 2020 22:16
Move your entire music library from one directory to another
#!/bin/bash
set -euo pipefail
set -x
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
# set OLD_DIRECTORY and NEW_DIRECTORY
# OLD_DIRECTORY=/Users/your_username/Music
# NEW_DIRECTORY=/Volumes/your_external_drive/Music
OLD_DIRECTORY=
@catchdave
catchdave / replace_synology_ssl_certs.sh
Last active May 10, 2024 22:46
CLI script to programmatically replace SSL certs on Synology NAS
#!/bin/bash
#
# *** For DSM v7.x ***
#
# How to use this script:
# 1. Get your 3 PEM files ready to copy over from your local machine/update server (privkey.pem, fullchain.pem, cert.pem)
# and put into a directory (this will be $CERT_DIRECTORY).
# Personally, I use this script (https://gist.github.com/catchdave/3f6f412bbf0f0cec32469fb0c9747295) to automate steps 1 & 4.
# 2. Ensure you have a user setup on synology that has ssh access (and ssh access is setup).
# This user will need to be able to sudo as root (i.e. add this line to sudoers, <USER> is the user you create):
#!/bin/bash
set -eo pipefail
echo "Deleting existing hosting releases"
SITE=$1
echo "Site: $SITE"
HEADER_AUTH="Authorization: Bearer "$(gcloud auth application-default print-access-token)"";
@mbleigh
mbleigh / README.md
Last active September 25, 2020 04:26
Automate the deletion of old Firebase Hosting versions.

Firebase Hosting Version Cleanup

This is a simple utility script for cleaning up Firebase Hosting versions, leaving a specified number of versions remaining. This is primarily done to conserve storage usage, but may have other uses.

USE AT YOUR OWN RISK. NO WARRANTY IS PROVIDED. THIS SCRIPT DOES DELETE STUFF PERMANENTLY

Usage

node cleanupVersions.js [commit]

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@kbingham
kbingham / uvc-gadget.sh
Created May 15, 2018 08:18
UVC ConfigFS Gadget configuration tool
#!/bin/sh
set -e
#set -x
CONFIGFS="/sys/kernel/config"
GADGET="$CONFIGFS/usb_gadget"
VID="0x0525"
PID="0xa4a2"
SERIAL="0123456789"
@myobie
myobie / example-template-usage.html
Last active August 30, 2020 15:00
Recursively list out sections and pages for a nice hugo navigation for a section or site
{{ define "main" }}
<div id="wrapper">
<div id="sidebar">
{{ partial "sidebar-sections-list.html" .Site.Sections }}
</div>
<div id="content">
<!-- ... -->
</div>
</div>
{{end}}
@irek02
irek02 / bash-while.sh
Created October 3, 2017 13:27
bash-while.sh
while sleep 1; do cmd ; done