Skip to content

Instantly share code, notes, and snippets.

@Sharafi7
Sharafi7 / FFrescue.bash
Last active November 8, 2019 02:40
FFrescue.bash – Automatically creates backups of Firefox session and history.
# FFrescue.bash – Automatically creates backups of Firefox session and history.
# Because Firefox'es session recovery is terribly unreliable, and all actually good Session Manager add-ons have been obliterated by Firefox Quantum.
# Delay: 24h. Coming soon: Manual delay.
alias FFrescue=ffrescue
d8tm() { date +%Y%m%d%H%M%S ;}
mkcd() { if [ ! -d "$@" ];then mkdir -p "$@" ;fi; cd "$@"; }
vcho() { # Verbose echo
@Sharafi7
Sharafi7 / YTCA.js
Last active October 14, 2019 19:09
YouTube Comment Archiver (YTCA.js)
javascript:void(open('http://archive.today/?run=1&url='+encodeURIComponent(document.location)+'%2526lc=1%2526disable_polymer=1'))
// JavaScript browser bookmarklet for immediately archiving the top comments of a YouTube video (or the newest comments if set to default by uploader in video settings).
// Loads AJAX-less (HTML-loaded instead of “extraloaded”) comments into Archive.Today webpage archiver.
// Let's rescue great conversations infront of oblivion.
// Unfortunately, comment replies are not archived using this bookmarklet. To archive individual replies, the comment would have to be directly linked to.
// Back in 2016 and 2017, Archive.Today (or Archive.is) archived comment replies as well, without the need for the “lc” URL parameter.
@Sharafi7
Sharafi7 / ArchiveYT.bash
Last active October 11, 2019 15:49
ArchiveYT.bash – Bash functions to facilitate YouTube meta data archival.
# UNFINISHED code snippet!
urlformat () { URL="$(printf "${1:-$URL}" |sed s/'&'/'%26'/g|sed s/' '/'%20'/g)" ;}
function ywb { # Saves YouTube video's watch pages + top comments (or lastest comments if specified as default by uploader) into the Wayback Machine. # “-H” parameter for Google's “ytimg” domains.
if [[ "$*" == "" ]]; then read -p "Video ID(s): " ywb_input ; else ywb_input="$*" ; fi
for v_id in "$ywb_input"; do
wget -pH -O /dev/null -a ywb.wget.log "web.archive.org/save/youtube.com/watch?lc=1&disable_polymer=1&v=$v_id" 2>/dev/null & # Shutting /dev/stderr's pesky mouth.
errchc
@Sharafi7
Sharafi7 / Screw429.bash
Last active October 2, 2019 13:40
Screw429.bash (originally “Archive429.bash”) – Screw HTTP 429.
# Gist description: Screw429.bash (originally “Archive429.bash”) – Screw HTTP 429.
# Screw “429 Too Many Requests” HTTP errors.
# Combatting new unsolicited restriction of Wayback Machine since early 2019 that impedes website archival, similarly to Archive.Today's data cap.
function errchc { if [ $? -eq 0 ];then printf " \e[102m\e[30m${1:-" "}\e[0m";else printf " \e[101m${1:-" "}\e[0m";fi ;}
function pgtitle { curl -s "$@" | grep -ioe "<title>.*</title>" | sed -r "s#</?title>##g" ;}
alias ywget='wget -H -w$(bypass429) -p -U "$UA" -O /dev/null -a channel2wayback.log'
2wb() { wget -q -O /dev/null -a 2wb.debug.log -p web.archive.org/save/"$@" ;} # Simple Wayback
function bypass429 { printf $((5+0$(jobs -p |wc -l)*5)) ;} # Dynamic rate-limiting bypass for “ywget” – enhanced edition.
d8tm() { date +%Y%m%d%H%M%S ;}
UA="Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
@Sharafi7
Sharafi7 / InstaStore-Gen2.bash
Last active November 6, 2019 16:47
InstaStore.bash – Grab it before it's gone! (also grabs stories)
# InstaStore – Grab it before it's gone! (or “GramStore”, “GrabSta” or “Instackram”.)
# Save volatile media from getting lost into oblivion.
# Now portable: Copy and paste this script into your bash terminal to run immediately!
echo '
LADIES AND GENTLEMEN!, WELCOME TO: ___
/\__\
/:/ _/_
/:/ /\__\
/:/ /:/ _/_
@Sharafi7
Sharafi7 / InstaStore.beta.bash
Last active September 23, 2019 02:52
InstaStore – Grab Instagram stories before they're gone!
# InstaStore – Grab it before it's gone! (or “GramStore”, “GrabSta” or “Instackram”.)
# Save volatile media from getting lost into oblivion.
echo ' WELCOME TO:
____ __ _____ __ __
/ _/ ____ _____ / /_ ____ _ / ___/ / /_ ____ _____ ___ / /
/ / / __ \ / ___/ / __/ / __ `/ \__ \ / __/ / __ \ / ___/ / _ \ / /
_/ / / / / / (__ ) / /_ / /_/ / ___/ / / /_ / /_/ / / / / __/ /_/
/___/ /_/ /_/ /____/ \__/ \__,_/ /____/ \__/ \____/ /_/ \___/ (_) '
@Sharafi7
Sharafi7 / twarchive.edition2.bash
Created September 22, 2019 21:55
TwArchive – Archive everything someone tweets (including tweet replies) into the Wayback Machine!
# TwArchive-NG (or “twget”) – Archive everything someone tweets (including tweet replies) into the Wayback Machine!
echo ' Welcome to:
_____ ___ _ _ _ _ _____
|_ _| / _ \ | | (_) | \ | | __ \
| |_ _/ /_\ \_ __ ___| |__ ___ _____ ______ | \| | | \/
| \ \ /\ / / _ | __/ __| _ \| \ \ / / _ \ |______| | . ` | | __
| |\ V V /| | | | | | (__| | | | |\ V / __/ | |\ | |_\ \
\_/ \_/\_/ \_| |_/_| \___|_| |_|_| \_/ \___| \_| \_/\____/'
@Sharafi7
Sharafi7 / twarchive.full.bash
Last active November 29, 2021 19:52
TwArchive – Archive everything someone tweets (including tweet replies) into the Wayback Machine!
# TwArchive-NG (or “twget”) – Archive everything someone tweets (including tweet replies) into the Wayback Machine!
# Suggested by a friend.
# No need to download! Copy-pasting this entire script into your Linux bash terminal will work as well.
pgmname="TwArchive-NextGeneration" # Program name.
echo ' Welcome to:
_____ ___ _ _ _ _ _____
|_ _| / _ \ | | (_) | \ | | __ \
| |_ _/ /_\ \_ __ ___| |__ ___ _____ ______ | \| | | \/
| \ \ /\ / / _ | __/ __| _ \| \ \ / / _ \ |______| | . ` | | __
@Sharafi7
Sharafi7 / twarchive.beta.bash
Last active September 22, 2019 20:17
TwArchive – Archive everything someone tweets (including tweet replies) into the Wayback Machine!
# TwArchive (or “twget”) – Archive everything someone tweets (including tweet replies) into the Wayback Machine!
# Adapted to request by friend
#Declaring common functions and aliasses first:
function errchc { if [ $? -eq 0 ];then printf " \e[102m\e[30m${1:-" "}\e[0m";else printf " \e[101m${1:-" "}\e[0m";fi ;}
d8tm() { date +%Y%m%d%H%M%S ;}
alias ŋrep=grep
alias $(printf "\x66\x75\x63\x6b\x69\x6e\x67")=sudo
2wb() { wget -q -O /dev/null -a 2wb.debug.log -p web.archive.org/save/"$@" ;} # to wayback
@Sharafi7
Sharafi7 / SaveLoop.bash
Last active September 25, 2019 20:44
Save quickly changing webpages into the Wayback Machine.
# Save quickly changing webpages into the Wayback Machine.
# Interactive if without parameters.
#Declaring common functions and aliasses first:
function errchc { if [ $? -eq 0 ];then printf " \e[102m\e[30m${1:-" "}\e[0m";else printf " \e[101m${1:-" "}\e[0m";fi ;}
d8tm() { date +%Y%m%d%H%M%S ;}
alias ŋrep=grep
alias $(printf "\x66\x75\x63\x6b\x69\x6e\x67")=sudo
2wb() { wget -a 2wb.wget.log -O /dev/null -a 2wb.debug.log -p web.archive.org/save/"$@" 2>/dev/null ;} # to wayback # Shut your mouth, stderr!
UA="Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" # Twitter Search blocks both “curl” and “wget” by returning 0 results. # Older Firefox version for increased compatibility likelihood.