Skip to content

Instantly share code, notes, and snippets.

@ohhdemgirls
ohhdemgirls / rename.sh
Last active January 4, 2016 10:49
Rename html files based on title tag
#!/bin/bash
# Rename the ouput html file from redditPostArchiver with the reddit thread title.
# https://github.com/sJohnsonStoever/redditPostArchiver
for f in *.html;
do
title=$( awk 'BEGIN{IGNORECASE=1;FS="<title>|</title>";RS=EOF} {print $2}' "$f" )
mv -i "$f" "${title//[^a-zA-Z0-9\._\- ]}_$f"
@ohhdemgirls
ohhdemgirls / vidble.sh
Created January 20, 2014 02:49
Simple Vidble.com Album Downloader
#!/bin/bash
id="$1"
host="http://vidble.com/album/"
mkdir "$id"
wget -nv -O - "$host$id" |grep -e "<img src='" |grep -Eo '/[^" ]+(jpg|jpeg|JPG|GIF|gif|PNG|png)' |sed -e 's/_med//' -e 's@^@http://vidble.com@' > $id/links.txt
sed -i '/logo/d' $id/links.txt
wget -i $id/links.txt -P $id

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ohhdemgirls
ohhdemgirls / mediacru.sh
Last active January 2, 2016 13:09
mediacru.sh rehoster
#!/bin/bash
#Usage: ./mediacru.sh $(cat urls.txt)
echo -e "\e[91mMediaCrush Rehoster\e[0m"
for f in "$@"; do
echo -ne "\e[34mUploading:\e[0m" $f
url="https://mediacru.sh/api/upload/url"
out=$(curl -s -F "url=$f" "$url")
hash=$(echo $out |sed -nre 's#.*"hash": "([^"]+)".*#\1#p')