Skip to content

Instantly share code, notes, and snippets.

Avatar

Nate Berkopec nateberkopec

View GitHub Profile
View gist:28d53da12aeb6a4f905b1b005e372e1c
/nix/store/9j0c1bk7rq7fkc7bcf4q25wk6rjm1z3d-gnumake-4.3/bin/make install target_prefix=
/nix/store/1qw1shw2a163h45rhr5pay488nbzfi6y-coreutils-9.0/bin/install -c -m 0755 puma_http11.so /host/nateberkopec/Documents/Code/upstream/puma/lib/puma
cp tmp/aarch64-linux/puma_http11/3.0.2/puma_http11.so tmp/aarch64-linux/stage/lib/puma/puma_http11.so
/host/nateberkopec/Documents/Code/upstream/puma/test/test_config.rb:70: warning: assigned but unused variable - bind_configuration
/host/nateberkopec/Documents/Code/upstream/puma/test/test_config.rb:71: warning: assigned but unused variable - app
ruby 3.0.2p107 (2021-07-07) [aarch64-linux]
RUBYOPT: -r/nix/store/6jdmjqw9m3n3n76z5dsig3d4anh091fm-ruby-3.0.2/lib/ruby/3.0.0/bundler/setup
Puma::MiniSSL OpenSSL
OPENSSL_LIBRARY_VERSION: OpenSSL 1.1.1l 24 Aug 2021 OpenSSL 1.1.1l 24 Aug 2021
@nateberkopec
nateberkopec / homebridge.hcl
Created Mar 28, 2021
Pihole and homekit HCLs for Nomad
View homebridge.hcl
job "homebridge" {
datacenters = ["dc1"]
group "server" {
network {
port "http" {
to = 8581
}
}
View puma_codenames
as scraped by @cjlarose
5.0.0 - Spoony Bard
4.3.0 - Mysterious Traveller
4.2.0 - Distant Airhorns
4.1.0 - Fourth and One
4.0.0 - 4 Fast 4 Furious
3.12.0 - Llamas in Pajamas
3.11.0 - Love Song
3.10.0 - Russell's Teapot
View tf-dev-script.sh
#!/bin/bash
# Assumes you have a DIGITALOCEAN_TOKEN env var pre-set
# Assumes you have terraform and mutagen installed
# Assumes DO has an SSH key uploaded
DO_REGION="sgp1" # Set to DO region: https://www.digitalocean.com/docs/platform/availability-matrix/
SSH_KEY_FINGERPRINT="your-key-fingerprint" # You can find this in your control panel
if [ -z $DIGITALOCEAN_TOKEN ]; then
exit 1
View gist:7b573f2438ff768aafd2d785deb60817
ruby-install truffleruby
>>> Installing truffleruby 19.3.0 into /Users/nateberkopec/.rubies/truffleruby-19.3.0 ...
>>> Installing dependencies for truffleruby 19.3.0 ...
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from a1939cfe7 to a4d7bb64a.
Updated 3 taps (shopify/shopify, homebrew/core and homebrew/cask).
==> New Formulae
libtorch onnxruntime tio vale
==> Updated Formulae
View git-autocomplete.sh
cd ~
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
mv git-completion.bash .git-completion.bash
source ~/.git-completion.bash
echo "source ~/.git-completion.bash" >> ~/.bash_profile
@nateberkopec
nateberkopec / thread.diff
Created Feb 14, 2019
thread quantum patch
View thread.diff
diff --git a/thread_pthread.c b/thread_pthread.c
index d8d3184c62..4e28b9a31d 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -175,7 +175,7 @@ static const void *const condattr_monotonic = NULL;
/* 100ms. 10ms is too small for user level thread scheduling
* on recent Linux (tested on 2.6.35)
*/
-#define TIME_QUANTUM_MSEC (100)
+#define TIME_QUANTUM_MSEC (10)
@nateberkopec
nateberkopec / correction.md
Last active Dec 2, 2020
A Simple Correction
View correction.md

In yesterday's post I said, in relation to "how does .present? work on ActiveRecord::Relation", I said that present? performs an existence check SELECT 1 AS one FROM ... LIMIT 1 because it calls exists? underneath. This is actually wrong - it loads the relation.

Jonathan Mast corrected me on Twitter. It turns out, I should have paid closer attention! Here is the actual implementation of blank? on ActiveRecord::Relation on Rails master:

# Returns true if relation is blank.
def blank?
  records.blank?
end
View presenttest.rb
ActiveRecord::Base.logger = Logger.new(STDOUT)
MODEL = User # enter a model that exists in your app here
users = MODEL.all
puts "users.present?"
users.present?
users = nil
users = MODEL.all
puts "users.empty?"
@nateberkopec
nateberkopec / hide_or_display_index.js
Last active Dec 3, 2018
Hide gmail inbox when empty, v0.1
View hide_or_display_index.js
// ==UserScript==
// @name Gmail Inbox Empty Reward
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Hides much of the Gmail UI when your inbox is empty, to give you a little reward for reaching Inbox Zero!
// @author Nate Berkopec
// @include http://mail.google.com/*
// @include https://mail.google.com/*
// @include http://*.mail.google.com/*
// @include https://*.mail.google.com/*