Skip to content

Instantly share code, notes, and snippets.

@zavg
zavg / php7-memcached-session-fix.php
Created October 13, 2020 05:04 — forked from askaidau/php7-memcached-session-fix.php
PHP 7 Memcached session_regenerate_id() E_RECOVERABLE_ERROR Fix
<?php
// affects (but not limited to) stock PHP 7.0x on Ubuntu 16.04.3
// source: https://bugs.php.net/bug.php?id=71187
// assuming we are using memcached for session store
ini_set("session.save_handler", "memcached");
ini_set("session.save_path", "localhost:11211");
// we need to extend and override the read method to force it to return string value
// in order to comply with PHP 7's more strict type checking

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@zavg
zavg / Script_Template.ps1
Created January 29, 2020 13:29 — forked from 9to5IT/Script_Template.ps1
PowerShell: Script Template
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@zavg
zavg / latency.txt
Created April 30, 2018 19:58 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@zavg
zavg / lambda-dynamo
Created September 3, 2016 13:56 — forked from markusklems/lambda-dynamo
Short aws lambda sample program that puts an item into dynamodb
// create an IAM Lambda role with access to dynamodb
// Launch Lambda in the same region as your dynamodb region
// (here: us-east-1)
// dynamodb table with hash key = user and range key = datetime
console.log('Loading event');
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10'});
exports.handler = function(event, context) {
@zavg
zavg / myapp
Last active August 29, 2015 14:14 — forked from cblunt/myapp
#!/bin/bash
### BEGIN INIT INFO
# Provides: myapp passenger in standalone
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Start/stop myapp.com web site
### END INIT INFO
#PATH=/sbin:/usr/sbin:/bin:/usr/bin