Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Michele Venturi dardo82

🏠
Working from home
View GitHub Profile
@dardo82
dardo82 / mac-askpass.sh
Last active Nov 27, 2021
OSX sudo helper
View mac-askpass.sh
#!/bin/sh
BIN="/usr/local/bin/askpass"; touch $BIN; chmod 755 $BIN
security add-generic-password -a $USER -s login -T "" -w
echo "#!/bin/sh\\nsecurity find-generic-password -a $USER -s login -w" > $BIN
echo "\\n# Set sudo helper.\\nexport SUDO_ASKPASS=$BIN" >> ~/.${SHELL##/*/}rc
@dardo82
dardo82 / safari-favicons.sh
Last active Nov 23, 2021
Fix Safari FavIcons
View safari-favicons.sh
#!/bin/zsh
# Fix Safari Favorites Icons
CS="cache_settings"; TIC="Touch Icons Cache"; DIR="$HOME/Library/Safari/$TIC/Images"
DB="$DIR/../${${TIC// }%%s*}${${(C)CS}//_}.db"; SQL=$(sqlite3 "$DB" "SELECT host FROM $CS")
sqlite3 "$DB" "UPDATE $CS SET ${${${(L)TIC// /_}#*_}//s/_is_in}=1, download_status_flags=1"
for png in "$1"/*.png; do URL="$(plutil -convert xml1 -o - "$DIR/../../Bookmarks.plist" | \
awk -F '[</>]' -v name="${${png##*/}%%.*}" '$3~name{getline;getline;getline;print $5}')"; \
cp -f -v "$png" "$DIR/${(U)$(md5 -q -s $URL)}.png"; done; chflags -v uappnd $DIR $DB*
@dardo82
dardo82 / 9d-cf.py
Last active Mar 17, 2021
WebDriver DiceBot BitCoin
View 9d-cf.py
#!/usr/bin/env python
# 999dice.com claim faucet
import sys
import time
from selenium import webdriver as WD
from selenium.webdriver.common.by import By
@dardo82
dardo82 / config
Last active Mar 12, 2021
MPV configuration
View config
[default]
pause
keep-open
fullscreen
geometry=0:0
hwdec=vaapi
framedrop=vo
@dardo82
dardo82 / RTV38-dl.sh
Last active Mar 8, 2021
Save $1 secs of RTV38 stream
View RTV38-dl.sh
#! /bin/sh
# Saves a given number of seconds of the RTV38 live stream.
PLURL="http://streamcdng18-845d8509d2cb4f249dd0b2ae5755b6c2.msvdn.net/live/S12268608/CXHH7K39hg9K/playlist.m3u8"
DATE="$(date +%F)"; timeout -15 $1 youtube-dl -o $DATE $PLURL; mv -v $DATE.{part,mp4}
View com.zerowidth.launched.icdc.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.zerowidth.launched.icdc</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
View UnTwitch-dl.sh
#!/bin/sh
CHANNEL="$1"
PHPSESSID="$(curl -s -I "https://untwitch.com/" \
| gawk -F '=|;' '/PHPSESSID/{print $2}')"
VIDEOID="$(curl -s "https://twitchrss.appspot.com/vod/$CHANNEL" \
| gawk -v RS='<|>' -v FS='/' '/\/videos\//{print $5; exit}')"
URL="twitch.tv%2Fvideos%2F$VIDEOID&format=Audio_Only&from=1&to=150"
curl -L "https://untwitch.com/" -d "url=$URL" -H "Cookie: PHPSESSID=$PHPSESSID" -o "$VIDEOID.mp4"
View InfoJobs.applescript
#!/usr/bin/env osascript
# Apply to InfoJobs offers.
tell application "Google Chrome" to ¬
tell front window's active tab to ¬
execute javascript ¬
"document.getElementById" & ¬
"('botonEnviar').click();"
@dardo82
dardo82 / ich.applescript
Created Dec 7, 2020
Import Chrome History
View ich.applescript
#!/usr/bin/env osascript
# Import Chrome History
tell application "Safari" to activate
tell application "System Events"
keystroke "i" using {option down, command down}
key code {49, 48, 48, 49}
keystroke return
end tell
@dardo82
dardo82 / .zshrc
Last active Oct 15, 2020
ZSH configuration
View .zshrc
#!/bin/zsh
# ZSH conf
# Set history options.
export HISTFILE="$HOME/.zsh_history"
export HISTSIZE="$[2**(2**(2**2))]"
export SAVEHIST="$[2**(2**(2**2))]"