Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Dietrich Rordorf rordi

🎯
Focusing
View GitHub Profile
@rordi
rordi / git-commit.md
Last active Sep 16, 2020
Commands to get basic info about a git commit
View git-commit.md

Commands to get basic info about a git commit

  • Deploy Timestamp: date +"%Y-%m-%d %H:%M:%S"
  • Git Repo: basename `git rev-parse --show-toplevel`
  • Git Branch: git rev-parse --abbrev-ref HEAD
  • Git Commit Long Hash: git rev-parse HEAD
  • Git Commit Short Hash: git rev-parse --short HEAD
@rordi
rordi / config.user.inc.php
Last active Jun 23, 2021
Configuration hardening for PhpMyAdmin
View config.user.inc.php
<?php
/**
* Configuration hardening for PhpMyAdmin
*
* This file is included at the end of the main PhpMyAdmin configuration file. We thus here override
* any potential config value that was previously set.
*
* @author Dietrich Rordorf
* @date 2018-11-05
* @see https://docs.phpmyadmin.net/en/latest/config.html
@rordi
rordi / root-password-MariaDB-docker-compose.md
Last active Dec 2, 2021
Change root password in MariaDB Docker container running with docker-compose
View root-password-MariaDB-docker-compose.md

Change root password in MariaDB Docker container running with docker-compose

Override the entrypoint in docker-compose.yml for the MariaDB Docker container by adding:

entrypoint: mysqld_safe --skip-grant-tables --user=mysql

The start up the Docker Compose stack:

$> docker-compose up -d
View mysql-cheatlist.md

MariaDB / MySQL Cheatlist

Import a dump file:

mysql -u userName --password=yourSecret dbName < ./path/to/dump.sql

Run command non-interactive:

mysql -u userName --pasword=yourSecret dbName -e 'SELECT * FROM my_table;'
@rordi
rordi / Operator-Mono-Dark-patched-didi.itermcolors
Created Aug 28, 2019
patched Operator Mono Dark colors for iterm
View Operator-Mono-Dark-patched-didi.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.35364818572998047</real>
@rordi
rordi / selenium-chrome-options.js
Last active Aug 20, 2019
Javascript Selenium Web Driver with Chrome Options
View selenium-chrome-options.js
const {Builder, By, Capabilities} = require('selenium-webdriver');
let chromeCapabilities = Capabilities.chrome();
let chromeOptions = {
'args': ['--test-type', '--headles', '--incognito', '--window-size=340,750'] // approx. size of an iPhone 5/SE
};
// "chromeOptions" was changed to "goog:chromeOptions" at some point...
chromeCapabilities.set('goog:chromeOptions', chromeOptions);
@rordi
rordi / hugo-prev-next-navigation-custom-section.order.md
Last active Apr 18, 2021
Previous / Next Navigation in Hugo with custom section order
View hugo-prev-next-navigation-custom-section.order.md

Previous/Next navigation in Hugo with custom order based on param / attribute

This gist let's you return previous/next pages based on a frontmatter parameter in Hugo. In this exmaple, the frontmatter parameter is called position, where lower positions come first.

This prev / next navigation is looping: if there is no "next >" entry anymore, the first entry of the collection will be linked. Same for "< prev": if there is no previous element, the last element of the collection will be linked.

<div class="nav-prev-next">
    {{ $currentSection := (($.Site.GetPage "section" .Section).Pages.ByParam "position") }}
@rordi
rordi / wordpress-proxy.md
Last active Sep 16, 2021
Run Wordpress behind a proxy server (avoid assets being blocked)
View wordpress-proxy.md

Run Wordpress behind a proxy server (avoid assets being blocked)

Wordpress has issues to detect the SSL connection betwenn the client and the proxy and thus may load static assets through http instead https, which will be blocked in moderns browsers (mixed content).

To circumvent the problem, simly extend your wp-config.php by following functions (insert towards the top of the config script):

/** Proxy SSL detection */
View git-remove-large-files.md

Remove a large file from previous git commit / GitHub

E.g. when accidentally committing a large file to a git repo and GitHub refises the commit.

git filter-branch --tree-filter 'rm -f path/to/large/file' HEAD

Afterwards, simply try to push to GitHub again...

@rordi
rordi / phpdoc.md
Last active Sep 26, 2018
Generate PhpDoc Documentation with Docker
View phpdoc.md

Easily create a PhpDoc documentation with this Docker container

Use following command from withint the root directory of your PHP project to create the PhpDocs in the ./docs subfolder of the project root. You may want to include only a ./src (Symfony) or ./app (Silex) subfolders in the analysis (do not run the documentator on the ./vendors folder):

docker run --rm -v $(pwd):/app instrumentisto/phpdoc -d /app -t ./docs