Skip to content

Instantly share code, notes, and snippets.

View tuliomonteazul's full-sized avatar

Tulio Monte Azul tuliomonteazul

View GitHub Profile
@GUI
GUI / install_vagrant_sudoers.sh
Created June 3, 2012 19:13 — forked from beddari/install_vagrant_sudoers.sh
Allow Vagrant sudo-access without password for NFS-setup (for OS X)
#!/bin/bash
# Script for placing sudoers.d files with syntax-checking
# Making a temporary file to contain the sudoers-changes to be pre-checked
TMP=$(mktemp -t vagrant_sudoers)
cat /etc/sudoers > $TMP
cat >> $TMP <<EOF
# Allow passwordless startup of Vagrant when using NFS.
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/su root -c echo '*' >> /etc/exports
@yctay
yctay / figaro-capistrano.rb
Created April 30, 2013 05:34
Capistrano recipe for deploying figaro's application.yml
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
transfer :up, "config/application.yml", "#{shared_path}/application.yml", :via => :scp
end
desc "Symlink application.yml to the release path"
task :finalize do
run "ln -sf #{shared_path}/application.yml #{release_path}/config/application.yml"
end
@sindresorhus
sindresorhus / post-merge
Last active May 2, 2024 03:18
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@jlecour
jlecour / post_to_slack.rb
Last active May 22, 2022 17:43
How to post alerts from Monit to Slack
# encoding: UTF-8
require 'optparse'
require 'net/http'
require 'json'
def parse_options(argv)
opts = {}
@parser = OptionParser.new do |o|
@ericsaboia
ericsaboia / uncaughtException.js
Created May 19, 2014 15:11
Sending emails on uncaughtException
if (config.admin.email) {
process.on('uncaughtException', function(err) {
console.log(err.stack);
nodemailer.createTransport("SMTP", {
service: "Sendgrid"
, auth: {
user: config.smtp.username
, pass: config.smtp.password
}
}).sendMail({
@andyshinn
andyshinn / DEISAWS.md
Last active April 5, 2017 04:22
Deis AWS Deployment

Deploying Deis on AWS

These instructions will get you up and running with Deis and CoreOS in a AWS VPC. There already exists a CloudFormation script to get up and running in AWS. But if you want to get down and dirty, this document will help walk you through the steps.

I tried to build these instructions for both the AWS web console and equivilent AWS CLI. If you find errors, please feel free to comment so I can update them. You can also find me in the #deis IRC channel on Freenode if you have questions.

AWS

Since we will be running CoreOS and Deis inside a VPC we need some AWS setup first. We need a single subnet VPC, some security groups, and instances of CoreOS.

.
├── actions
├── stores
├── views
│   ├── Anonymous
│   │   ├── __tests__
│   │   ├── views
│   │   │   ├── Home
│   │   │   │   ├── __tests__
│   │   │   │   └── Handler.js

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@JuanitoFatas
JuanitoFatas / solution.md
Last active August 29, 2015 14:13
Solution to Could not download rvm, curl returned status '23'
Downloading https://github.com/wayneeseguin/rvm/archive/1.26.9.tar.gz
curl: (23) Failed writing body (0 != 861)
Could not download 'https://github.com/wayneeseguin/rvm/archive/1.26.9.tar.gz'.
curl returned status '23'.
Downloading https://bitbucket.org/mpapis/rvm/get/1.26.9.tar.gz
curl: (23) Failed writing body (0 != 15973)
Could not download 'https://bitbucket.org/mpapis/rvm/get/1.26.9.tar.gz'.