Skip to content

Instantly share code, notes, and snippets.


Daniele Alessandri nrk

View GitHub Profile
nrk / .deferred-command-pipeline
Last active September 22, 2020 21:00
Proof of concept for deferred command pipelines in Predis v2.0 (dev).
We couldn’t find that file to show.
nrk /
Created February 17, 2019 16:04 — forked from douglasmiranda/
Add email to PGP Key (Public Key)

Export your public key:

keybase pgp export > keybase-public.key

Export your private key:

keybase pgp export --secret > keybase-private.key
nrk /
Created February 17, 2019 16:04 — forked from webframp/
Signing git commits on github using gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key

View group_keys_by_slot.php
require __DIR__.'/../autoload.php';
function group_keys_by_slot(\Predis\Cluster\StrategyInterface $strategy, array $keys) {
$keysBySlot = [];
foreach ($keys as $key) {
$slot = $strategy->getSlotByKey($key);
nrk / Dockerfile
Created June 28, 2016 12:52
Modify UID and GID of the "git" user in the official gogs/gogs Docker image.
View Dockerfile
FROM gogs/gogs:latest
RUN echo >> /etc/apk/repositories && apk --no-cache add shadow
RUN usermod -u 1100 git && groupmod -g 1100 git
nrk / Random bytes, ints, UUIDs in
Created May 11, 2016 16:15 — forked from tom--/Random bytes, ints, UUIDs in
PHP random bytes, integers and UUIDs
View Random bytes, ints, UUIDs in

Random bytes, ints, UUIDs in PHP

Simple and safe random getters to copy-paste

string randomBytes( int $length )

int randomInt ( int $min , int $max )

string randomUuid ( void )
# Original version by Grant Parnell is offline (
# Update July 2014: no longer offline, see
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
# Alternative to
# Method behind this madness described:
# See discussion in comments here:
# And here:
View fsevents_windows.go
// File: fsevents_windows.go
// Date: October 29, 2013
// Author: Peter Krnjevic <>, on the shoulders of many others
// This code sample is released into the Public Domain.
package fsevents
import (
nrk /
Created June 16, 2014 19:20

Keybase proof

I hereby claim:

  • I am nrk on github.
  • I am nrk ( on keybase.
  • I have a public key whose fingerprint is 10FD 7831 4575 D9BE A1AD DE06 6F02 4C0D CE75 5CFF

To claim this, I am signing this object:

nrk / fizzbuzz_generators.php
Last active December 30, 2015 21:39
FizzBuzz'ing in PHP, just for the heck of it.
View fizzbuzz_generators.php
// Same approach as of `fizzbuzz_short.php` but with some generators love so you
// can fizzbuzz all you want without blowing up you memory. HOW GREAT IS IT?
$fbrange = function ($start, $stop) {
if ($start > 0) {
for ($n = $start; $n < $stop; $n++) {
yield (($f=!($n%3))|($b=!($n%5)))?($f?'Fizz':'').($b?'Buzz':''):"$n";