Skip to content

Instantly share code, notes, and snippets.

@pgampe
pgampe / cleanup.sh
Last active July 7, 2022 08:58
Reset WSL to environment
#!/usr/bin/env bash
# saner programming env: these switches turn some bugs into errors
set -o errexit -o pipefail -o noclobber -o nounset
# shellcheck disable=SC2043
for cmd in sudo hwclock sysctl tee grep awk tr powershell.exe; do
if ! command -v "${cmd}" &>/dev/null; then
echo "${cmd} could not be found"
exit 1
fi
@pgampe
pgampe / offlineimap_dot_slash.py
Last active February 14, 2017 15:07
Migrate offlineimap separator from point to slash by moving all folders
import os
os.chdir('/path/to/your/local/copy/here')
dirs = os.listdir()
dirs.sort(key=len, reverse=True)
i = 0
for org_dir in dirs:
if '.' not in org_dir:
@pgampe
pgampe / twrp.sh
Last active November 13, 2016 12:44 — forked from inhies/twrp.sh
Creates TWRP compatible backups over USB using ADB without any files ever touching your SD card.
#!/bin/bash
#
# Version 1.4
#
# twrp.sh -- a TWRP compatible backup script for your computer
# Brought to you by inhies
#
# This script creates TWRP compatible backups over usb using adb and magikz
# By default it makes a folder in the standard TWRP date--time format (I think)
# To restore these backups, place the folder in /sdcard/TWRP/BACKUPS/<serialnumber>/
@pgampe
pgampe / 0_notes.md
Last active April 20, 2016 19:30
TYPO3 Acceptance tests

Make sure to know your path the the PHP 7 cli executable. Mine is /usr/local/bin/php You will need to adopt the prepare scripts accordingly!

Call in this order:

  • test-prepare.sh
  • test-phantomjs.sh
  • test-firefox.sh
  • test-stop.sh
@pgampe
pgampe / test_cert.php
Last active April 8, 2016 18:35
Test TLS Support by PHP
<?php
error_reporting(E_ALL);
echo '<html><head><title>Test cURL with TLS</title></head><body><pre>';
$fp = fopen("/dev/null", "w");
$output = fopen('php://output', 'rw');
$ch = curl_init();
@pgampe
pgampe / menu.ts
Last active August 4, 2020 12:51
Fully cached menu with TypoScript
page.10 >
page.10 = COA
page.10 {
cache {
key = main-menu
}
10 = TEXT
10 {
#!/bin/bash
AUTHOR="$1"
MKTEMP=$(which mktemp)
if [[ -n $MKTEMP ]]; then
TEMP1=$($MKTEMP)
TEMP2=$($MKTEMP)
else
TEMP1="/tmp/$(basename $0).$$.tmp"
@pgampe
pgampe / test.php
Created November 23, 2013 13:18
is_null($var) vs $var === NULL testing
<?php
$varNull = NULL;
$varNotNull = 0;
$i = 0;
$start = microtime(TRUE);
for ($i = 0; $i === 10000000; $i++) {
if (is_null($varNull)) {
$ composer.phar show -i
composer/installers dev-master d792632 A multi-framework Composer library installer
doctrine/annotations v1.1.2 Docblock Annotations Parser
doctrine/cache v1.3.0 Caching library offering an object-oriented API for many cache back...
doctrine/collections dev-master bcb5377 Collections Abstraction library
doctrine/common 2.4.x-dev c94d6ff Common Library for Doctrine projects
doctrine/dbal 2.3.x-dev 59c310b Database Abstraction Layer
doctrine/inflector dev-master 8b4b3cc Common String Manipulations with regard to casing and singular/plur...
doctrine/lexer dev-master bc0e1f0 Base library for a lexer that can be used in Top-Down, Recursive De...
doctrine/migrations dev-master 90f5c39 Database Schema migrations using Doctrine DBAL
@pgampe
pgampe / .gource
Created August 9, 2013 19:52
Render videos of a git repository. This is my config for TYPO3 CMS 4.6. The perl script for fetching the avatar images might be broken. It is not really needed. And it does store all images as PNG files, but some of them are JPEGs...
[display]
#fullscreen=true
#viewport=1680x1050
viewport=1280x720
[gource]
camera-mode=overview
colour-images=true
file-idle-time=5
hide=filenames,dirnames,mouse,progress,date