Skip to content

Instantly share code, notes, and snippets.

@assafmo
assafmo / download_rtsp.sh
Last active September 7, 2017 19:13
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 / 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 / .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 / 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 / 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 / fix_firefox_double_icon.sh
Created December 18, 2017 20:05
Fix firefox nighlty double icon in gnome favorites
#!/bin/sh
grep StartupWMClass /usr/share/applications/firefox-trunk.desktop || sudo sed -i 's/\[Desktop Entry\]/[Desktop Entry]\nStartupWMClass=Nightly/' /usr/share/applications/firefox-trunk.desktop
@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 / 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 / nba_com_gamerecaps_to_mp4.sh
Last active January 14, 2018 10:32
NBA.com gamerecaps page to highlights mp4
#!/bin/bash
nba_date=$( \
curl 'https://data.nba.net/10s/prod/v3/today.json' --compressed -s | \
jq .links.anchorDate \
)
num_of_games=$( \
curl 'https://data.nba.net/prod/v2/calendar.json' --compressed -s | \
jq ".[$nba_date]" \
@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