Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
/* | |
A little node.js server for testing html5 ajax file uploads. | |
It serves up the current directory and receives uploads at /upload. | |
This is for use with xhr.send(file) where the entire request body is the file. | |
It just pauses one second between chunks so that client-side progress events | |
get a chance to fire. On my laptop it looks like the maximum chunk size is | |
around 40K, so you would still need images in the range of hundreds of kilobytes | |
to really be able to test it. |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
var crypto = require('crypto'); | |
var AESCrypt = {}; | |
AESCrypt.decrypt = function(cryptkey, iv, encryptdata) { | |
encryptdata = new Buffer(encryptdata, 'base64').toString('binary'); | |
var decipher = crypto.createDecipheriv('aes-256-cbc', cryptkey, iv), | |
decoded = decipher.update(encryptdata); |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
// implementation of random queries using Parse Cloud Code | |
// see https://parse.com/questions/random-search-its-possibile for setup details | |
Parse.Cloud.define('randomNouns', function(request, response) { | |
var NounMaster = Parse.Object.extend("NounMaster"); | |
var maxQuery = new Parse.Query(NounMaster); | |
maxQuery.first({ | |
success: function(object) { | |
var max = object.get("nextWordIndex"); | |
var n = 10; |
-- Index hit rate | |
WITH idx_hit_rate as ( | |
SELECT | |
relname as table_name, | |
n_live_tup, | |
round(100.0 * idx_scan / (seq_scan + idx_scan),2) as idx_hit_rate | |
FROM pg_stat_user_tables | |
ORDER BY n_live_tup DESC | |
), |
/* Based on | |
* - EGM Mathematical Finance class by Enrique Garcia M. <[email protected]> | |
* - A Guide to the PMT, FV, IPMT and PPMT Functions by Kevin (aka MWVisa1) | |
*/ | |
var ExcelFormulas = { | |
PVIF: function(rate, nper) { | |
return Math.pow(1 + rate, nper); | |
}, |
#!/bin/sh | |
set -e | |
cd /etc/ | |
git_diff=`git diff | head -n1 | cut -d " " -f 1` | |
if [ -n "$git_diff" ] ; then | |
### IRC 通知処理 |
I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.
These are the steps I went through to set up an SSL cert.
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |