Skip to content

Instantly share code, notes, and snippets.

@Bonno
Bonno / stripspaces.sh
Created February 10, 2015 09:47
Replace spaces in all files in given location
if [ -n "$1" ]
then
if [ -d "$1" ]
then
cd "$1"
else
echo invalid directory
exit
fi
fi
@Bonno
Bonno / rotate-wallpaper.scpt
Last active June 20, 2018 11:02
To use in cron or other trigger.
(*
Script by Bonno Nachtegaal-Karels, June 2014
Based on OS-X-Wallpaper-Changer (https://github.com/pipwerks/OS-X-Wallpaper-Changer) by Philip Hutchison
This script assumes:
1. You have a folder named "Wallpapers" in your Pictures folder or somewhere else depending on the setting below
2. You have images inside each folder
@Bonno
Bonno / delete_files
Last active August 29, 2015 14:17
Delete Directory and Files In Directory
<?php
/*
* PHP delete function that deals with directories recursively
* Snippet from http://www.paulund.co.uk/php-delete-directory-and-files-in-directory
*
* @author Paulund http://www.paulund.co.uk/
* @author Lewis Cowles
*/
function delete_files($target) {
if(is_dir($target)){
@Bonno
Bonno / keybase.md
Created April 13, 2015 08:19
My Keybase identity

Keybase proof

I hereby claim:

  • I am Bonno on github.
  • I am bonno (https://keybase.io/bonno) on keybase.
  • I have a public key whose fingerprint is 18D4 7BEA 569A E077 8C67 CC1C 7832 7EFB DF6C 99DF

To claim this, I am signing this object:

@Bonno
Bonno / format-xml
Created June 10, 2015 07:13
Pretty format XML
tidy -xml -i your-file.xml > output.xml
@see http://stackoverflow.com/a/26327336
@Bonno
Bonno / create-ssl-cert
Created July 6, 2015 08:33
generate x509 SHA256 hash self-signed certificate using OpenSSL
openssl req -x509 -nodes -sha256 -days 365 -newkey rsa:2048 -keyout example.com.crt -out example.com.crt
# Check cerificate
openssl x509 -noout -text -in example.com.crt
cadans, buitenblad, stuurbreedte, cassette, col, tax, verzet, dichtrijden, bolle renner, klimmen, vals plat, etappe, aanzetten, afdaling, lossen, er doorheen zitten, plakken, poten, stampen, bidon, kopje van bloemendaal, knieën
@Bonno
Bonno / Regex
Created September 4, 2015 11:34
Streetname/house numbers: \A(.*?)\s+(\d+[a-zA-Z]{0,1}\s{0,1}[-]{1}\s{0,1}\d*|\d+\d*)\s*([a-zA-Z]{0,1})
@Bonno
Bonno / PHP-Curl verbose logging
Last active November 9, 2015 13:08
PHP-Curl verbose logging
CURLOPT_VERBOSE => TRUE, // TRUE to output verbose information. Writes output to STDERR, or the file specified using CURLOPT_STDERR.
CURLOPT_STDERR => $verbose = fopen('php://temp', 'rw+'),
$url = "http://stackoverflow.com/questions/tagged/java";
$handle = curl_init($url);
curl_setopt_array($handle, $curlDefault);
$html = curl_exec($handle);
$urlEndpoint = curl_getinfo($handle, CURLINFO_EFFECTIVE_URL);
echo "Verbose information:\n<pre>", !rewind($verbose), htmlspecialchars(stream_get_contents($verbose)), "</pre>\n";
curl_close($handle);
@Bonno
Bonno / GPL v2 file header
Created January 10, 2016 13:14
GPL v2 file header
one line to give the program's name and an idea of what it doe.s
Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of