Skip to content

Instantly share code, notes, and snippets.

Anthony Madhvani octagonal

  • EU, Belgium
Block or report user

Report or block octagonal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@octagonal
octagonal / getarg
Last active Aug 29, 2015
Get explanations for command line options for most shell commands
View getarg
#!/usr/bin/bash
# See what arguments do without having to go through a man page
# This only works on man pages that have an "options summary" section or something similar
# The expected format is thus: {whitespace}{flag,optional multichar flag}{whitespace}{short explanation}
count=1
tmp=$(mktemp)
man $1 > $tmp
@octagonal
octagonal / sorrymoot.sh
Last active Jan 4, 2016
Fast + Simple 4chan Image Downloader
View sorrymoot.sh
#!/usr/bin/sh
# Every time you use this, Moot sheds a single manly tear. Please use it sparingly if at all.
echo -e "(curl)\t\t Downloading thread"
curl -s http://boards.4chan.org/$1 -o thread.html
echo -e "(grep -Po)\t Finding images "
cat thread.html | grep -Po '(?<=fileThumb" href=")\S+(?=")' > img
echo -e "(sed)\t\t Extracting image links"
@octagonal
octagonal / BashSuperpowers.sh
Last active Dec 25, 2015
This bash script will give you superpowers
View BashSuperpowers.sh
#!/usr/bin/env bash
function superpower {
echo $(curl -Is http://powerlisting.wikia.com/wiki/Special:Random | grep Location | cut -d / -f 5 | sed "s/_/ /g")
}
count=$1
echo "Your superpowers for today are: " > $HOME/super.txt
for (( c=1; c<=$count; c++ ))
View query.json
[
{
"name": "Aphex Twin Discography 320kbps",
"magnet": "magnet:?xt=urn:btih:b35c01a402ed620e3574dd71528b7483a4fcb5f9&dn=Aphex+Twin+Discography+320kbps&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337",
"uploader": {
"name": "nrs321"
},
"date": "01-11 02:31",
"size": "2.14 GiB",
"category": {
@octagonal
octagonal / change_in_place.sh
Created Aug 25, 2013
Substitute in a file according to a pattern and save it back to that file, while at the same time making a backup called %file%.back
View change_in_place.sh
#!/usr/bin/zsh
#You don't need to use / as a delimiter, especially not when it's not convenient.
sudo sed -i.back 's#<img src="#<img src="http://mitpress.mit.edu/sicp/full-text/book/#g' book.html
View gist:6300976
" Disable arrow keys.
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
@octagonal
octagonal / curl_imgur.sh
Last active Dec 21, 2015
Curl Imgur for valid URLs using random string from /dev/urandom
View curl_imgur.sh
# Get the string from /dev/urandom (from ~/bin/get_rand)
#!/bin/zsh
# The -c flag for head indicates the amount of bytes I want to see returned.
# In this case this correlates to the amount of characters I want returned.
function random {
export rand=$(
LC_CTYPE=C tr -dc a-zA-Z0-9 < /dev/urandom | head -c 7| xargs
)
}
random
View TPB Structuur
Magnet link:
table#searchResult tbody tr:first-child td:nth-child(4) a [node href attribute]
Name:
table#searchResult tbody tr:first-child td:nth-child(2) a [node text]
thepiratebay.sx/<query>/0/<sorting mode>/<category>
<category>:
201 : films
207 : HD-films
View Semantic voting
Sup ilias
From: http://www.reddit.com/r/startups/comments/1gvg7d/show_rstartups_we_were_sick_of_how_stagnant_forum/caodce1:
*Semantic voting*. You should be able to easily select a section/paragraph of a post/comment,
and vote on it specifically. Instead of voting/liking a complete post
(which probably contains things you agree with as well as things you disagree with),
you can select a word/sentence, and express your agreement.
Downvoting a word could be used to point out grammatical errors, which leads to
You can’t perform that action at this time.