Skip to content

Instantly share code, notes, and snippets.

@dopa
dopa / server.js
Last active December 16, 2015 06:19
Memecube - Nodeproxy server.js
var http = require('http'),
httpProxy = require('http-proxy');
//
// Create an instance of node-http-proxy
//
var proxy = new httpProxy.HttpProxy({
target: {
host: 'localhost',
port: 8124
@dopa
dopa / gist:5245868
Created March 26, 2013 14:42
Shell Script to Back Up all MySQL Databases, Keep 7 Days of Backups
#!/bin/bash
# Script will output dumps for all databases using seperate files
# Derived from this post: http://www.cyberciti.biz/faq/ubuntu-linux-mysql-nas-ftp-backup-script/
USER="root"
PASSWORD="SnM1073k"
HOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
OUTPUT_DIR="/backups/files"
@dopa
dopa / gist:5245856
Created March 26, 2013 14:41
Crontab for Running MySQL Backups Nightly
#
# * * * * * command to be executed
# - - - - -
# | | | | |
# | | | | +- - - - day of week (0 - 6) (Sunday=0)
# | | | +- - - - - month (1 - 12)
# | | +- - - - - - day of month (1 - 31)
# | +- - - - - - - hour (0 - 23)
# +- - - - - - - - minute (0 - 59)
#
@dopa
dopa / gist:5040472
Last active December 14, 2015 06:09
Rails 3 Passenger NGINX Site Config
# www to non-www redirect -- duplicate content is BAD:
# https://github.com/h5bp/html5-boilerplate/blob/5370479476dceae7cc3ea105946536d6bc0ee468/.htaccess#L362
# Choose between www and non-www, listen on the *wrong* one and redirect to
# the right one -- http://wiki.nginx.org/Pitfalls#Server_Name
#server {
# don't forget to tell on which port this server listens
# listen 80;
# listen on the www host
# server_name www.example.com;
@dopa
dopa / gist:5025526
Last active December 14, 2015 04:08
Dopa Monit Config File
###############################################################################
## Monit control file
###############################################################################
##
## Comments begin with a '#' and extend through the end of the line. Keywords
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
##
## Below you will find examples of some frequently used statements. For
## information about the control file and a complete list of statements and
## options, please have a look in the Monit manual.
@dopa
dopa / gist:4980459
Created February 18, 2013 20:35
Localtunnel Troubles 2/18/2013
Shinkansen:rs-api justinschier$ localtunnel -k ~/.ssh/id_rsa.pub 3000
This localtunnel service is brought to you by Twilio.
Port 3000 is now publicly accessible from http://4nhi.localtunnel.com ...
^CShinkansen:rs-api justinschier$ localtunnel -k ~/.ssh/id_rsa.pub 3000
[Error] Unable to register tunnel. Perhaps service is down?
Shinkansen:rs-api justinschier$ localtunnel -k ~/.ssh/id_rsa.pub 3000
[Error] Unable to register tunnel. Perhaps service is down?
Shinkansen:rs-api justinschier$ date
Mon Feb 18 15:33:41 EST 2013
Shinkansen:rs-api justinschier$ localtunnel -k ~/.ssh/id_rsa.pub 3000
@dopa
dopa / gist:4734750
Created February 7, 2013 22:17
SimpleForm Bootstrap
<%= simple_form_for @product, :html => { :class => 'form-horizontal' } do |f| %>
<fieldset>
<legend><%= controller.action_name.capitalize %> Product</legend>
<%= f.input :name %>
<%= f.input :price %>
<div class="form-actions">
<%= f.submit nil, :class => 'btn btn-primary' %>
<%= link_to 'Cancel', products_path, :class => 'btn' %>
@dopa
dopa / gist:2961517
Created June 20, 2012 18:47
memecube everyauth-loader.js
// https://github.com/bnoguchi/mongoose-auth/blob/master/index.js
var everyauth = require('everyauth');
everyauth.everymodule.configurable({
'User': 'A function that returns the mongoose User model (not Schema).'
});
var Modules = {
everymodule: require('./lib/modules/everymodule')
@dopa
dopa / gist:2961510
Created June 20, 2012 18:46
memecube server.js
/*jshint forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true, strict:false, undef:true, curly:true, node:true, indent:4, maxerr:50, white:false, laxcomma:true, supernew:false */
/*global mongoose */
/*global io */
/*global req */
/*global res */
/*global JSONRES */
var express = require('express')
, conf = require('./conf')
@dopa
dopa / gist:2944964
Created June 17, 2012 16:07
mongoose-auth twitter error
starting step - getRequestToken
...finished step
starting step - storeRequestToken
...finished step
starting step - redirectToProviderAuth
...finished step
starting step - extractTokenAndVerifier
...finished step
starting step - getSession
...finished step