This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
# Paste this into ssh | |
# curl -sL https://gist.github.com/gists/2913223/download | tar -xzO | /bin/bash -ex | |
# When forking, you can get the URL from the download button. | |
pushd $HOME | |
aptget='sudo apt-get' | |
chsh='sudo chsh' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Runs a command wrapped with btrfs pre-post snapshots. | |
log_path="/var/local/log/snp" | |
date=$(date "+%Y-%m-%d-%H%M%S") | |
log_file="${log_path}/snp_${date}.log" | |
# Log stdout and stderr. Reference: http://stackoverflow.com/questions/3173131/redirect-copy-of-stdout-to-log-file-from-within-bash-script-itself | |
exec > >(tee -a "$log_file") | |
exec 2> >(tee -a "$log_file" >&2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Converts CSV to JSON | |
* Example uses Google Spreadsheet CSV feed | |
* csvToArray function I think I found on php.net | |
*/ | |
header('Content-type: application/json'); | |
// Set your CSV feed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
/* | |
* Converts CSV to JSON | |
* Example uses Google Spreadsheet CSV feed | |
* csvToArray function I think I found on php.net | |
*/ | |
/* | |
* Using of script in command line: | |
* ./csv-to-json.php csv.file.name.or.url > json.file.name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#a/usr/bin/perl | |
# This script was hastily cobbled together for my own use. It can | |
# probably break your system. Use at your own risk. | |
$JAIL = "/srv/http"; | |
$USER = "http"; | |
$GROUP = "http"; | |
$WWW_DIR = "www"; | |
sub run{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var application_root = __dirname, | |
express = require("express"), | |
path = require("path"), | |
mongoose = require('mongoose'); | |
var app = express.createServer(); | |
// database | |
mongoose.connect('mongodb://localhost/ecomm_database'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COOKIE_SECRET="It's a secret to everybody" | |
FLICKR='{"api_key":"XXXXXX", "api_secret":"XXXXXX", "callback_url":"https://XXXXXX/auth/flickr/callback"}' | |
TWITTER='{"consumer_key":"XXXXXX", "consumer_secret":"XXXXXX","request_token_url":"https://api.twitter.com/oauth/request_token","authorize_url":"https://api.twitter.com/oauth/authorize","access_token_url":"https://api.twitter.com/oauth/access_token","callback_url":"http://XXXXXX/auth/twitter/callback"}' | |
GOOGLE='{"web":{"auth_uri":"https://accounts.google.com/o/oauth2/auth","client_secret":"XXXXXX","token_uri":"https://accounts.google.com/o/oauth2/token","client_email":"XXXXXX","redirect_uris":["https://XXXXXX/auth/google/callback"],"client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/XXXXXX","client_id":"XXXXXX","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","javascript_origins":["XXXXXX"]}}' | |
GOOGLE_SCOPE='["https://www.googleapis.com/auth/userinfo.profile","https://www.googleapis.com/auth/userinfo.email"]' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'), | |
passport = require('passport'), | |
LocalStrategy = require('passport-local').Strategy, | |
connect = require('connect'), | |
http = require('http'), | |
path = require('path'), | |
util = require('util'), | |
fs = require('fs'), | |
redis = require('redis'), | |
cookie = require('cookie'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs = require 'fs' | |
express = require 'express.io' | |
path = require 'path' | |
#If we didn't get to server.js from bootstrap.js | |
if !GLOBAL.asset_hash? | |
GLOBAL.asset_hash = 'main' | |
#Read dotCloud ENV file if exists | |
try |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add a new object | |
var type = 'note'; | |
var attributes = {color: 'red'}; | |
store.add(type, attributes) | |
.done(function (newObject) {}); | |
.fail(function (error) {}); | |
// update an existing object | |
var type = 'note'; | |
var id = 'abc4567'; |
OlderNewer