Skip to content

Instantly share code, notes, and snippets.

@assafmo
assafmo / couchimport-jq-json-zip.sh
Last active March 16, 2022 23:42
Import an archive full of JSONs into CouchDB
#!/bin/bash
#json per line (same result, but for example can use jq to set _id)
7z x -so $1 | jq -c . | couchimport --db mydb --type jsonl
@assafmo
assafmo / .zshrc
Last active November 3, 2017 10:40
.zshrc additions
alias update="sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y"
alias h="history"
alias hs="history | grep -i"
alias gs='git status'
alias ga='git add -A'
alias gc='git commit -m'
alias gp='git push'
alias subs="addic7ed -l en --no-hi"
@assafmo
assafmo / keybindings.json
Last active September 25, 2017 20:34
vscode settings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+d",
"command": "editor.action.deleteLines",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+f",
"command": "editor.action.formatDocument",
@assafmo
assafmo / ext4-performance.md
Last active February 11, 2018 13:32
Tune ext4 for performance

Adjust ext4 for performance

Mount options

errors=remount-ro,noatime,nouser_xattr,barrier=0

Journal

Check if exists

sudo tune2fs -l /dev/sdXY | fgrep has_journal

Turn Off/On

@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
@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 / 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 / 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 / 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 / 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