Skip to content

Instantly share code, notes, and snippets.

atom re5et

  • http://substantial.com
  • Bellingham, WA
Block or report user

Report or block re5et

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View no-final.js
const crypto = require('crypto');
const algorithm = 'aes-256-ctr';
const password = 'DERRRRP'
function encrypt(text){
const cipher = crypto.createCipher(algorithm, password)
const crypted = cipher.update(text,'utf8','hex')
return crypted;
}
View Vagrantfile.rb
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@re5et
re5et / gist:bc9d8e5847b5fd697d15
Created Feb 5, 2015
The reasons we set START_CTX in our unicorn config
View gist:bc9d8e5847b5fd697d15
atom
so @keefe, the deal with the unicorn restart problem is this:
1) When restarting, unicorn takes the binary for the rails unicorn bin from $0
2) capistrano releases are changing this location
3) unicorn expects the binary it is using to stay in the same spot ($0)
so after: https://github.com/Bluescape/thoughtstream-chef/pull/278 and https://github.com/substantial/cookbook-rails_nginx_unicorn/pull/12
@re5et
re5et / edit.sh
Last active Aug 29, 2015
EDITOR=edit
View edit.sh
#! /bin/bash
emacsclient -e "(external-edit \"$1\")" > /dev/null
View aws-ssl-termination-digicert.md

1: Generate CSR

openssl req -new -newkey rsa:2048 -nodes -keyout server-cert.key -out server-cert-sign-req.csr

# Country Name (2 letter code) [AU]:US
# State or Province Name (full name) [Some-State]:California
# Locality Name (eg, city) []:
# Organization Name (eg, company) [Internet Widgits Pty Ltd]:Flutterby Labs, Inc.
# Organizational Unit Name (eg, section) []:
# Common Name (eg, YOUR name) []:www.dogo.co
View *scratch*.el
(defun async-command-and-highlight (command highlights &optional output-buffer)
(kill-buffer output-buffer)
(async-shell-command command output-buffer)
(with-current-buffer output-buffer
(mapcar
(lambda (highlight)
(highlight-phrase (car highlight) (cdr highlight)))
highlights)))
(async-command-and-highlight
View boolean_returning_transaction.rb
class ActiveRecord::Base
def self.boolean_returning_transaction
begin
result = false
result = ActiveRecord::Base.transaction do
yield
return true
end
rescue
@re5et
re5et / force-save.el
Created Aug 27, 2013
Save a buffer, even if it hasn't been modified. I use this to touch / save a buffer when I want a test to run, etc.
View force-save.el
(global-set-key (kbd "C-x C-s") 'force-save)
(defun force-save ()
(interactive)
(not-modified 1)
(save-buffer))
View validate_with_matcher.rb
# RSpec matcher for validates_with.
# https://gist.github.com/2032846
# Usage:
#
# describe User do
# it { should validate_with CustomValidator }
# end
RSpec::Matchers.define :validate_with do |validator, options = {}|
match do |subject|
@re5et
re5et / node_https.js
Created Jul 1, 2013
node https server
View node_https.js
const crypto = require('crypto'),
fs = require("fs"),
http = require("http");
var privateKey = fs.readFileSync('privatekey.pem').toString();
var certificate = fs.readFileSync('certificate.pem').toString();
var credentials = crypto.createCredentials({key: privateKey, cert: certificate});
var handler = function (req, res) {
You can’t perform that action at this time.