Skip to content

Instantly share code, notes, and snippets.

View fix-homebrew-openssl.sh
#!/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'
View remove_zoom_us_macos.sh
#!/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…
View keybase.md

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:

View JQ-Commands.md

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 Jul 18, 2018
Propagate RequestStore contents across a Delayed Job boundary
View request_store_plugin.rb
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 Jul 29, 2017
Monkeypatch DJ to make payload_object exception-safe
View delayed_job_990_monkeypatch.rb
## 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
Patches Mongo's third party copy of gperftools libc_override_osx.h for Sierra
View mongodb-2.4.14-gperftools-2.0-libc_override_osx.h.patch
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()
+{
@nicksieger
nicksieger / callback_trace.rb
Last active Oct 20, 2016
Troubleshoot ActiveRecord callbacks; require/load this at the top of config/application.rb
View callback_trace.rb
module CallbackTrace
def self.included(kls)
kls.send :alias_method_chain, :_compile_filter, :trace
end
def _compile_filter_with_trace(filter)
generated_code = _compile_filter_without_trace(filter)
return generated_code if filter.is_a?(Array) || @kind == :around || !(@klass.ancestors.include?(ActiveRecord::Base))
"($stdout.print 'Callback: #{@kind} #{@klass.name}##{@raw_filter}'; $stdout.puts self.inspect; #{generated_code})"
end
View gist:063f81a02b23b5b92b4c
$ cat fucksgiven.c
#include <stdio.h>
#include <stdlib.h>
typedef struct aFuck {} Fuck;
int main (int argc, char** argv)
{
Fuck * given = (Fuck*) malloc(argc * sizeof(Fuck));
printf("You gave %lu fucks\n", sizeof(*given));
@nicksieger
nicksieger / gist:10133066
Created Apr 8, 2014
Poems are rough notations for the music we are.
View gist:10133066
Did you hear that winter is over?
The basil and carnation cannot control their laughter.
The nightingale, back from his wandering,
has been made singing master over all the birds.
The trees reach out their congratulations.
The soul goes dancing through the king’s doorway.
Anemones blush because they have seen the rose naked.