Skip to content

Instantly share code, notes, and snippets.

View Da-Juan's full-sized avatar
🛠️

Nicolas Rouanet Da-Juan

🛠️
View GitHub Profile
@Da-Juan
Da-Juan / booklet.sh
Created March 30, 2018 08:29
Order page numbers to print in booklet
#!/bin/bash
n=$1
j=0
pages=""
for i in $(seq 1 $(( n / 2))); do
if [ $((i%2)) -ne 0 ]; then
if [[ $pages != '' ]]; then
pages=$pages','
fi
pages=$pages$(( n - j ))','$i
@Da-Juan
Da-Juan / youtube-dl_cheat_sheet.md
Last active March 30, 2018 08:24
youtube-dl cheat sheet
  • List Formats:
youtube-dl --list-formats <URL>
  • Download video with english subtitles, and embed them, using best formats available
youtube-dl --no-playlist --format best --sub-lang en --sub-format best --write-sub --embed-subs <URL>
@Da-Juan
Da-Juan / get_ips_from_urls.sh
Created November 4, 2016 14:12
Get IPs from a file containing URLs
#!/bin/bash
for i in $(sed -r 's@^http[s]?://([[:alnum:].]+)[/]?$@\1@' $1); do
echo "=== $i ==="
echo $i | egrep -q "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"
if [ $? -eq 0 ]; then
echo $i
else
host -t A $i | grep address | awk '{print $4}'| sort
fi
done