This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extract () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) rar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; | |
*.tbz2) tar xjf $1 ;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# This script downloads the latest stable version of the `selenium-manager` binary | |
# for Linux (AMD64) from `https://github.com/SeleniumHQ/selenium_manager_artifacts/releases` | |
# | |
# When you run this script, it will download the binary to the current working directory. | |
if [ ! "$(uname -s)" == "Linux" ]; then | |
echo "this script only works on Linux" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# This script downloads the latest stable version of the `selenium-manager` binary | |
# for Linux (AMD64) from `https://github.com/SeleniumHQ/selenium_manager_artifacts/releases` | |
# | |
# Before running this script, you should have the selenium repo cloned locally: | |
# $ git clone --filter=blob:none [email protected]:SeleniumHQ/selenium.git | |
# | |
# Make sure to set the `SELENIUM_HOME` variable below to match the repo's base directory. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
# add one of these logging configurations to your selenium script to enable logging. | |
# 6 logger levels are supported: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET. | |
# (default is WARNING) | |
# enable DEBUG logging to console for all modules globally (selenium, urllib3, etc) | |
logging.basicConfig(level=logging.DEBUG) | |
# enable DEBUG logging to console for selenium module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
HOST = '127.0.0.1' | |
PORT = 65432 | |
COMMAND = 'whoami' | |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
print('connecting to: {HOST}:{PORT}') | |
s.connect((HOST, PORT)) | |
print(f'sending command: {command}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## scan music library and create M3U playlists | |
# example shell commands: | |
# 500 random MP3's | |
find /path/to/music -type f -iname "*.mp3" | shuf | head -n 500 > 500_playlist.m3u | |
# All MP3's and FLAC's, sorted | |
find /path/to/music -type f \( -iname '*.mp3' -o -iname '*.flac' \) | sort > full_playlist.m3u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# skip to next track on Squeezebox player via SlimServer/LogitechMediaServer | |
SQUEEZEBOX_SERVER='localhost:9000' # server host:port | |
SQUEEZEBOX_PLAYER='00:05:11:23:82:6e' # player MAC address | |
next () { | |
curl -sS -o /dev/null -X POST \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rename files in current directory with digits stripped from filenames | |
# first do a dry-run (only print the commands that will be applied) | |
for f in *; do echo mv "$f" $(printf '%s' "$f" | tr -d '0123456789'); done | |
# run it for real (modifications done in-place) | |
for f in *; do mv "$f" $(printf '%s' "$f" | tr -d '0123456789'); done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
unpacked_extension_path = '/path/to/unpacked/extension/' | |
options = Options() | |
options.add_argument('--load-extension={}'.format(unpacked_extension_path)) | |
driver = webdriver.Chrome(options=options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
packed_extension_path = '/path/to/packed/extension.crx' | |
options = Options() | |
options.add_extension(packed_extension_path) | |
driver = webdriver.Chrome(options=options) |
NewerOlder