Skip to content

Instantly share code, notes, and snippets.

View oliveratgithub's full-sized avatar

Oliver oliveratgithub

View GitHub Profile
@oliveratgithub
oliveratgithub / prettyearthimage.html
Last active May 12, 2020 04:05
Google Pretty Earth: Random Image Link Generator (HTML)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Google Pretty Earth - Random Image Link</title>
</head>
<body onload="printRandomPrettyearthLink()"><body>
<script>
var prettyearthImage = '';
var prettyearthBaseUrl = 'https://www.gstatic.com/prettyearth/assets/full/';
@oliveratgithub
oliveratgithub / ddns_updater.py
Created November 3, 2015 23:47
TwoDNS.de / Two-DNS.de automatic Dynamics DNS updater using HTTP API calls (works with any other DDNS Service, allowing IP updates via HTTP API calls)
#!/usr/bin/env python
# encoding: utf-8
import subprocess, string, json, urllib
# DISABLED: import httplib, base64
"""
In order to run this Python script, make it executable first using:
chmod +x <filename>.py
And then run it using
@oliveratgithub
oliveratgithub / batch change filename to lowercase.ps1
Created December 18, 2019 12:30
Batch file rename using PowerShell on Windows: add filename prefix, change file name to all lowercase, and so on.
<# Batch change all PDF file names to lowercase letters within a specific directory #>
dir C:\PATH\TO\FOLDER\*.pdf | Rename-Item -NewName {$_.Name.ToLower()}
@oliveratgithub
oliveratgithub / mamp-sql-dump-export.sh
Created January 6, 2017 20:42
MAMP MySQL dump export using Terminal.app in macOS
$ cd /Applications/MAMP/Library/bin/
$ ./mysqldump --host=localhost -uroot -proot source_database > ~/Desktop/database_name-dump.sql
@oliveratgithub
oliveratgithub / alternate-hreflang.html
Last active May 10, 2021 20:57
International targeting SEO code snippets – Sitecore Symposium 2018 Handout. Sources: https://www.sitemaps.org/protocol.html and https://support.google.com/webmasters/answer/189077?hl=en
<link rel="alternate" hreflang="x-default" href="https://www.mysite.com/" />
<link rel="alternate" hreflang="de" href="https://www.mysite.com/de-de" />
<link rel="alternate" hreflang="en" href="https://www.mysite.com/en-de" />
<link rel="alternate" hreflang="es" href="https://www.mysite.com/es-es" />
<link rel="alternate" hreflang="fr" href="https://www.mysite.com/fr-fr" />
<link rel="alternate" hreflang="zh" href="https://www.mysite.com/zh-cn" />
<link rel="alternate" hreflang="zh-CN" href="https://www.mysite.com/zh-cn" />
<link rel="alternate" hreflang="en-US" href="https://www.mysite.com/en-us" />
<link rel="alternate" hreflang="de-DE" href="https://www.mysite.com/de-de" />
<link rel="alternate" hreflang="en-DE" href="https://www.mysite.com/en-de" />
@oliveratgithub
oliveratgithub / seo_meta.php
Last active May 10, 2021 20:57
PHP Regex to output SEO optimized «meta title» and «meta description» with valid characters only and utf8 support
<?php
/** Raw content input */
$title = 'Begriff "Test"; zu weiteren gleichnamigen Bedeutungen siehe Test <Begriffsklärung>';
$description = 'Das Wort „Test“ kommt vom altfranzösischen test: Tiegel‚ Topf für alchemistische Versuche bzw. lateinisch testum, zu: testa = Platte, Deckel; (Ton)schale, Scherbe.';
/** SEO friendly content */
$seo_allowed_chars_pattern = '([^\w\s\p{L}.,;:!?\-\/\(\)\[\]…«»#@])';
$meta_title = mb_ereg_replace($seo_allowed_chars_pattern, '', $title);
$meta_description = mb_ereg_replace($seo_allowed_chars_pattern, '', $description);
/**
@oliveratgithub
oliveratgithub / ddns_updater.sh
Created November 5, 2015 14:28
Automatic Dynamics DNS updater using HTTP API calls, prepared for TwoDNS.de / Two-DNS.de (works with any other DDNS Service, allowing IP updates via HTTP API calls)
#!/bin/sh
log="ddns_updater.log.txt"
my_ext_ip=$(curl -sS http://icanhazip.com)
echo "\n\n\n===== \
\n$(date -u) \
\nUpdating IP to: $my_ext_ip \n" >> $log
curl -isSX PUT \
-u "mail@host.tld:api_token" \
-H "Content-Type: application/json" \
--data '{"ip_address":"'$my_ext_ip'", "activate_wildcard": "false"}' \
@oliveratgithub
oliveratgithub / .htaccess
Created August 8, 2021 18:11
A very simple .htaccess pretty URL rewrite for Apache2 HTTP Server
RewriteEngine On
RewriteRule ^([\w-]+)(?:\.html|/)?$ $1.html [NC,QSA,L]
# Makes something like "website.com/abc123" => work by delivering the file "/abc123.html"
@oliveratgithub
oliveratgithub / autoexec.cfg
Last active September 11, 2021 09:23
ioQuake3 – custom high definition configurations for best visual quality (Quake 3, Quake III Arena). This config file is featured on https://swissmacuser.ch/how-you-want-to-run-quake-iii-arena-in-2018-with-high-definition-graphics-120-fps-on-5k-resolution/
seta r_mode "-1"
seta r_customwidth "5120"
seta r_customheight "2880"
seta cg_fov "115"
seta cg_gunCorrectFOV "1"
seta cl_renderer "opengl2"
seta r_allowSoftwareGL "0"
seta r_ignoreGLErrors "1"
seta r_smp "1"
seta r_displayrefresh "0"
@oliveratgithub
oliveratgithub / howto.md
Last active May 20, 2022 13:53
Sauna Stats Grabber: Sauna - Seebad Enge (https://www.seebadenge.ch/wp/sauna)

Sauna Stats Grabber

Sauna - Seebad Enge

Pre-requisites

Python version

python3

Python dependencies

sudo apt-get install python3-bs4 or…