Skip to content

Instantly share code, notes, and snippets.

@evnm
evnm / datadog-iam-stack.yml
Last active Jul 12, 2020
A CloudFormation template describing an IAM policy+role pair which grants cross-account read access for monitoring AWS infrastructure in Datadog
View datadog-iam-stack.yml
---
AWSTemplateFormatVersion: "2010-09-09"
Description: Creates a stack containing an IAM role used to grant
Datadog monitoring access to AWS infrastructures. See
http://docs.datadoghq.com/integrations/aws/#installation for
details.
Parameters:
DatadogAwsAccountId:
@evnm
evnm / gist:d17336bf42e887c6e756
Created Jun 10, 2015
Script to convert milliseconds since epoch to a human-readable timestamp
View gist:d17336bf42e887c6e756
#!/usr/bin/python
import datetime
import sys
print datetime.datetime.fromtimestamp(float(sys.argv[1])/1000).strftime('%Y-%m-%d %H:%M:%S.%f')
@evnm
evnm / FuturePool'd
Last active Aug 8, 2018
Comparing approaches to convert `java.util.concurrent.Future`s to `com.twitter.util.Future`s.
View FuturePool'd
import com.twitter.util.{Future => TwitterFuture, FuturePool}
import java.util.concurrent.{Future => JavaFuture}
/**
* Convert a Java Future to a Twitter Future.
*/
def javaFutureToTwitterFuture[A](javaFuture: JavaFuture[A]): TwitterFuture[A] =
FuturePool.unboundedPool { javaFuture.get }
@evnm
evnm / brew-install-missing-unix-tools
Created Oct 24, 2011
A brew command to install useful tools missing from Mac OS X
View brew-install-missing-unix-tools
# Legitimately-useful utilities missing from OS X.
brew install wget watch gnu-sed coreutils
# Up-to-date versions of included tools.
brew install git emacs
# Just for fun.
brew install fortune cowsay
@evnm
evnm / indievc_webinar1.md
Last active Jul 20, 2017
indie.vc webinar: Bootstrapping—Lead Generation and Script Writing
View indievc_webinar1.md

Presenter: Nima Elyassi-Rad

Blog post

Notes

  • Lead-gen flow: Prospect -> Lead -> Sales Qualified Lead (SQL) -> Customer
  • Research:
    • Why are you in business?
    • Exactly who are you helping?
    • What specifically are you doing for them?
@evnm
evnm / netty-ffc.md
Last active May 15, 2017
Preparatory notes for a Finagle Fight Club session on Netty.
View netty-ffc.md

Why is Netty necessary?

Deficiencies of raw NIO:

  • complicated APIs
  • Too low-level to be productive for application development.

whiteboard example of Buffer.flip

java.nio.Buffer:

@evnm
evnm / vertical-split-screen-patch
Created Dec 31, 2010
CLI example of patching GNU Screen to support vertical window splitting
View vertical-split-screen-patch
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/screen co screen
$ curl http://old.evanmeagher.net/files/gnu-screen-vertsplit.patch > gnu-screen-vertsplit.patch
$ cd screen/src
$ patch < ../../gnu-screen-vertsplit.patch
$ ./configure --enable-locale --enable-telnet --enable-colors256 --enable-rxct_osc
$ make
$ sudo make install
@evnm
evnm / gcb
Last active Dec 29, 2015
A fuzzy `git checkout`.
View gcb
#! /bin/sh
# A fuzzy `git checkout`.
match=`git rev-parse --abbrev-ref --branches="*$1*"`
case `wc -w <<< "$match" | tr -d ' '` in
"0") echo "error: '$1' did not match any branch." 2>&1 ;;
"1") git checkout $match ;;
*) echo "error: '$1' is ambigious among:\n$match" 2>&1
esac
@evnm
evnm / test_changed
Last active Dec 28, 2015
A Ruby script that runs tests with Pants for all projects that have been modified in the current working tree.
View test_changed
#!/usr/bin/env ruby
#
# Run tests for all projects that have been modified in the Birdcage,
# relative to HEAD.
#
# For example, if you've edited files in three projects, this script will
# run tests serially for these three projects in one command.
print "Determining which files have been changed..."
$stdout.flush
@evnm
evnm / gitm
Last active Dec 21, 2015
A Git maintenance script. Prunes remote-tracking branches on origin and performs a deep repack on the repository.
View gitm
#! /bin/sh
# A Git maintenance script.
set -e
root=`git rev-parse --show-toplevel`
echo "Performing maintenance tasks on Git repository in ${root}..."
git fetch
git remote prune origin
git repack -a -d --depth=250 --window=250
You can’t perform that action at this time.