Skip to content

Instantly share code, notes, and snippets.

@ailabs-software
ailabs-software / gist:f5383f3b460ed6590637
Created December 11, 2014 07:14
cat /proc/14959/limits
root@shopprod:/opt# cat /proc/14959/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 15872 15872 processes
Max open files 1024 4096 files
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node_ 21849 root cwd DIR 252,0 4096 9208 /opt/deployment/applications/jchase
node_ 21849 root rtd DIR 252,0 4096 2 /
node_ 21849 root txt REG 252,0 11103926 786577 /usr/local/bin/node
node_ 21849 root mem REG 252,0 105288 393247 /lib/x86_64-linux-gnu/libresolv-2.15.so
node_ 21849 root mem REG 252,0 31104 393272 /lib/x86_64-linux-gnu/libnss_dns-2.15.so
node_ 21849 root mem REG 252,0 108723 277956 /opt/deployment/applications/jchase/jchase-codebase/server/GreenfieldAnalytics/aggregates/node_modules/webworker-threads/build/Release/WebWorkerThreads.node
node_ 21849 root mem REG 252,0 22504 801159 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
node_ 21849 root mem REG 252,0 10328 801157 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
node_ 21849 root mem REG 252,0 170024 393549 /lib/x86_64-linux-gnu/libexpat.so.1.5.2
@ailabs-software
ailabs-software / gist:77387e8247914755466a
Created November 24, 2014 17:59
Express errors logged could result in streams left around?
TypeError: Cannot read property 'remoteAddress' of undefined
at forwarded (/opt/jchase/lib/express/node_modules/proxy-addr/node_modules/forwarded/index.js:30:34)
at alladdrs (/opt/jchase/lib/express/node_modules/proxy-addr/index.js:51:15)
at proxyaddr (/opt/jchase/lib/express/node_modules/proxy-addr/index.js:260:15)
at IncomingMessage.ip (/opt/jchase/lib/express/express/lib/request.js:299:10)
at getip (/opt/deployment/library/LibrariesMichigan/Michigan2/michigan.AppFactory/node_modules/morgan/index.js:384:13)
at logger (/opt/deployment/library/LibrariesMichigan/Michigan2/michigan.AppFactory/node_modules/morgan/index.js:110:26)
at intercept_fn (/opt/jchase/lib/express/express.js:31:18)
at Layer.handle [as handle_request] (/opt/jchase/lib/express/express/lib/router/layer.js:82:5)
at trim_prefix (/opt/jchase/lib/express/express/lib/router/index.js:270:13)
STATUS_TEXT := map[bool]string {
false: "DOWN",
true: "UP"};
SendAlert/SendStatusAlert.go:13: non-declaration statement outside function body
SendAlert/SendStatusAlert.go:15: syntax error: unexpected semicolon or newline b
@ailabs-software
ailabs-software / gist:a96a7272acf46c20e77f
Created September 1, 2014 21:26
Removes 136,000 positions from an array of 278,000 in 50ms.
function filterOutPositions(array, positions) // utility code, @param -- positions to remove
{
var BE_DELETED = {};
var arr = array.slice(0); // Clone the array so it can be re-used (non-destructive)
var pos_len = positions.length;
for (var i=0; i < pos_len; i++)
{
arr[ positions[i] ] = BE_DELETED;
}
@ailabs-software
ailabs-software / gist:50d9af4256253356ebf1
Created September 1, 2014 20:23
Optimizing removal of elements at positions, when list of positions is greater than 100,000 and array is >250,000.
function filterOutPositions(array, positions) @param -- positions to remove
{
var BE_DELETED = {};
var arr = array.slice(0); // Clone the array so it can be re-used (non-destructive)
var pos_len = positions.length;
for (var i=0; i < pos_len; i++)
{
arr[ positions[i] ] = BE_DELETED;
}
@ailabs-software
ailabs-software / gist:6401599
Created September 1, 2013 00:41
iostat -mdx
[root@server1 ~]# iostat -mdx
Linux 2.6.32.12-0.7.1.xs6.0.0.529.170661xen (server1.bpilotglobal.com) 08/31/2013
Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await svctm %util
sda 0.00 0.53 0.06 1.85 0.00 0.02 26.12 0.06 32.92 13.32 2.53
sda1 0.00 0.51 0.01 0.40 0.00 0.00 18.22 0.02 43.35 31.36 1.29
sda2 0.00 0.00 0.00 0.00 0.00 0.00 4.27 0.00 0.64 0.63 0.00
sda3 0.00 0.02 0.05 1.44 0.00 0.02 28.30 0.04 30.05 10.00 1.49
dm-0 0.00 0.00 0.00 0.00 0.00 0.00 24.43 0.00 21.08 21.08 0.00
dm-7 0.00 0.00 0.01 0.17 0.00 0.00 21.22 0.01 32.65 12.74 0.23
@ailabs-software
ailabs-software / gist:6401538
Created September 1, 2013 00:28
iostat output from Citrix XenServer hypervisor
avg-cpu: %user %nice %system %iowait %steal %idle
0.05 0.00 0.01 0.31 0.01 99.62
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 1.90 1.68 48.01 63143343 1805284856
sda1 0.41 0.14 7.33 5445674 275530920
sda2 0.00 0.00 0.00 14482 0
sda3 1.49 1.53 40.68 57682131 1529753936
dm-0 0.00 0.00 0.00 30184 526
dm-7 0.18 0.37 3.44 13877301 129451979
presidentuncletom=# SELECT name, ARRAY(SELECT (title, id) FROM groups_map RIGHT OUTER JOIN
groups ON (groups_map.group_id = groups.id) WHERE groups_map.item_id=person.id)
AS groups FROM person;
name | groups
-----------------+----------------------------------------------------
Harley Earl | {}
Henry Ford | {"(\"industry mogul\",1)","(\"capital mogul\",2)"}
Rick Wagoner | {}
Alfred P. Sloan | {"(\"industry mogul\",1)","(\"capital mogul\",2)"}
Bob Eaton | {}
@ailabs-software
ailabs-software / Why can't I use Python conditionals to select the function to invoke to return the value to .append()?
Created January 12, 2013 16:42
Why can't I use Python conditionals to select the function to invoke to return the value to .append()?
def writeConfigString(endpointsTuple):
for endpoint in endpointsTuple:
generatedLines.append( (if ENDPOINT_TYPE['STATIC'] == endpoint['type'] generateStaticEndpoint else if ENDPOINT_TYPE['SERVICE'] == endpoint['type'] else None)(endpoint['uri'], endpoint['destination']) )