Skip to content

Instantly share code, notes, and snippets.

View skinofstars's full-sized avatar

Kevin Carmody skinofstars

View GitHub Profile
@skinofstars
skinofstars / migrate.js
Created May 2, 2017 14:00
Simple sequelize migration retry script
#!/usr/bin/env node
'use strict';
const program = require('commander');
const exec = require('child_process').exec;
program
@skinofstars
skinofstars / headersMiddleware.js
Last active May 2, 2017 13:37
Feathers schema switching in sequelize
// setup a middleware that provides access to the express headers
module.exports = (req, res, next) => {
req.feathers.headers = req.headers;
next();
};
@skinofstars
skinofstars / application_routes.js
Created December 11, 2014 15:39
Ember rollback unsaved changes on navigation
// Extend from this for a user to get a notification for unsaved model changes
// and rollback the model if they choose to navigate away.
Ember.DSModelRoute = Ember.Route.extend({
deactivate: function() {
var model = this.get('controller.model');
model.rollback();
if (model.get('isNew')) {
model.deleteRecord();
}
},
@skinofstars
skinofstars / couchdb_curl_tricks.md
Last active December 21, 2016 22:08
CouchDB notes
@skinofstars
skinofstars / deploy-ecr.sh
Created November 8, 2016 14:14
Some of the scripts needed to use Docker on AWS ECR and lastoc Beanstalk
#!/bin/bash
# usage: ./deploy-ecr.sh staging f0478bd7c2f584b41a49405c91a439ce9d944657
BRANCH=$1
SHA1=$2
AWS_ACCOUNT_ID=975486958832
NAME=moovyn
EB_BUCKET=moovyn-elasticbeanstalk
@skinofstars
skinofstars / bulk-whois.sh
Created August 2, 2016 11:43
quick ISP lookup
#!/bin/bash
# USE
# - Save as bulk.sh, then run the commands
# - chmod +x bulk.sh
# - ./bulk.sh ip_addresses.txt
# It reads the ip_address.txt line by line,
# does a whois request on each line, and looks
# for the term 'netname' in each whois.
@skinofstars
skinofstars / deploy.yml
Last active March 17, 2016 11:40
super basic deploy playbook
---
# ansible-playbook -i hosts -l production deploy.yml
- hosts: production
vars:
app_root: '/home/ubuntu/app'
app_public: "{{app_root}}/public_html"
tasks:
- synchronize: src=blog dest={{app_public}}/
- copy: src=foobar.txt dest={{app_root}}/
@skinofstars
skinofstars / .gitconfig
Created September 27, 2013 10:59
couple of nice .gitconfig aliases from @garrettc
[alias]
where = log --decorate --pretty=short -n1
lol = log --pretty=oneline --graph --decorate --stat
lg = log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit
st = status -sb
@skinofstars
skinofstars / gist:6714637
Last active December 24, 2015 00:09
deploy cold override for db migrations
namespace :deploy do
desc "Override deploy:cold to include database setup"
task :cold do
before :run_migrations do
capifony_pretty_print "--> Creating database"
run "#{release_path}/app/console mygreatdbcommand:database:create-once"
capifony_puts_ok
end
@skinofstars
skinofstars / sub-domains
Created September 18, 2013 15:02
sub domains in apache VirtualHost
<VirtualHost *:80>
ServerName foo.kevin.dev
ServerAlias foo.local.dev
ServerAlias foo.local.test
DocumentRoot /home/kevin/projects/foo/web/
<Directory /home/kevin/projects/foo/web/>
Options Indexes FollowSymLinks MultiViews
# pcw AllowOverride None
AllowOverride All