Skip to content

Instantly share code, notes, and snippets.

View sethwebster's full-sized avatar

Seth Webster sethwebster

View GitHub Profile
addUser() {
echo "Adding user $1..."
adduser $1
gpasswd -a $1 sudo
}
enableSwap() {
echo "Enabling Swap..."
sudo fallocate -l 4G /swapfile
sudo mkswap /swapfile
{
"caret_style": "phase",
"color_scheme": "Packages/Colorsublime - Themes/Afterglow.tmTheme",
"fade_fold_buttons": false,
"folder_exclude_patterns":
[
"node_modules",
"bower_components",
".svn",
".git",
class ThereCanBeOnlyOne {
timeout = null;
performAction(waitMs, action) {
if (this.timeout) this.cancelPrevious();
return new Promise((resolve, reject) => {
this.timeout = setTimeout(() => {
this.cancelPrevious();
const value = action();
if (value.then && value.catch) {
@sethwebster
sethwebster / README.md
Last active April 12, 2023 19:06
Make Docker Cache Gem Installs to speed up Bundle Install

Gem Install Dockerfile Hack

If you're hacking on your Gemfile and using Docker, you know the pain of having the bundle install command run after you've added or removed a gem. Using docker-compose you could mount a volume and stage your gems there, but this adds additional complexity and doesn't always really solve the problem.

Enter this imperfect solution:

What if we installed every gem into it's own Docker layer which would be happily cached for us?

gem-inject-docker does just that. It takes the list of gems used by your app via bundle list and transforms it into a list of RUN gem install <your gem> -v <gem version> statements and injects them into the Dockerfile at a point of your choosing.