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 enum import Enum | |
from selenium.webdriver import ChromeOptions, FirefoxProfile | |
class Browser(Enum): | |
CHROME = "chrome" | |
FIREFOX = "firefox" | |
IE = "ie" | |
PHANTOMJS = "phantomjs" |
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
# 1 - create syncthing jail | |
# 2 - add storage | |
# install bash and syncthing | |
pkg install bash | |
pkg install syncthing | |
# add syncthing user | |
``` |
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 python3 | |
# -*- coding: utf-8 -*- | |
"""Modified version of fetch function with semaphore created by: Paweł Miech | |
src: https://pawelmhm.github.io/asyncio/python/aiohttp/2016/04/22/asyncio-aiohttp.html | |
""" | |
import argparse | |
import asyncio | |
import sys | |
from argparse import Namespace | |
from asyncio import Semaphore |
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
sudo dnf install parallel | |
npm install pa11y pa11y-reporter-html | |
# the Perl expression {= s:[/\:\?\&\=]:-:g; =} will replace all special charachers '/:?&' in report filename with '-' | |
parallel 'pa11y --reporter=html {} > {= s:[/\:\?\&\=]:-:g; =}.html' < urls.txt |
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
function cheat() { | |
# ${1} - is the language/dmbs/etc | |
# ${*:2} - your query | |
# sed 's/ /+/g' - will replace spaces with `+` | |
curl https://cheat.sh/${1}/`echo "${*:2}" | sed 's/ /+/g'` | |
} | |
# example usage: | |
# cheat python recursion | |
# cheat python open files |
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
alias trim=trim | |
function trim() { | |
if [ "$#" != "3" ]; then | |
echo "Please provide all 3 arguments: 'filename start duration'" | |
return 1 | |
fi | |
video="${1}" | |
filename="${1%.*}" | |
extension="${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
alias stabilize=stabilize | |
function stabilize() { | |
type ffmpeg >/dev/null 2>&1 || { echo >&2 "ffmpeg is required but it's not installed."; return 1; } | |
video="${1}" | |
filename="${1%.*}" | |
extension="${1##*.}" | |
output="${filename}-stabilized.${extension}" | |
# calculate transformation vectors | |
ffmpeg -nostdin -hide_banner -i "${video}" -vf vidstabdetect=stepsize=6:shakiness=8:accuracy=15:result=transform_vectors.trf -f null - |
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/python | |
"""Extract links to music websites from Mastodon's outbox.json | |
outbox.json contains all of your toots | |
""" | |
import json | |
from bs4 import BeautifulSoup as Soup | |
def extract_music_urls(): | |
with open("outbox.json") as f: |
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 python3 | |
import os | |
import shutil | |
def what_is_inside(types) -> str: | |
result = "" | |
if "mp3" in types and "flac" in types: | |
result = "both" | |
if "mp3" in types and not "flac" in types: |