Skip to content

Instantly share code, notes, and snippets.

Wranglin' private repo's

Robert K rk

Wranglin' private repo's
Block or report user

Report or block rk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rk / TransformingStream.php
Created Apr 10, 2019
Buffered Stream to Stream copy with transforms
View TransformingStream.php
class TransformingStream {
protected $input;
protected $output;
// Chunk size...
protected $chunkSize = 4096;
rk /
Last active Mar 29, 2019

Keybase proof

I hereby claim:

  • I am rk on github.
  • I am robertkosek ( on keybase.
  • I have a public key ASCescDdEoT3Hl5loRxfmGzPdeAEC0l99tw_ahzMGXolfgo

To claim this, I am signing this object:

rk / rename.php
Created Feb 27, 2019
Batch remove prefix from files in current folder
View rename.php
* rename.php - A Quick and Dirty Prefix Removal Script
* This is a quick and dirty prefix removal script. It's meant to be customized quickly and easily, and the
* typical options (the pattern and desired extensions) are defined immediately below.
* Writting in 2019 by Robert Kosek <robert[NOSPAM]>
rk /
Created Aug 10, 2018
artisan command that looks in parent directories for where artisan is located.
wanted=$(basename $0)
while [[ ! -x "$dir/$wanted" ]]; do
if [[ "$dir" -ef "../$dir" ]]; then
echo "$wanted not in the current directory or any of its parents" 1>&2
exit 2
rk /
Last active May 18, 2016
Notes for Yitzchok's talk at php[tek] 2015

Notes: Everything I Needed to Know, I Learned in Rabbinical School — Yitzchok Willroth — php[tek] 2015



  1. Cultivate a mentor for yourself

    1. Identify
rk / quartile.sql
Created May 16, 2016
Calculate Quartiles & Median
View quartile.sql
-- Calculates the 1st and 3rd quartiles, and the median, from a given table.
-- This cannot be optimized except by adding an index to the column, as MySQL
-- doesn't support NTILE() natively.
SET @temp_rows = (SELECT GROUP_CONCAT(column ORDER BY column ASC SEPARATOR ',') FROM table WHERE column IS NOT NULL);
SET @temp_count = (SELECT COUNT(column) FROM table WHERE column IS NOT NULL);
(SUBSTRING_INDEX(SUBSTRING_INDEX(@temp_rows, ',', ROUND(@temp_count * 0.25 + 1)), ',', -1)) AS 'q1',
(SUBSTRING_INDEX(SUBSTRING_INDEX(@temp_rows, ',', ROUND(@temp_count * 0.5 + 1)), ',', -1)) AS 'median',
rk / extract test
Created Mar 27, 2012
Tests various methods of "anonymously" calling functions
View extract test
function print_args() {
foreach(func_get_args() as $value)
echo var_dump($value) . "\n";
// This will print "int(2)"
print_args(extract(array('key' => 'value', "bool" => false)));
rk / dh.go
Created Jan 14, 2012
A failing Diffie-Hellman WIP project in Go. Apparently Go cannot find the "big" package that it comes with?
View dh.go
package main
import (
cr "crypto/rand"
enc "encoding/ascii85"
rk / fib.js
Created Oct 3, 2011
Cached fibonacci
View fib.js
var http = require('http');
function fib(n){
if (n < 2) return 1;
else return fib(n-2) + fib(n-1);
var cached_fib = (function(){
var cache = {};
return function(n) {
rk / bcrypt.php
Last active Jan 4, 2018
Simple bcrypt object to wrap crypt() with.
View bcrypt.php
// Originally by Andrew Moore
// Src:
// Heavily modified by Robert Kosek, from data at
class Bcrypt {
private $rounds;
private $prefix;
You can’t perform that action at this time.