sudo port unload postgresql12-server
sudo port load postgresql12-server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raw = Rails.cache.redis.get( Rails.cache.redis.keys.first) | |
Marshal.load raw | |
Marshal.load(raw).instance_variable_get :@value | |
Zlib::Inflate.inflate Marshal.load(raw).instance_variable_get :@value | |
Marshal.load Zlib::Inflate.inflate Marshal.load(raw).instance_variable_get :@value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo -u postgres pg_ctl -D /opt/local/var/db/postgresql12/defaultdb stop | |
sudo -u postgres pg_ctl -D /opt/local/var/db/postgresql12/defaultdb start |
Ruby doesn't let you inherit default behavior when writing a signal trap
Here's a beginning of an exploration of what default behavior is for each signal:
# https://github.com/ruby/ruby/blob/master/signal.c#L1331-L1358
reserved = %w[SEGV BUS ILL FPE VTALRM]
reserved += %w[KILL STOP] # not listed in code but reserved via some other mechanism i was too lazy to find
Signal.list.keys.each do |signal|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127.0.0.1 paid.outbrain.com traffic.outbrain.com www.outbrain.com outbrain.com vrt.outbrain.com amplify.outbrain.com outbrainimg.com widgets.outbrain.com taboola.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "foo" is not a placeholder, it's a name that needs to be given | |
# this exact command will work if a Dockerfile is present | |
docker build -t foo . && docker run -it foo | |
# if you want to force creation of an amd64 image when on an M1/arm64 Mac | |
docker build --platform linux/amd64 -t foo . && docker run -it foo | |
# if your container doesn't have a shell as an entrypoint | |
# e.g. node:@latest | |
docker build --platform linux/amd64 -t foo . && docker run -it --entrypoint bash foo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo port selfupdate | |
sudo port install shared-mime-info | |
sudo mkdir -p /usr/local/share/mime/packages/ | |
sudo ln -s /opt/local/share/mime/packages/freedesktop.org.xml /usr/local/share/mime/packages | |
# minimal test to see if it's working - if it is, now include in Gemfile like normal | |
gem install mimemagic -v '0.3.7' --source 'https://rubygems.org/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ObjectSpace.each_object(File) do |f| | |
unless f.closed? | |
printf "%s: %d\n", f.path, f.fileno | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# save in ~/bin/dns and chmod 755 | |
unless ARGV[0] | |
print `networksetup -getdnsservers Wi-Fi` | |
exit | |
end | |
servers = case ARGV[0] |
This recipe is a work in progress and has never been run as-is.
- timeouts are in ms
- lock timeout: in postgres, when a statement that wants a restrictive lock waits on another lock, other statements that want locks can't jump the queue. so even though the statement that is waiting might only take a very short amount of time, when it starts running, while it is waiting no other statements can begin. So we set the lock timeout pretty low and retry if we don't get it.
- statement timeout: we set a short statement timeout before statements which do lock and which we expect to take a short amount of time, just in case something about our assumptions/understanding is wrong and the statement ends up taking a long time. if this happens the statement will bail early without causing harm, and we can investigate what is wrong with