Skip to content

Instantly share code, notes, and snippets.

View kbrown's full-sized avatar

Kevin Brown kbrown

View GitHub Profile
@dwabnitz
dwabnitz / deploy.rb
Created March 25, 2010 11:57 — forked from codeprimate/deploy.rb
Capistrano Deploy Recipe for Git and Phusion Passenger
# Capistrano Deploy Recipe for Git and Phusion Passenger
#
# After issuing cap deploy:setup. Place server specific config files in
# /home/#{user}/site/[staging|production]/shared
# Set :config_files variable to specify config files that should be
# copied to config/ directory (i.e. database.yml)
#
# To deploy to staging server:
# => cap deploy
# => Deploys application to /home/#{user}/site/staging from master branch
@ryanflorence
ryanflorence / static_server.js
Last active February 27, 2025 06:28
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@toamitkumar
toamitkumar / gist:952211
Created May 2, 2011 19:35
Inspect and test routes on console (Rails 3)
$ rails console
Loading development environment (Rails 3.0.6)
ruby-1.8.7-p334 :001 > r = Rails.application.routes
Gives you a handle of all the routes (config/routes.rb)
#Inspect a named route:
ruby-1.8.7-p334 :005 > r.recognize_path(app.destroy_user_session_path)
=> {:action=>"destroy", :controller=>"sessions"}
@jookyboi
jookyboi / README.md
Created March 30, 2013 01:11
Example using the marked.js README

marked

A full-featured markdown parser and compiler, written in javascript. Built for speed.

Benchmarks

node v0.4.x

$ node test --bench
@berstend
berstend / LinkedOut.js
Last active November 29, 2024 12:39
Withdraw all pending invitations from LinkedIn automatically in bulk. - Or "How I stopped spamming all of my contacts with invitations". This script is super ugly (like what LinkedIn does with your email data) but worked for me. Usage: - Go to https://www.linkedin.com/inbox/invitations/sent - Open DevInspector, paste the script to the console, h…
var INCR = 16; // Number of messages per page
var SENT_URL = '//www.linkedin.com/inbox/invitations/sent?startRow=';
var loMessageLinks = []; // Main array for all contacts
var fetchMessages = function(i, cb) {
console.log('Fetching message page #' + (i+1));
$.get(SENT_URL + (i*INCR), function(data){
var $dom = $(data);
@apollolm
apollolm / nginx-ssl-config
Last active January 12, 2023 14:47
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}
@yunano
yunano / consul.service
Created May 1, 2015 15:52
/etc/systemd/system/consul.service
[Unit]
Description=consul agent
Requires=network-online.target
After=network-online.target
[Service]
EnvironmentFile=-/etc/sysconfig/consul
Environment=GOMAXPROCS=2
Restart=on-failure
ExecStart=/usr/local/sbin/consul agent $OPTIONS -config-dir=/etc/consul.d
@ericelliott
ericelliott / AuthService.js
Created July 14, 2016 03:44
Auth0 AuthService.js
import { EventEmitter } from 'events'
import { isTokenExpired } from './jwtHelper'
import Auth0LockPasswordless from 'auth0-lock-passwordless';
export default class AuthService extends EventEmitter {
constructor(clientId, domain) {
super()
// Configure Auth0 Passwordless
// We’ll get the clientId and domain credentials from our .env file we created
this.lock = new Auth0LockPasswordless(clientId, domain)
@ericelliott
ericelliott / Login.js
Created July 14, 2016 04:09
Auth0 Login.js
import React, { PropTypes as T } from 'react'
import {ButtonToolbar, Button} from 'react-bootstrap'
import AuthService from 'utils/AuthService'
import styles from './styles.module.css'
export class Login extends React.Component {
static contextTypes = {
router: T.object
}
@aleofreddi
aleofreddi / cognito_get_all_users.sh
Last active September 20, 2024 16:13
AWS Cognito: list all users
#!/bin/sh
#
# Dump AWS Cognito users as CSV output.
#
# Thu Jun 20 15:31:10 CEST 2019, Andrea Leofreddi
#
me="`basename $0`"
if [ $# != 1 ]; then
echo Usage: "$me" pool_id >&2