This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Dowload all images in a site. I use it to download the first images for legendario.com | |
* source: so/19830088/ | |
* example: downlaod free images from pixabar.com | |
* output: directory in ~/Downloads | |
*/ | |
function getAllImages() { | |
images = document.querySelectorAll("img"); | |
for (i of images) { | |
var a = document.createElement('a'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'nokogiri' | |
base_url = 'https://en.wikipedia.org' | |
site = ARGV.empty? ? 'Film_adaptation' : ARGV.shift | |
url = base_url + "/wiki/#{site}" | |
Signal.trap('INT') { exit } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# autoload bash scripts. Much faster than `source script.sh` | |
# usage: autoload script.sh | |
autoload() { | |
[ -f "$1" ] || { echo "Usage ${FUNCNAME[0]} <filename>"; return 1;} | |
filename="$1" | |
loadname="$(sed 's:\..*::' <<< $(basename $filename))" | |
if [ -z "$(eval echo \${${loadname}_loaded})" ]; then | |
functions=$(command grep -o "^[a-zA-Z0-9_:]* *()" $filename | sed 's/()//') | |
for f in $functions; do | |
eval " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
linguistic() { | |
IFS_ORIGINAL=$IFS | |
IFS="?" | |
FILES=($(find -type f -name "*" -not -path "./.git/*" \ | |
-exec sh -c 'printf "%s " "$(du -b {})"' \; \ | |
-exec file -b {} \; )) | |
SUM=($(sed 's|\./[^ ]*| |g' <<< ${FILES[@]} \ | |
| sort -k2 \ | |
| awk '{v=$1;$1="";s[$0]+=v}END{for(i in s)print s[i] i "?"}' \ |