Skip to content

Instantly share code, notes, and snippets.

View tonyghita's full-sized avatar

Tony Ghita tonyghita

View GitHub Profile
@SpainTrain
SpainTrain / circle.yml
Created September 21, 2015 17:26
CircleCI machine config for node-gyp with Node v4.X
machine:
node:
version: 4.1
pre:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get update && sudo apt-get install gcc-4.9 g++-4.9
post:
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
@paralin
paralin / 1_GraphQL.md
Last active July 3, 2018 19:28
GraphQL @defer, @LiVe, @stream implementation notes

Notes moved from graph-gophers/graphql-go#15

Graphql-js can parse directives like @live just fine -

parsed.definitions[0].selectionSet.selections[0].selectionSet.selections[0].directives[0] =
{ kind: 'Directive',
  name: { kind: 'Name', value: 'live', loc: { start: 26, end: 30 } },
  arguments: [],
 loc: { start: 25, end: 30 } }
@thomasdarimont
thomasdarimont / 100_redis_median_approx.md
Last active July 28, 2019 13:38
PoC for approximating the median of a Stream via stochastic averaging in Redis with Lua

Approximating the median of a Stream via stochastic averaging

Often it is useful to have access to the median value for fields of a data stream since they are more robust with respect to outliers. The median is defined as the value of a dataset such that, when sorted, 50% of the data is smaller than the value and 50% of the data is larger then the value. Ordinarily this is difficult to calculate on a stream because it requires the collection and sorting of all data.

The median of a data stream can be approximated with a technique called stochastic averaging. To approximate the median value of a data stream one could use the following approach:

Given the current estimate of the median M. If the next observed value in the stream is larger than M, increase the current estimate by r (= the learning rate). If it is smaller, decrease the estimate by r. When M is close to the median, it increases as often as it decreases, and therefore it stabilizes.

This approach was taken from the book "Real-time Analytics -

@tschaub
tschaub / tools-as-depdendencies.md
Last active June 11, 2020 03:03
Reproducible module builds with tools (commands) as dependencies

Tools as dependencies

This example is a slight tweak on the best-practices example for working with Go modules as development dependencies.

The downside of the existing example is that someone who git clones your module to make a contribution, would not be able to run go generate (without extra work).

$ go generate
painkiller.go:5: running "stringer": exec: "stringer": executable file not found in $PATH
@justincarroll
justincarroll / bootstrap-masonry-template.htm
Last active August 15, 2020 16:48
This is my template for using Masonry 3 with Bootstrap 3. For those of you who follow this gist a lot has changed since Bootstrap 2.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Masonry Template</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700">

Install

brew install logrotate

add to .bash_profile

export PATH=${PATH}:/usr/local/sbin

restart terminal just to check the logrotate command returns something

logrotate -?

make logrotate.d directory inside of /etc/ and add new config file

@relaxdiego
relaxdiego / graphite.md
Last active January 5, 2022 09:07 — forked from surjikal/graphite.md
Installing Graphite in OS X Mavericks

Follow these steps to install graphite on OS X Mavericks.

Prerequisites

  • Homebrew
  • Python 2.7
  • Git

Install dependencies

Install Cairo and friends

@travisjungroth
travisjungroth / emojify
Last active July 14, 2022 16:17
Script to convert image files to the Slack suggest format: 128x128 PNG with transparent background.
#!/bin/zsh
# this requires imagemagick to run
# brew install imagemagick && brew install ghostscript
# on Mac, download then run `mv ~/Downloads/emojify /user/local/bin/emojify`
# emojify file [output-name]
# examples
# emojify ~/Downloads/img.png winky-face
# emojify ~/Downloads/winky-face.jpg
@jdmaturen
jdmaturen / company-ownership.md
Last active July 29, 2023 22:39
Who pays when startup employees keep their equity?

Who pays when startup employees keep their equity?

JD Maturen, 2016/07/05, San Francisco, CA

As has been much discussed, stock options as used today are not a practical or reliable way of compensating employees of fast growing startups. With an often high strike price, a large tax burden on execution due to AMT, and a 90 day execution window after leaving the company many share options are left unexecuted.

There have been a variety of proposed modifications to how equity is distributed to address these issues for individual employees. However, there hasn't been much discussion of how these modifications will change overall ownership dynamics of startups. In this post we'll dive into the situation as it stands today where there is very near 100% equity loss when employees leave companies pre-exit and then we'll look at what would happen if there were instead a 0% loss rate.

What we'll see is that employees gain nearly 3-fold, while both founders and investors – particularly early investors – get dilute

@terrancesnyder
terrancesnyder / setenv.sh
Created May 23, 2011 00:07
./setenv.sh - example setenv.sh with defaults set for minimal time spent in garbage collection
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft