Skip to content

Instantly share code, notes, and snippets.

Avatar

Seth Webster sethwebster

View GitHub Profile
@sethwebster
sethwebster / README.md
Last active Jun 3, 2021
Make Docker Cache Gem Installs to speed up Bundle Install
View README.md

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.

View only-one.js
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) {
View Preferences.sublime-settings
{
"caret_style": "phase",
"color_scheme": "Packages/Colorsublime - Themes/Afterglow.tmTheme",
"fade_fold_buttons": false,
"folder_exclude_patterns":
[
"node_modules",
"bower_components",
".svn",
".git",
View do-after-host-setup.sh
addUser() {
echo "Adding user $1..."
adduser $1
gpasswd -a $1 sudo
}
enableSwap() {
echo "Enabling Swap..."
sudo fallocate -l 4G /swapfile
sudo mkswap /swapfile
@sethwebster
sethwebster / GoDaddySSLHAProxy.md
Created Dec 29, 2015
Creating a PEM for HaProxy from GoDaddy SSL Certificate
View GoDaddySSLHAProxy.md

GoDaddy SSL Certificates PEM Creation for HaProxy (Ubuntu 14.04)

1 Acquire your SSL Certificate

Generate your CSR This generates a unique private key, skip this if you already have one.

sudo openssl genrsa -out  etc/ssl/yourdomain.com/yourdomain.com.key 1024

Next generate your CSR (Certificate Signing Request), required by GoDaddy:

View gist:0a9a83930a855d9638e8
### Keybase proof
I hereby claim:
* I am sethwebster on github.
* I am sethwebster (https://keybase.io/sethwebster) on keybase.
* I have a public key whose fingerprint is 1455 B70C 6E9D EACA DF22 1E58 FDE6 0C0B 581B 3A8A
To claim this, I am signing this object:
@sethwebster
sethwebster / update-authors.sh
Last active May 15, 2017
Script to rewrite a list of authors in git history
View update-authors.sh
#!/bin/bash
#
# +-----------------------+
# | Update Authors Script |
# +-----------------------+-------------------------------------------------------------------------+
# | |
# | Updates wrong authors and maps them to the new Git authors |
# | |
@sethwebster
sethwebster / FbPageInviteAllBookMarklet.js
Created Nov 30, 2013
For Facebook Pages only, invite all friends to like page. At the time of this writing, this works. Facebook changes things up pretty frequently so YMMV. First, add this code as bookmarklet, then, when inviting friends, scroll to the bottom of your list to ensure they're all loaded. Finally, click the bookmarklet. Viola, all friends invited.
View FbPageInviteAllBookMarklet.js
javascript:function inviteNext(e,t){if(e<t.length){total++;t[e].click();e++;setTimeout(function(){inviteNext(e,t)},100);updateCount()}else{destroyPopup()}}function updateCount(){var e=document.getElementById("invite-all-count-sw");e.innerText=total+"/"+els.length}function createPopup(){var e=document.getElementsByTagName("head")[0];var t=document.getElementsByTagName("body")[0];var n=document.createElement("div");n.setAttribute("id","add-all-div-sw");n.setAttribute("style",'text-align:center;font-family:"lucida grande",tahoma,verdana,arial,sans-serif;padding:20px;width:25%;height;20%;border:2px solid #ccc;background-color:#fff;position:relative;margin:0 auto 0 auto');n.innerHTML='Inviting Everyone in the List...<span id="invite-all-count-sw">0</span> invited so far...';t.appendChild(n);popup=n}function destroyPopup(){popup.parentElement.removeChild(popup)}var popup=null;var total=0;var els=document.getElementsByClassName("uiButton _1sm");createPopup();inviteNext(0,els)
@sethwebster
sethwebster / FbPageInviteAll.js
Created Nov 30, 2013
*** NOTE: This is the non-minified version for reading. A minified, bookmarklet-ready version of this is here: https://gist.github.com/sethwebster/7719079 For Facebook Pages only, invite all friends to like page. At the time of this writing, this works. Facebook changes things up pretty frequently so YMMV. First, add this code as bookmarklet, th…
View FbPageInviteAll.js
var popup = null;
var total = 0;
function inviteNext(currentIndex,list){
if (currentIndex<list.length) {
total++;
list[currentIndex].click();
currentIndex++;
setTimeout(function() { inviteNext(currentIndex,list); },100);
updateCount();
}
View gist:1707024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Amazon.S3.Transfer;
using System.Collections.Specialized;
using System.Configuration;
using Amazon.S3.Model;
using System.IO;
using Amazon.S3.Util;