Skip to content

Instantly share code, notes, and snippets.

View kronthto's full-sized avatar

Tobias Kronthaler kronthto

View GitHub Profile
@kronthto
kronthto / scroll_img_replace_anim.html
Created January 9, 2022 10:55
Replace background-image based on scroll position to make an animation/growing effect during scrolling while element is visible
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
@kronthto
kronthto / parallex_tests_demos.html
Last active January 9, 2022 10:56
HTML CSS Parallax Div without scrolllistener
<body>
<div style="max-width: 800px;margin: 0 auto;">
<div style="background-color: gray;height:1000px;z-index:2;position:relative;"></div>
<div class="paracontainer">
<div class="fixc" style="position:fixed;width:100%;max-width: 800px;top:400px;z-index:1;overflow-y:auto;max-height:100vh">
<div class="inner" style="z-index:1;height:600px;">
<h1>Jetzt neu</h1>
@kronthto
kronthto / dns-challenge.sh
Created August 20, 2021 17:58
certbot DNS challenge nsupdate
#!/bin/bash
# use with: manual_auth_hook = /usr/local/sbin/dns-challenge.sh
if [ -z "$CERTBOT_DOMAIN" ] || [ -z "$CERTBOT_VALIDATION" ]
then
echo "EMPTY DOMAIN OR VALIDATION"
exit -1
fi
@kronthto
kronthto / omitexparser.php
Last active April 8, 2019 21:16
[deprecated] Parses an AceOnline omi.tex file - writes Itemlist as ID,Name,IconID CSV
<?php
// Use https://github.com/kronthto/ao-archive/blob/master/src/Omi/Reader/OmiReader.php for actual/complete parsing of omi.tex
// The approach below was a poor try because I didn't understand the fileformat
$filename = 'D:\Games\Ace\Ace Online War Of The Sky\Res-Tex\omi.tex';
$handle = fopen($filename, 'rb');
$parts = [];
@kronthto
kronthto / queens.php
Created August 19, 2018 13:42
N-Queens PHP
<?php
class Field
{
public $x;
public $y;
public function __construct(int $x, int $y)
{
$this->x = $x;
@kronthto
kronthto / useful_snippets
Last active February 5, 2018 09:02
Useful commands/configs I use from time to time and would have to google them together everytime if I wouldn't write them down here
# Extract a single database from an all-databases gzipped dump
gunzip -c mysql_dump_all_dbs.sql.gz | sed -n '/^-- Current Database: `dbimlookingfor`/,/^-- Current Database: `/p' > dbimlookingfor.sql
# https://stackoverflow.com/a/1013956/7362396
# Skim tables from a huge mysql db dump (thanks https://stackoverflow.com/a/26379517/7362396)
sed -r '/INSERT INTO `(geocoding_ips|GeoPC_Places_URL|cachetags|cache_render)`/d' dump.sql > dump_skimmed.sql
# Apache2: 410 Gone a site
RewriteEngine on
RewriteRule ^.*$ - [G,L]
@kronthto
kronthto / apery.php
Last active May 8, 2017 14:23
Approx. of Apéry's constant = ζ(3) inspired by https://youtu.be/ur-iLy4z3QE
<?php
// Will select random numbers from [1,MAX_NUM]
const MAX_NUM = 20000;
// Will build and check SAMPLES triplets
const SAMPLES = 2500000;
/** @var int[]|array $factorCacheMap */
$factorCacheMap = [];
@kronthto
kronthto / ssl-cert-check
Created April 8, 2017 21:34
Script for listing soon expiring x509 SSL certs
#!/bin/bash
set -u
DAYS=30
BACKDAYS=5
CERTDIR=/etc/ssl/private/
backinform=$(date -d "$BACKDAYS days ago" +%s)