[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

ITT: Most useful scripts you've written I torrented a ton

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 16
Thread images: 1

File: terminal-app-icon.jpg (7KB, 256x256px) Image search: [Google]
terminal-app-icon.jpg
7KB, 256x256px
ITT: Most useful scripts you've written

I torrented a ton of music and a lot of the songs had the artists names in front of them.
So I wrote a script to check for songs in my music directory that started with any of the artists names, and renamed the song without the artists name. Took like 2 minutes to write in python and saved me a lot of time.
>>
>>56022771
Yo, you use last.fm? Then this might be useful to you

#!/bin/bash

read -rp "Type your username: " username

lastfm_key="f9e25a0e8454787a5cb9a840cc9b6baf"
url="ws.audioscrobbler.com"
path="/2.0/?method=user.getLovedTracks&user=$username&api_key=$lastfm_key&limit=1000"
beginning_lines="<lfm status=\"ok\"><lovedtracks user=\"$username\" page=\"1\" perPage=\"1000\" totalPages=\"1\" total=\".*\""
(( loop=1 ))

extract_tracks_artists ()
{
wget "$url$path" -qO - | grep -e '<name>' | sed "s/$beginning_lines//I" | sed 's/<.[a-z]*//g' | sed 's/>//g' | sed -e 's/&quot;/\"/g' | sed -e "s/\&apos;/\'/g" | awk 'BEGIN { FS="
"; RS=""; OFS=" "} { x=2; y=1 } { while (x < NF) { print $x, $y; x+=2; y+=2 } }' - > .loveplaylist.txt
}

ask ()
{
if [ -f ~/.mpd/playlists/My\ Favorite\ Tracks.m3u ]; then
echo "Do you want to overwrite your current playlist? (y/n):"
read -n 1 choice
if [ $choice = y ]; then
echo -e "
"
rm ~/.mpd/playlists/My\ Favorite\ Tracks.m3u
elif [ $choice = n ]; then
exit
else
echo "Sorry, didn't catch that..."
sleep 1
ask
fi
fi
}

ask
extract_tracks_artists
$(( end=$(wc -l < .loveplaylist.txt)+1 )) > /dev/null 2>&1 && mpc clear > dev/null
echo "Please Wait..."

until [[ $loop = $end ]]; do
mpc findadd artist "$(cat .loveplaylist.txt | sed -n -e "$loop p" | awk 'BEGIN { FS=" " } { print $1 }' - )" title "$(cat .loveplaylist.txt | sed -n -e "$loop p" | awk 'BEGIN { FS=" " } { print $2 }' - )" > /dev/null
(( ++loop ))
done

rm .loveplaylist.txt

mpc save "My Favorite Tracks"
mpc clear > /dev/null

echo 'Done!'

>>
>>56022810
No I don't use Last.fm. What does that script do?
>>
>>56022771
tumblr_rename.ps1
$filetype=$args[0]

Get-ChildItem *.$filetype | ForEach-Object {Rename-Item $_ -NewName tumblr_"$(libressl.exe rand -base64 15).$filetype"}


Useful for making my shitposting low qual images look like saved from tumblr which triggers an awful lot of people on this site.
>>
>>56022887
steals all of your scrobbles
>>
>>56024564
Wouldn't it be better to save your files with a real name you can actually find again and just modify 4chanX or some other userscript to change the name when uploading the post?
>>
>>56022771
I written many automation scripts. Hard to say which is the most useful. I like my ffmpeg trim video script

@ECHO OFF
CD /D %~dp1
echo echo Current File: "%~n1%~x1"

echo \033[33m Enter CutNumber | cmdcolor.exe
set /p num=

echo \033[33m Enable Sound(type -an for no sound) | cmdcolor.exe
set /p sound=

echo \033[32m Enter Start Time(HH:MM:SS) | cmdcolor.exe
set /p start=

echo \033[31m End Time(HH:MM:SS) | cmdcolor.exe
set /p end=

::Echo output has to be written to a temp file.
>Y:\TEMP\output.tmp (
echo %start% | sed s/:/*60+/g | bc
echo %end% | sed s/:/*60+/g | bc
)

::Read temp file, then store the lines in the vars.
<Y:\TEMP\output.tmp (
set /p s=
set /p e=
)

set /a total=%e%-%s%

ffmpeg -y -i "%~n1%~x1" -vcodec copy -acodec copy %sound% -ss %s% -t %total% "%~n1[cut%num%]%~x1"
del Y:\TEMP\output.tmp

:colorEcho
>>
>>56026456
I also like my simple pomf upload. I can right click a file and it'll get uploaded to pomf. link is copied to clipboard.

CD /D %~dp1
limf -c 10 -l "%~n1%~x1"|clip
msg %username% /time:5 Uploaded Complete!
>>
>>56022771
I made a script that does the following
copy my dotfiles>git pushes them
syu
fstrim
not my best script but probably my most used
>>
>>56024605

Never used last.fm before, so forgive my ignorance. But what the mother of fuck is a scrobble?
>>
I wrote a script where you input a list of 4chan boards and also a list of keywords. The program searches every board you listed for threads which contain any of the keywords you listed in the thread's title or OP. If any keyword is present in the thread title or OP, the program will download every image in that thread and save it to a folder in the same directory as the script.

tl;dr Download porn really fast

http://pastebin.com/GgeQnN7N
>>
>>56026812
australian money i think or something to do with harry potter
>>
#!/usr/bin/env bash

# dump.sh: dump a list of files or directories to a remote destination

REMOTE_DIR=""
CHMOD=""
i=0

if [ -f $HOME/.dumprc ]; then
# add dump config, e.g:
# REMOTE_HOST="domain.com/"
# REMOTE_PATH="/var/www/dump/"
# REMOTE_URL="http://dump.domain.com/"
# CHMOD="--chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r"
source $HOME/.dumprc
fi

HELPMSG="
Usage:\t`basename $0` [-h] [-c PERMISSIONS] [-d REMOTE_DIR] [FILES..]\n
\t-c\tspecify permissions for --chmod option in rsync\n
\t-d\tput files in specified remote directory, create if it does not exist\n
\t-h\tshow help and exit\n
"

if [ `expr $# - $i` -lt 1 ]; then
echo -e $HELPMSG
exit 1
fi

while getopts hd:c: opt; do
case $opt in
c) CHMOD="--chmod=$OPTARG"
let i++ ;;
d) REMOTE_DIR="$OPTARG"
if [ "${REMOTE_DIR: -1}" != '/' ]; then
REMOTE_DIR="$REMOTE_DIR"/
fi
let i++ ;;
h) echo -e $HELPMSG
exit 1 ;;
esac
let i++
done

rsync -Prazq $CHMOD --rsync-path="mkdir -p \"$REMOTE_PATH$REMOTE_DIR\" && rsync" \
"${@: -$#+$i}" "$REMOTE_HOST":"'$REMOTE_PATH$REMOTE_DIR'"

for var in "${@: -$#+$i}"; do
REMOTE_DIR=$(echo "$REMOTE_DIR" | sed -e 's/ /%20/g')
file=$(basename "$var" | sed -e 's/ /%20/g')
echo "URL: $REMOTE_URL$REMOTE_DIR$file"
done

exit 0


Use it all the time desu
>>
>>56026852
Nice!
I have made one of those image downloaders myself in PyQt4. There's support for multiple imageboards too.

I've made a snippet downloader for glot.io, since I use it a lot on my spare time and anywhere I go.
>>
>>56022771
I wrote a stock simulator in Matlab.

Nothing I've ever written (outside of my job) is useful, but at least this one is fun.
>>
>>56022771
When I had to clean up my bookmarks and have not found offline manager to do that, I wrote my first almost useful python script.
http://pastebin.com/HCYY8pUG
Thread posts: 16
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.