Skip to content

Instantly share code, notes, and snippets.

View dlsniper's full-sized avatar

Florin Pățan dlsniper

View GitHub Profile
@dlsniper
dlsniper / loaded classes
Last active December 13, 2015 18:08
SF2.2 RC2 patch
Symfony\Component\ClassLoader\ClassCollectionLoader
Symfony\Bundle\FrameworkBundle\FrameworkBundle
Symfony\Bundle\SecurityBundle\SecurityBundle
Symfony\Bundle\TwigBundle\TwigBundle
Symfony\Bundle\MonologBundle\MonologBundle
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle
Symfony\Bundle\AsseticBundle\AsseticBundle
Doctrine\Bundle\DoctrineBundle\DoctrineBundle
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle
JMS\AopBundle\JMSAopBundle

A. Caching systems in general:

  • there are many caching systems out there, with totally different APIs, levels of complexity, implementations and use-cases, so a minimum common API should provide some level of portability.
  • caching systems can work synchronously or asynchronously
  • usually caching systems store items for a limited amount of time (expiration, time-to-live, etc.)
  • some caching systems expose the expiration information in their API, others don't
  • those caching systems who use expiration may chose to use a predefined value, a system imposed value, or let the API consumer specify a value
  • the most basic operations are the storing and retrieval of things from the cache
@dlsniper
dlsniper / return-hinting-rfc.md
Last active December 18, 2015 23:39
PHP RFC for function / method return typing

Request for Comments: Method Return Typing

  • Version: 0.1
  • Date: 2013-06-26
  • Author: Florin Patan
  • Status: In draft
  • Patch included: NO

Introduction

#!/bin/bash
echo "This script will rebuild a Debian style package (deb) of latest stable"
echo "Nginx. The original deb is from nginx.org apt repository."
echo
echo "This will prompt you yes or no on a few changes to the build as well as"
echo "it will compile and package the latest Google NGX Pagespeed module."
echo
echo "This is built and tested on Ubuntu 12.04 LTS, fresh OS install."
echo "There are no guarantees, and I take no liability if it breaks, but it"
@dlsniper
dlsniper / diff
Created March 2, 2016 00:35
runtime changes test results
name old time/op new time/op delta
BinaryTree17-8 3.84s ± 2% 3.83s ± 4% ~ (p=0.365 n=19+20)
Fannkuch11-8 3.57s ± 2% 3.56s ± 3% ~ (p=0.095 n=19+20)
FmtFprintfEmpty-8 70.4ns ± 3% 69.2ns ± 6% -1.67% (p=0.036 n=19+20)
FmtFprintfString-8 230ns ± 2% 228ns ± 2% ~ (p=0.194 n=19+19)
FmtFprintfInt-8 221ns ± 1% 218ns ± 2% -1.47% (p=0.000 n=16+18)
FmtFprintfIntInt-8 359ns ± 2% 356ns ± 2% -0.76% (p=0.017 n=19+19)
FmtFprintfPrefixedInt-8 321ns ± 1% 311ns ± 1% -3.13% (p=0.000 n=20+20)
FmtFprintfFloat-8 432ns ± 1% 452ns ± 2% +4.65% (p=0.000 n=20+18)
FmtManyArgs-8 1.40µs ± 1% 1.35µs ± 2% -3.47% (p=0.000 n=18+19)
@dlsniper
dlsniper / install go.ps
Created January 28, 2016 09:54
Install go
$cwd = $PSScriptRoot+"\"
$gosdk = $cwd+"go"
$zip7 = $cwd+"7z"
$mingw = $cwd+"mingw64"
$gitdir = $cwd+"git"
$gopath = $cwd+"gopath"
# Install Go
if (-Not (Test-Path $gosdk)) {
echo "Installing Go into: "$gosdk
@dlsniper
dlsniper / get-all.bash
Created May 2, 2016 12:22
get all the dependencies from Godeps
#!/usr/bin/env bash
go get -v -u -t `grep -rin "importpath" Godeps/Godeps.json | cut -d' ' -f4 | tail -n +2 | cut -d'"' -f4 | sed -e 's/$/\/.../' | tr '\n' ' '`
@dlsniper
dlsniper / nats
Created June 5, 2016 10:57
How to halve the performance of NATS
benchmark old ns/op new ns/op delta
Benchmark____PubNo_Payload-8 88.4 164 +85.52%
Benchmark____Pub8b_Payload-8 89.5 163 +82.12%
Benchmark___Pub32b_Payload-8 103 202 +96.12%
Benchmark__Pub256B_Payload-8 140 262 +87.14%
Benchmark____Pub1K_Payload-8 298 552 +85.23%
Benchmark____Pub4K_Payload-8 1165 1362 +16.91%
Benchmark____Pub8K_Payload-8 2889 3618 +25.23%
Benchmark___________PubSub-8 243 258 +6.17%
Benchmark___PubSubTwoConns-8 254 250 -1.57%
@dlsniper
dlsniper / cloc.txt
Last active July 2, 2016 18:45
cloc GOPATH
cloc $GOPATH/src
355977 text files.
146076 unique files.
265536 files ignored.
github.com/AlDanial/cloc v 1.70 T=1536.51 s (60.4 files/s, 22195.2 lines/s)
---------------------------------------------------------------------------------------
Language files blank comment code
---------------------------------------------------------------------------------------
Go 35916 1312637 1831205 8843502
@dlsniper
dlsniper / typebound.go
Created September 18, 2016 20:44
Dependency injection in Go via explicit type
package main
import "log"
type printerFunc func(message string, args ...interface{})
type demo struct {
printer printerFunc
}