Skip to content

Instantly share code, notes, and snippets.

View nicksieger's full-sized avatar

Nick Sieger nicksieger

View GitHub Profile
#!/usr/bin/env bash
#
# Convert a .mov or .mp4 to a .gif using ffmpeg and gifsicle.
#
# Tools install: https://gist.github.com/dergachev/4627207#installation
#
# Sources:
# 1. https://discovergrid.com/animated-gif-with-ffmpeg-palettegen/
# Use ffmpeg with a generated palette to map colors better
# 2. https://gist.github.com/dergachev/4627207
@nicksieger
nicksieger / tilt-updown.sh
Created December 6, 2021 15:18
Runs `tilt up`, then `tilt down` upon interrupt
#!/bin/bash
#
# Wrap tilt so that a Ctrl-C will call `tilt down` when done.
tilt=
do_auto_down() {
echo "Interrupt; killing $tilt"
kill -INT $tilt
tilt down
exit 0
@nicksieger
nicksieger / tiltnotify
Last active November 18, 2021 16:03
Publish Tilt resource statuses as macOS notifications
#!/bin/bash
#
# Send a message to OSX Notification Center when Tilt finishes building resources
#
# usage: tiltnotify [options]
#
# Options are passed as command-line arguments to `tilt get` (e.g., --port).
notify() {
local title= subtitle= message=
#!/bin/bash
#
# Homebrew has removed openssl 1.0 from the core repo, making the default
# openssl 1.1. We still have a number of packages that rely on openssl 1.0
# (including ruby 2.2.7), so we need to bring it back.
# Commit 0349a7ca76f483483c6d5c1d4cfe6b458dee2665 is the commit that removed 1.0
# from the repo. Commit 30fd2b68feb458656c2da2b91e577960b11c42f4 is its parent
# commit that still has 1.0.
# Uninstall 1.1 if it is currently installed as 'openssl'
#!/bin/bash
#
# Zoom.us full uninstall script
#
# - Download this file locally
# - Run `chmod 755 ./remove_zoom_us_macos.sh`
# - Run `./remove_zoom_us_macos.sh`
echo Cleaning Zoom…

Keybase proof

I hereby claim:

  • I am nicksieger on github.
  • I am nicksieger (https://keybase.io/nicksieger) on keybase.
  • I have a public key ASAKaesWsfKP6c93QgldTDwIJ7KU-pTzATtZIO_g7gh5UQo

To claim this, I am signing this object:

JQ Commands

Here are some handy jq scripts that I've found useful.

With AWS CLI

Since the AWS CLI outputs JSON this is a natural fit. Sometimes the built-in --query doesn't quite go far enough.

Examples:

@nicksieger
nicksieger / request_store_plugin.rb
Last active July 18, 2018 14:08
Propagate RequestStore contents across a Delayed Job boundary
class RequestStorePlugin < ::Delayed::Plugin
callbacks do |lifecycle|
lifecycle.before(:enqueue) do |job|
obj = job.payload_object
obj.instance_variable_set(:@_request_store, RequestStore.store)
job.payload_object = obj # reserialize the job
end
lifecycle.before(:perform) do |worker, job, &block|
request_store = YAML.load(job.handler).instance_variable_get(:@_request_store) || {}
@nicksieger
nicksieger / delayed_job_990_monkeypatch.rb
Last active July 29, 2017 17:54
Monkeypatch DJ to make payload_object exception-safe
## Monkeypatch payload_object like https://github.com/collectiveidea/delayed_job/pull/990
module Delayed
module Backend
class InvalidPayload
ParseObjectFromYaml = %r{\!ruby/\w+\:([^\s]+)} # rubocop:disable ConstantName
def initialize(handler, exception)
@handler = handler
@exception = deserialization_error(exception)
end
@nicksieger
nicksieger / mongodb-2.4.14-gperftools-2.0-libc_override_osx.h.patch
Created May 17, 2017 16:37
Patches Mongo's third party copy of gperftools libc_override_osx.h for Sierra
diff --git a/src/third_party/gperftools-2.0/src/libc_override_osx.h b/src/third_party/gperftools-2.0/src/libc_override_osx.h
index 78a0ef2f95..13ec5b8d66 100644
--- a/src/third_party/gperftools-2.0/src/libc_override_osx.h
+++ b/src/third_party/gperftools-2.0/src/libc_override_osx.h
@@ -205,6 +205,33 @@ extern "C" {
size_t malloc_usable_size(void* p) { return tc_malloc_size(p); }
} // extern "C"
+static malloc_zone_t *get_default_zone()
+{