Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.
I've tried to make it as lean and unobtrusive as possible.
errors/AppError.js
| import cv2 | |
| import time | |
| person_cascade = cv2.CascadeClassifier( | |
| os.path.join('/path/to/haarcascade_fullbody.xml')) | |
| cap = cv2.VideoCapture("/path/to/test/video") | |
| while True: | |
| r, frame = cap.read() | |
| if r: | |
| start_time = time.time() |
| callLog = []; | |
| /* set up an override for the Function call prototype | |
| * @param func the new function wrapper | |
| */ | |
| function registerOverride(func) { | |
| oldCall = Function.prototype.call; | |
| Function.prototype.call = func; | |
| } |
First, you have to enable profiling
> db.setProfilingLevel(1)
Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...
| Development Phase: | |
| Step 1: Create Certificate .pem from Certificate .p12 | |
| Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12 | |
| Step 2: Create Key .pem from Key .p12 | |
| Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12 | |
| Step 3: Optional (If you want to remove pass phrase asked in second step) | |
| Command : openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem |
| a = [1,2,3,4,2,1,5,6,2,1,2,3,7,6,3,2,1,2,3,6] | |
| n = len(a) | |
| m = 2 | |
| #Function to accept reference string and frame size. | |
| def accept(): | |
| global a,n,m | |
| a = [] | |
| n = input("\n Enter the size of reference string : ") | |
| for i in range(n): |
| ### | |
| #Step 1 - Generate server certificates etc... (most of this code is horribly ripped off from nodejs docs currently -> http://nodejs.org/docs/latest/api/tls.html) | |
| ### | |
| #Assuming your starting from a clean directory | |
| mkdir server | |
| cd server | |
| #generate private key |
| //Knapsack algorithm | |
| //================== | |
| // wikipedia: [Knapsack (0/1)](http://en.wikipedia.org/wiki/Knapsack_problem#0.2F1_Knapsack_Problem) | |
| // Given a set `[{weight:Number, benefit:Number}]` and a capacity, | |
| // find the maximum value possible while keeping the weight below | |
| // or equal to the capacity | |
| // **params**: | |
| // `capacity` : Number, | |
| // `items` : [{w:Number, b:Number}] | |
| // **returns**: |
| # View list of connections and their states | |
| netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c | |
| # List all connections and timers | |
| ss -rota | less |
| // ==UserScript== | |
| // @name Trello horizontal wheel scroll | |
| // @namespace http://chivil.com/ | |
| // @downloadUrl https://gist.github.com/romuald/57c28352911313524f10/raw | |
| // @version 0.9 | |
| // @description Scroll horizontally when using mouse wheel | |
| // @author Romuald Brunet | |
| // @match https://trello.com/b/* | |
| // @grant none | |
| // ==/UserScript== |