Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
はい、猫のように見えます。

Daniele Alessandri nrk

🤔
はい、猫のように見えます。
View GitHub Profile
@nrk
nrk / .deferred-command-pipeline
Last active Sep 22, 2020
Proof of concept for deferred command pipelines in Predis v2.0 (dev).
We couldn’t find that file to show.
@nrk
nrk / instructions.md
Created Feb 17, 2019 — forked from douglasmiranda/instructions.md
Add email to Keybase.io PGP Key (Public Key)
View instructions.md

Export your public key:

keybase pgp export > keybase-public.key

Export your private key:

keybase pgp export --secret > keybase-private.key
@nrk
nrk / keybase.md
Created Feb 17, 2019 — forked from webframp/keybase.md
Signing git commits on github using keybase.io gpg key
View keybase.md

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

Install Keybase: https://keybase.io/download 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
<?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
nrk / Dockerfile
Created Jun 28, 2016
Modify UID and GID of the "git" user in the official gogs/gogs Docker image.
View Dockerfile
FROM gogs/gogs:latest
RUN echo http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && apk --no-cache add shadow
RUN usermod -u 1100 git && groupmod -g 1100 git
View Random bytes, ints, UUIDs in PHP.md

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 )
View trim_enabler.sh
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
View fsevents_windows.go
//
// File: fsevents_windows.go
// Date: October 29, 2013
// Author: Peter Krnjevic <pkrnjevic@gmail.com>, on the shoulders of many others
//
// This code sample is released into the Public Domain.
//
package fsevents
import (
View keybase.md

Keybase proof

I hereby claim:

  • I am nrk on github.
  • I am nrk (https://keybase.io/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
nrk / fizzbuzz_generators.php
Last active Dec 30, 2015
FizzBuzz'ing in PHP, just for the heck of it.
View fizzbuzz_generators.php
<?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";
}