These are a list of usages of shell commands I can't live without on UNIX-based systems.
Using Homebrew (yes, I am opinionated) you can install the following tools with the following packages:
#!/usr/bin/env python | |
# | |
#require: https://github.com/richardasaurus/mega.py | |
# | |
import os | |
import sys | |
from mega import Mega | |
mega = Mega({'verbose': True}) | |
m = mega.login('megauseremail', 'megapass') |
require 'forwardable' | |
module RtmpMeta | |
class Parser | |
PATTERN = /duration\s+(?<duration>\d+\.?\d+)$/ | |
attr_reader :raw_data | |
def initialize raw_data | |
@raw_data = raw_data | |
end |
#!/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" |
ffmpeg -i some.mkv -acodec copy -vcodec copy some.mp4 #copy mkv to mp4 container - may not be compliant | |
ffmpeg -t 30 -i some.mkv -acodec copy -vcodec copy some.mp4 #create sample | |
ffmpeg -i some.mkv -acodec libfaac -ac 2 -vcodec copy some.mp4 #mp4 with downmixed audio (AAC @ 128kbit) | |
aria2c --bt-min-crypto-level=arc4 --bt-require-crypto=true --dht-listen-port=34450-34459 --listen-port=34460-34469 |
alias cp="rsync -avrP --progress" | |
alias aria2c="aria2c -s 16 -x 16 -k 1M" | |
alias nl="sudo lsof -i | grep -i listen" |
#!/bin/bash | |
if [[ $1 == "" ]]; then | |
echo "Usage: $0 <downloadurl>"; exit | |
fi | |
aria2c -v 2>&1 >/dev/null || (echo "aria2 is not installed"; exit) | |
url=`echo $1 | cut -f1 -d"?"` | |
cmd="aria2c" | |
for mirror in `echo "kent freefr garr switch netcologne surfnet heanet iweb superb-dca3 superb-dca2 jaist tenet ufpt internode" | tr ' ' '\n'` ; do | |
cmd="${cmd} \"${url}?use_mirror=${mirror}\"" | |
done |
alias cp='rsync -p --progress' | |
# copy with progressbar |
#!/usr/bin/env bash | |
# Upload text/images to clbin.com from the command line | |
# License: ISC http://www.isc.org/downloads/software-support-policy/isc-license/ | |
clip() { | |
if command -v xclip &> /dev/null; then | |
xclip -selection clip <<< "$@" | |
elif command -v xsel &> /dev/null; then | |
xsel -b -i <<< "$@" | |
fi | |
} |
# Add multimedia source | |
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list | |
echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list | |
apt-get update | |
apt-get install deb-multimedia-keyring # if this aborts, try again | |
apt-get update | |
# Go to local source directory | |
cd /usr/local/src |