Skip to content

Instantly share code, notes, and snippets.

@garrettdimon
garrettdimon / gemfile_audit.rake
Last active December 19, 2023 14:21
A rake task to audit gems against latest versions
# Instructions:
#
# 1. Make sure to add the `gems` gem to your Gemfile so this can work:
# https://rubygems.org/gems/gems
#
# 2. Register at RubyGems.org and add your API key to ~/.gem/credentials
# and chmod the credentials file to 0600
#
# 3. Use this content to create `lib/tasks/gemfile_audit.rake`
#
#!/Users/aaron/.rubies/arm64/ruby-trunk/bin/ruby
# This is a demo language server for Ruby, written in Ruby. It just checks
# the syntax of Ruby programs when you save them.
#
# Configure this in Vim by adding the vim-lsp plugin, then doing this
# in your vimrc:
#
# au User lsp_setup
# \ lsp#register_server({
require "open-uri"
r = -> { URI(_1).read }
post_dates = r.("https://daringfireball.net/archive/")
.scan(%r{<small>(.+?)</small>})
.map { |(x)| Date.parse(x.gsub("&nbsp;", " ")) }
link_dates = r.("https://daringfireball.net/linked/")
.scan(%r{href="(.+?/linked/20\d\d/.+?)"})
@benjamincharity
benjamincharity / autonomous.txt
Last active May 9, 2024 05:00
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
@eccyan
eccyan / 001_sidekiq.config
Last active August 19, 2019 20:26
Sidekiq on AWS Elastic Beanstalk (upstart v0.6.5)
# See: https://medium.com/@hugooodias/deploying-a-rails-app-to-amazon-elasticbeanstalk-in-2016-c4e833c687c0
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq":
mode: "000755"
content: |
#!/bin/bash
EB_CONFIG_DEPLOY=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir)
EB_CONFIG_APP_LOG=$(/opt/elasticbeanstalk/bin/get-config container -k app_log_dir)
initctl stop sidekiq
@maxdbn
maxdbn / sidekiq.config
Last active May 23, 2021 12:05
Gracefully restarting Sidekiq on Elasticbeanstalk, only after it's done with the running jobs. Tested on: 64bit Amazon Linux 2016.09 v2.3.0 running Ruby 2.3 (Puma). Thanks to ssaunier for the original gist! https://gist.github.com/ssaunier/44bbebb9c0fa01953860
# Sidekiq interaction and startup script
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
owner: root
group: root
@ssaunier
ssaunier / sidekiq.config
Created September 24, 2015 09:30
Running Sidekiq on AWS Elastic Beanstalk (Put that file in `.ebextensions` folder)
# Sidekiq interaction and startup script
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
owner: root
group: root
@hiattp
hiattp / sidekiq.config
Last active March 6, 2020 09:14
Sidekiq Config for Elastic Beanstalk
# Sidekiq interaction and startup script
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
content: |
#!/bin/bash
. /opt/elasticbeanstalk/hooks/common.sh
. /opt/elasticbeanstalk/support/envvars
@lsegal
lsegal / aws-repl.rb
Last active December 6, 2018 16:59 — forked from mdub/aws-repl.rb
#!/usr/bin/env ruby
require 'aws-sdk'
require 'pry'
Pry.config.prompt = [proc { "AWS> " }, proc { "AWS| " }]
AWS.pry
@mdub
mdub / aws-repl.rb
Last active December 23, 2018 14:12
A simple Ruby-based AWS console
#! /usr/bin/env ruby
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
require 'aws-sdk'