Skip to content

Instantly share code, notes, and snippets.

View zerowidth's full-sized avatar

Nathan Witmer zerowidth

View GitHub Profile
@mikegehard
mikegehard / active_model_lint.rb
Created April 8, 2011 21:26 — forked from pairing/active_model_lint.rb
RSpec shared examples for ActiveModel::Lint
# adapted from rspec-rails http://github.com/rspec/rspec-rails/blob/master/spec/rspec/rails/mocks/mock_model_spec.rb
# put this in a file in your spec/support directory
# USAGE:
#
# let(:model) { ModelUnderTest.new(params) }
# it_behaves_like "ActiveModel"
shared_examples_for "ActiveModel" do
require 'test/unit/assertions'
require 'active_model/lint'
@merlinmann
merlinmann / pig-area.txt
Created July 13, 2022 22:43
Pig Cursor Resting Area
⌨️ Official Cursor-Resting Area:
╭―――――――—――╮
│ > 🐽 < │
╰――――――――—―╯
@bhb
bhb / clojure_m1.md
Last active September 15, 2022 00:50
How to set up Clojure on M1 using Homebrew: A thread

How to set up Clojure on M1 using Homebrew: A thread

I’m upgrading from a Mid 2014 MacBook Pro, so this isn’t a fair comparison to recent Intel machines, but if you’re like me and were waiting for a MacBook with a decent keyboard, you’ll see a big speed boost.

Non-scientific comparison - time to compile my ClojureScript project

  • Mid 2014 MacBook Pro - 14s
  • M1 Pro MacBook Pro (under Rosetta) - 17s
  • M1 Pro MacBook Pro (native) - 6s
@raggi
raggi / eventmachine_is_web_scale.rb
Created September 1, 2010 01:34
the secrets of the web scale sauce
require 'eventmachine'
EM.run do
SEKRET_SAUCE = EM.attach(
open(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null', 'w')
)
EM.start_server('0.0.0.0', 80, Module.new do
def post_init; proxy_incoming_to(SEKRET_SAUCE); end
end)
end

Setting up netboot.xyz with an EdgeRouter

This document covers how to setup netboot.xyz, a service that provides iPXE-based installation and live boot of a bunch of operating systems, on a Ubiquiti EdgeRouter.

Assumptions

I've made a few assumptions throughout this document that will probably be different for your setup:

@tonyc
tonyc / gist:1384523
Last active February 6, 2023 04:05
Using strace and lsof

Using strace and lsof to debug blocked processes

You can use strace on a specific pid to figure out what a specific process is doing, e.g.:

strace -fp <pid>

You might see something like:

select(9, [3 5 8], [], [], {0, 999999}) = 0 (Timeout)

@simonmichael
simonmichael / gist:1185421
Created September 1, 2011 03:59
ghc-pkg-clean, ghc-pkg-reset
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@andkerosine
andkerosine / raskell.rb
Created August 15, 2012 05:56
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@samlambert
samlambert / management.md
Created January 9, 2021 00:16
Management @ PlanetScale

We want PlanetScale to be the best place to work. But every company says that, and very few deliver. Managers have a role in creating an amazing work experience, but things go awry when the wrong dynamic creeps in.

We have all seen those managers who collect people as “resources” or who control information as a way to gain “power.” In these cultures, people who “can’t” end up leading the charge. This is management mediocrity.

What will make us different? At PlanetScale, we won’t tolerate management mediocrity. We are building a culture where politics get you nowhere and impact gets you far. Managers are here to support people who get things done. They are as accountable to their team as their team is accountable to them.

We evaluate managers on the wellbeing and output of their team, how skillfully they collaborate with and influence others, and how inclusively and transparently they work.

You can expect your manager to:

  • Perceive a better version of you and support you in getting there