Skip to content

Instantly share code, notes, and snippets.

View relaxnow's full-sized avatar

Boy Baukema relaxnow

View GitHub Profile
@relaxnow
relaxnow / php-quine.php
Created October 10, 2011 19:41
PHP Quine
<?php
$quine = "PD9waHAKCiRxdWluZSA9ICIqIjsKCmVjaG8gc3RyX3JlcGxhY2UoY2hyKDQyKSwgJHF1aW5lLCBiYXNlNjRfZGVjb2RlKCRxdWluZSkpOw==";
echo str_replace(chr(42), $quine, base64_decode($quine));
@relaxnow
relaxnow / longest-common-substring.php
Created October 10, 2011 20:53
Longest Common Substring algorithm in PHP
<?php
function getLongestCommonSubstring($first, $second)
{
$longestCommonSubstringIndexInFirst = 0;
$table = array();
$largestFound = 0;
$firstLength = strlen($first);
$secondLength = strlen($second);
@relaxnow
relaxnow / get-logged-hours-from-jira
Created February 3, 2012 11:03
Get the total of hours logged in Jira from your activity stream
curl -q -u $USER:$JIRAPASSWORD "https://$JIRADOMAIN/activity?maxResults=1300&streams=user+IS+$USER&os_authType=basic" | grep 'Logged' | grep -o '[0-9][0-9.]*' | awk '{s+=$1} END {print s}'
@relaxnow
relaxnow / topsort.php
Created September 1, 2012 00:14
Topological sorting with directed cycle detection
<?php
$a = new Node('a');
$b = new Node('b');
$c = new Node('c');
$d = new Node('d');
$e = new Node('e');
$a->dependsOn($b);
$a->dependsOn($d);
@relaxnow
relaxnow / config.yml
Last active May 4, 2021 07:16
Ibuildings NelmioSecurityBundle recommended configuration
nelmio_security:
# don't use signed cookies
# don't use encrypted cookies
# prevent framing of the entire site
clickjacking:
paths:
'^/.*': DENY
# prevent redirections outside the website's domain
external_redirects:
abort: true
### Keybase proof
I hereby claim:
* I am relaxnow on github.
* I am relaxnow (https://keybase.io/relaxnow) on keybase.
* I have a public key whose fingerprint is 7715 2D20 ECFC 090A CEA4 EFBD 8F90 6A44 FF9D C71C
To claim this, I am signing this object:
/**
* Bit of code you can run in your developer toolbar or on https://jsfiddle.net .
*
* Fill in the characteristics of your own 'public file' solution and acceptance criteria.
*/
(function(){
'use strict';
// dec=10,hex=16,[A-Z0-9]=36, etc.
var CHARACTER_COMBINATIONS = 16,
@relaxnow
relaxnow / gist:3cb61b198234be3ba419
Created March 11, 2015 13:00
How to add syntax highlighting to Pages and Keynote
export LC_CTYPE=UTF-8; pbpaste | (echo '<?php ' && cat) | /usr/local/bin/pygmentize -l php -f rtf -O style=monokai,fontface=Monaco | sed 's/\\\\f0/\\\\f0\\\\fs72/g' | pbcopy -Prefer rtf
@relaxnow
relaxnow / json_decode.output
Last active August 29, 2015 14:21
XPath v.s. JSON on edugain metadata
/opt/local/bin/php53-bin/php /tmp/json_decode.php
count: 1090
peak memory usage: 6 MiB
time: 13.12ms
alert('xss');