Skip to content

Instantly share code, notes, and snippets.

View thedava's full-sized avatar

David S. thedava

View GitHub Profile
@thedava
thedava / thumbnails.sh
Last active February 6, 2024 00:18
Create thumbnails for all video files in directory using ezthumb
#!/usr/bin/env bash
# https://sourceforge.net/projects/ezthumb/
function create_thumbnail {
ext="$1"
find . -type f -name "*.${ext}" -printf '%h\0' | sort -zu | while IFS= read -r -d '' dir; do
ezthumb --grid 8x5 --format "jpg@99" "${dir}/*.${ext}"
#echo "${dir}/*.${ext}"
@thedava
thedava / pi-hole-whitelist.md
Created May 26, 2021 17:57
pi-hole Whitelist

My personal pi-hole whitelist

Amazon

  • Amazon Alexa: ^device-metrics-us(\-\d)?.amazon.com$
  • Amazon App Authorization Api: ^fls-(\w{2}).amazon.com$
  • Amazon Mobile Associates Api: ^mas-(\w{3}).amazon.com$
@thedava
thedava / dos2unix.sh
Last active November 13, 2020 21:37
Convert line endings to LF
find . \
-name "*.conf" \
-o -name "Dockerfile" \
-o -name ".dockerignore" \
-o -name ".gitignore" \
-o -name ".gitkeep" \
-o -name "*Jenkinsfile" \
-o -name "*.js" \
-o -name "*.json" \
-o -name "*.lock" \
@thedava
thedava / bench.php
Created October 21, 2020 17:06
Extremely simple php benchmark
<?php
$benchMark = new class() {
const MEASUREMENT_BLOCKS = 20;
const ITERATIONS = 100000;
private function variant1(): void
{
// Implement variant 1 here
}
@thedava
thedava / docker-compose.yml
Created March 19, 2020 19:59
Example docker-compose file for BOINC client
version: '2'
services:
boinc:
image: boinc/client
container_name: boinc
restart: always
network_mode: host
pid: host
volumes:
- boinc:/var/lib/boinc
@thedava
thedava / JwtUtils.php
Last active November 4, 2018 20:49
PHP JWT example
<?php
use \DateTime;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Parser;
use Lcobucci\JWT\Signer\Hmac\Sha512;
use Lcobucci\JWT\Signer\Key;
use Lcobucci\JWT\ValidationData;
class JwtUtils
<?php
namespace Games\Game\Planetbase;
use Wa72\HtmlPageDom\HtmlPageCrawler;
/**
* @see https://games-blog.de/planetbase-cheats/4566/
*/
class CheatManager
@thedava
thedava / clean.sh
Created January 6, 2018 23:51
Linux system cleaning
#!/bin/bash
# Check for root
if [[ "$(id -u)" != "0" ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Remove old kernels
apt autoremove
@thedava
thedava / IconArchiveDownloaderCommand.php
Created August 19, 2017 20:48
Download all icon s from a iconset of iconarchive.com
<?php
namespace Application\Console\Command\Remote;
use DavaHome\Console\Command\AbstractCommand;
use GuzzleHttp\Client;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DomCrawler\Crawler;
@thedava
thedava / watch.sh
Created May 26, 2017 13:33
Watch a directory for new files
#!/usr/bin/env bash
# https://unix.stackexchange.com/a/249238
echo "Start watching for new files"
> watch.log
while true
do
touch watch.log
sleep 10
find . -type f -cnewer ./watch.log | tee -a watch.log