Skip to content

Instantly share code, notes, and snippets.


Kerem Güneş k-gun

View GitHub Profile
nickl- / UUID.php
Last active Dec 3, 2020 — forked from dahnielson/UUID.php
Pure PHP UUID generator
View UUID.php
* UUID class
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
kwhat /
Last active Mar 3, 2020
Binary Base Conversion in PHP

So, I have come accorss a lot of poor PHP base conversion implementations all over the internet that are unsuitable or incapable of doing large base conversion on binary data. This really isn't a problem for most people in PHP until you start dealing with very large decimals that are sensitive to percision loss, like in cryptography. The following provides two implementations for base conversion that should be safe for large bases and binary data, for example, converting a base256 (binary string) to base85 representation and back again.

Using GMP

You can use GMP to accomplish this at the cost of converting bin<->hex two unneeded times as well as being limited to base62.

// Not bits, bytes.
$data = openssl_random_pseudo_bytes(256);
View weighted.go
package main
import (
type Game struct {
hollodotme /
Created Apr 9, 2016
Install nginx with http2 support on ubuntu 14.04 LTS (Trusty)

How to install nginx (>= 1.9.5) with http2 support on Ubuntu 14.04 LTS (Trusty)

IMPORTANT: Backup your nginx site configs (usually under /etc/nginx/sites-available)!

Remove old nginx

Remove old nginx incl. nginx-common:

apt-get autoremove --purge nginx nginx-common
gwillem / magento-nginx.conf
Last active Nov 23, 2020
Battle-tested Nginx configuration for Magento (source:
View magento-nginx.conf
# This is an annotated subset of the Nginx configuration from our Magento production platform @
# See
# !!!! If you are a Hypernode customer, do not use this config as it will result in duplicate statements. !!!!!
user app;
worker_processes 4;
pid /var/run/;
events {
tronsha /
Last active May 9, 2020
Install PHP7 to Ubuntu
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev make
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
View eventListenerList.js
self.prototype.eventListenerList = {};
self.prototype._addEventListener = self.prototype.addEventListener;
self.prototype.addEventListener = function(type, handle, useCapture) {
useCapture = useCapture === void 0 ? false : useCapture;
var node = this;
node._addEventListener(type, handle, useCapture);
h4cc / createMongoDbLikeId.php
Created Aug 3, 2014
A PHP function to generate IDs like MongoDB uses with its ObjectIDs
View createMongoDbLikeId.php
* Creating MongoDB like ObjectIDs.
* Using current timestamp, hostname, processId and a incremting id.
* @author Julius Beckmann
function createMongoDbLikeId($timestamp, $hostname, $processId, $id)
kendellfab / goto-sublime
Created Aug 1, 2013
Add mouse click `goto definition` in sublime text 3.
View goto-sublime
Linux - create "Default (Linux).sublime-mousemap" in ~/.config/sublime-text-3/Packages/User
Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
meSingh /
Last active Jun 7, 2020
Sublime Text Installation Instructions for Ubuntu 13.04 and Elementary OS Luna

Sublime Text 2 Installation Guide: Ubuntu 13.04 and Elementary OS Luna

1. Install Sublime Text 2

Open terminal

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text

2. Install Sublime Package Control

You can’t perform that action at this time.