Skip to content

Instantly share code, notes, and snippets.

View oliveratgithub's full-sized avatar

Oliver oliveratgithub

View GitHub Profile
@oliveratgithub
oliveratgithub / readme.md
Created December 11, 2018 10:20
Moving a Git repository from BitBucket to GitHub

Pre-requisites

A new, empty Git Repository has to be created on GitHub.com (do not initialize it with a Readme or alike, when asked!)

How-to migrate Git Repository to GitHub

$ cd /path/to/project
$ git remote add upstream https://github.com/[account]/[repository].git
$ git push upstream master
$ git push --tags upstream
@oliveratgithub
oliveratgithub / readme.md
Created January 4, 2019 08:44
Configure the PHP CLI in macOS to use MAMP PHP binaries

Pre-requisites

Find MAMP's installed PHP version(s) you want to use the PHP CLI for:

$ ls -l /Applications/MAMP/bin/php/

Configure PHP CLI in macOS to use MAMP's PHP

  1. First, open your local user's .bash_profile in edit mode, in order to add aliases for accessing the PHP CLI locally
$ pico ~/.bash_profile
@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 / my.cnf
Created September 27, 2019 21:23
MAMP MySQL 5.7 disable strict mode. Add file to /MAMP/conf/
[client]
#socket = /Applications/MAMP/tmp/mysql/mysql.sock
[mysqld]
max_allowed_packet = 64M
table_open_cache = 2000
sql_mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
@oliveratgithub
oliveratgithub / unix-aws-ses-testmail.txt
Created December 13, 2019 15:37
SMTP test email using AWS Simple Email Service (SES) on UNIX openssl s_client or Windows PowerShell
# Source: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-smtp-client-command-line.html
# X-SES-CONFIGURATION-SET is optional
EHLO yourdomain.com
AUTH LOGIN
base64 encoded Smtp Username
base64 encoded Smtp Password
MAIL FROM: from@yourdomain.com
RCPT TO: email@anydomain.com
DATA
#X-SES-CONFIGURATION-SET: YourSESConfigSet
@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 / socialnetworkimagesizes.js
Last active May 9, 2023 07:11
Social media networks image sizes as JSON and JavaScript lists – Contains image sizes for all major social networks and messengers as of 2020 (Facebook, Twitter, Instagram, Tik Tok, Telegram, WhatsApp, and more)
let socialnetworkimagesizes = {
'facebook': {
'profile': {
'Profile picture': { 'w': 180, 'h': 180 }
,'Cover photo': { 'w': 820, 'h': 312 }
}
,'content': {
'Timeline image': { 'w': 1200, 'h': 630 }
,'Highlighted image': { 'w': 1200, 'h': 717 }
,'Link - rectangular': { 'w': 1200, 'h': 628 }
@oliveratgithub
oliveratgithub / botconfigs.py
Last active December 21, 2022 01:33
Bot script for Telegram Messenger to publish stock market price updates - Python 3.x compatible and can run as a nohup service
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ~~~~~
# Telegram Bot API configs for stock_notifications.py
# ~~~~~
token=''
chat=''
@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 / 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…