Skip to content

Instantly share code, notes, and snippets.

I'm going to tell you my unconventional stack, and the reasoning for
it. You may or may not agree with it, but let's give it a try.
Most of the modern backend web frameworks were started maybe 15-20
years ago, and the same patterns have continued to be used. But things
have changed since then:
* Disk is a lot faster (NVMe)
* Disk is a lot more robust (EBS Io2)
* RAM is super cheap
@samtx
samtx / config
Last active April 29, 2024 23:57
Pretty git log graphs
# add to ~/.gitconfig file
# By Slipp D. Thompson, at http://stackoverflow.com/questions/1838873/visualizing-branch-topology-in-git/34467298#34467298
[alias]
lg = !"git lg1"
lg1 = !"git lg1-specific --all"
lg2 = !"git lg2-specific --all"
lg3 = !"git lg3-specific --all"
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
@marcelog
marcelog / nginx_with_external_openssl.sh
Created October 29, 2016 18:32
How to send specific linker options for nginx without using LDFLAGS
#!/bin/bash
./configure --with-ld-opt="-L/my/ssl/location"
@atdt
atdt / setfsuid.py
Last active February 12, 2020 22:57
Python wrapper for setfsuid
# Copyright (c) 2019 Ori Livneh
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
@phrawzty
phrawzty / 2serv.py
Last active May 31, 2024 17:14
simple python http server to dump request headers
#!/usr/bin/env python2
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
@tbroyer
tbroyer / README.md
Last active May 25, 2016 13:46
Error-prone in Gradle

UPDATE: This is now available as a plugin https://github.com/tbroyer/gradle-errorprone-plugin

To use it, just add the following to your build.gradle and it'll change all JavaCompile tasks to use the error-prone compiler:

apply from: 'https://gist.github.com/tbroyer/6847494/raw/errorprone.gradle'
@chrismanderson
chrismanderson / thrift
Created October 5, 2013 00:01
thrift mavericks stack trace
→ cat /Users/chris/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/thrift-0.9.1/ext/gem_make.out
/Users/chris/.rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
extconf.rb:25: Use RbConfig instead of obsolete and deprecated Config.
checking for strlcpy() in string.h... yes
creating Makefile
make
compiling binary_protocol_accelerated.c
compiling bytes.c
compiling compact_protocol.c
@hubgit
hubgit / youtube-gif.sh
Last active September 12, 2023 23:28
Convert a section of a YouTube video to an animated GIF
#!/bin/bash
# brew install x265
# brew install ffmpeg
# brew install youtube-dl
# brew install imagemagick
ID='U65_uY5N2WM' # YouTube video ID, i.e. https://www.youtube.com/watch?v={ID}
# fetch the video file with youtube-dl
@JakeWharton
JakeWharton / dex.sh
Last active March 25, 2024 13:54
`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ and dexdump from the build-tools in the Android SDK be on your PATH.
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')
@KartikTalwar
KartikTalwar / Documentation.md
Last active May 9, 2024 12:59
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs