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 | |
####################################### | |
# Graphite Install | |
# Run with sudo for best results | |
# | |
####################################### | |
if [[ "$(/usr/bin/whoami)" != "root" ]]; then | |
echo "This script must be run as root or using sudo.Script aborted." | |
exit 1 |
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 | |
//error_reporting(E_ALL); | |
ignore_user_abort(true); | |
function syscall ($cmd, $cwd) { | |
$descriptorspec = array( | |
1 => array('pipe', 'w') // stdout is a pipe that the child will write to | |
); | |
$resource = proc_open($cmd, $descriptorspec, $pipes, $cwd); |
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 | |
echo “Database Name: ” | |
read -e dbname | |
echo “Database User: ” | |
read -e dbuser | |
echo “Database Password: ” | |
read -s dbpass | |
echo “run install? (y/n)” | |
read -e run | |
if [ "$run" == n ] ; then |
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 sio = require('socket.io-client') | |
, id = process.argv[2] || '3Y' | |
, socket = sio.connect('http://play.codestre.am/?id=' + id) | |
console.log('connecting...') | |
socket.on('connect', function () { | |
console.log('connected.') | |
}) |
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
# origin of work http://henrik.nyh.se/2008/12/git-dirty-prompt | |
function parse_git_dirty { | |
status=`git status 2> /dev/null` | |
dirty=` echo -n "${status}" 2> /dev/null | grep -q "Changed but not updated" 2> /dev/null; echo "$?"` | |
untracked=`echo -n "${status}" 2> /dev/null | grep -q "Untracked files" 2> /dev/null; echo "$?"` | |
ahead=` echo -n "${status}" 2> /dev/null | grep -q "Your branch is ahead of" 2> /dev/null; echo "$?"` | |
newfile=` echo -n "${status}" 2> /dev/null | grep -q "new file:" 2> /dev/null; echo "$?"` | |
renamed=` echo -n "${status}" 2> /dev/null | grep -q "renamed:" 2> /dev/null; echo "$?"` | |
bits='' | |
if [ "${dirty}" == "0" ]; then |
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
require 'rubygems' | |
require 'aws-sdk' | |
require 'twilio-ruby' | |
account_sid = ENV['twilio_account_sid'] | |
auth_token = ENV['twilio_auth_token'] | |
client = Twilio::REST::Client.new account_sid, auth_token | |
from = ENV['twilo_from_number'] |
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 util = exports || {}; | |
util.mergeDeep = function (A, B, depth) { | |
var forever = depth == null; | |
for (var p in B) { | |
if (B[p] != null && B[p].constructor==Object && (forever || depth > 0)) { | |
A[p] = util.mergeDeep( | |
A.hasOwnProperty(p) ? A[p] : {}, | |
B[p], |
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
function Promise () { | |
this._resolve = []; | |
this._reject = []; | |
this._progress = []; | |
} | |
Promise.prototype = { | |
/* This is the "front end" API. */ |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>WebSocket Client</title> | |
<style> | |
#output { | |
border: solid 1px #000; | |
} | |
</style> | |
</head> |
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
# WE CAN ALSO ENABLE CORS IN htaccess | |
# with AJAX withCredentials=false (cookies NOT sent) | |
Header always set Access-Control-Allow-Origin "*" | |
Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE" | |
Header always set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type" | |
RewriteEngine On | |
RewriteCond %{REQUEST_METHOD} OPTIONS | |
RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]] |