Skip to content

Instantly share code, notes, and snippets.

@assafmo
assafmo / ad7.js
Last active March 21, 2022 06:31
Donwload english subs from addic7ed
#!/usr/bin/env node
// Newest version is in https://github.com/assafmo/ad7
// Install: sudo npm install -g addic7ed-api
// Usage: node ad7.js "the flash" 4 8
// Usage 2: chmod +x ad7.js; ./ad7.js "the flash" 4 8
// Usage 3: chmod +x ad7.js; mv ad7.js /usr/local/bin/ad7; ad7 "the flash" 4 8
// Usage 4: seq 1 4 | xargs -n 1 ad7 "the flash" 4
@assafmo
assafmo / 0_scaling_governor_performance.sh
Last active May 15, 2019 10:22
Set scaling governor to performance, set noatime in root filesystem, install preload
#!/bin/sh
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
@assafmo
assafmo / mac.conf
Created December 4, 2017 18:11
Randomize MAC on each new network connection
# Put in /etc/NetworkManager/conf.d/mac.conf
[device]
wifi.scan-rand-mac-address=yes
[connection]
wifi.cloned-mac-address=random
ethernet.cloned-mac-address=random
@assafmo
assafmo / aria2-inorder.conf
Last active December 21, 2017 20:11
aria2c conf files
# To download video/music files
# Put in ~/.aria2/aria2-inorder.conf
# Usage: aria2c --conf-path ~/.aria2/aria2-inorder.conf "$URL"
continue=true
split=8
max-connection-per-server=8
min-split-size=1M
stream-piece-selector=inorder
@assafmo
assafmo / espn_nba_scoreboard_to_mp4.sh
Last active November 4, 2017 14:09
ESPN NBA scoreboard page to highlights mp4
#!/bin/bash
curl 'http://www.espn.com/nba/scoreboard' --compressed -s | \
grep -Eo '\{"leagues.+}' | \
jq -r '.events | '\
'map(.competitions | '\
'map(.headlines | '\
'map(.video | '\
'map(if .tracking.coverageType == "Final Game Highlight" then '\
'.links.source.HD.href else empty end))))[][][][]' 2> /dev/null
@assafmo
assafmo / check_street_view.sh
Last active January 3, 2019 12:48
Check if google street view is available for GPS coordinates (radius 100m)
#!/bin/sh
lat=$1
long=$2
ans=$(curl "https://maps.googleapis.com/maps/api/js/GeoPhotoService.SingleImageSearch?pb=!1m5!1sapiv3!5sUS!11m2!1m1!1b0!2m4!1m2!3d$lat!4d$long!2d100!3m18!2m2!1sen!2sUS!9m1!1e2!11m12!1m3!1e2!2b1!3e2!1m3!1e3!2b1!3e2!1m3!1e10!2b1!3e2!4m6!1e1!1e2!1e3!1e4!1e8!1e6&callback=_xdc_._2kz7bz" \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/59.0.3071.109 Chrome/59.0.3071.109 Safari/537.36' \
-s --compressed | \
grep -o "Search returned no images")
if [[ -z "$ans" ]]; then
@assafmo
assafmo / imdb.sh
Last active January 14, 2018 10:18
Download and unzip subtitles from wizdom.xyz (also script to get imdb_id from show/movie name)
#!/bin/sh
name="$1"
curl -s --compressed "https://duckduckgo.com/?q=%5Cimdb $name" | grep -oP 'tt[0-9]+' | head -1
@assafmo
assafmo / virustotal.sh
Last active October 30, 2018 23:31
Query VirusTotal.com for malicious sha256 / sha1 / md5
#!/bin/sh
hash="$1"
curl "https://www.virustotal.com/ui/files/$hash" \
-H 'dnt: 1' \
-H 'accept-encoding: gzip, deflate, br' \
-H 'accept-language: en-US,en;q=0.8' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36' \
-H 'accept: application/json' \
@assafmo
assafmo / reshet.tv-to-mp4.sh
Last active March 12, 2019 15:37
reshet.tv page to mp4
#!/bin/bash
curl -s --compressed "$1" | grep -Po 'src":"http.+?.mp4"' | tr -d '\\' | awk -F '"' '{print $3}' | sort -u
@assafmo
assafmo / download_rtsp.sh
Last active July 23, 2024 08:42
Download RTSP stream to local file
#!/bin/bash
RTSP_ADRESS="$1"
OUTPUT_FILE_NAME=$(echo "$RTSP_ADRESS" | awk -F '/' '{print $(NF)}')
ffmpeg -y -i $RTSP_ADRESS -acodec copy -vcodec copy $OUTPUT_FILE_NAME