This file contains 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
/*Use Fiddler Proxy*/ | |
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888'); | |
/*Use Proxy*/ | |
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); | |
curl_setopt($ch, CURLOPT_PROXY, "IP:PORT"); | |
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "username:password"); |
This file contains 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
# Ref: http://wiki.mikejung.biz/Sysbench | |
# CPU | |
sysbench --test=cpu --cpu-max-prime=20000 run | |
sysbench --test=cpu --cpu-max-prime=20000 run --num-threads=4 | |
#FILE IO | |
sysbench --test=fileio --file-total-size=4G prepare | |
sysbench --test=fileio --file-total-size=4G --file-test-mode=rndrw --max-time=300 --max-requests=0 --file-extra-flags=direct run | |
sysbench --test=fileio --file-total-size=4G cleanup |
This file contains 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
touch ~/aspell.personal.txt | |
vi ~/aspell.personal.txt # add words per line | |
aspell --lang=en create master /tmp/en-personal.pws < ~/aspell.personal.txt | |
cp /tmp/en-personal.pws /usr/lib/aspell | |
vim /usr/lib/aspell/en_US.multi # add the line: 'add en-personal.pws' |
This file contains 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
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac |
This file contains 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
/* | |
Creating Synchronous Readable Stream in NodeJS | |
-------------------------------------------------- | |
When data is pushed synchronously to internal buffer, you'll get the synchronous | |
behaviour of the stream. This would block the rest of the code from being executed in | |
the next event loop iteration. | |
In the example setImmediate should be called immediatley in next event loop iteration. | |
But since the stream is synchronously reading data, it can't execute other callbacks. |
This file contains 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
db.collection.createIndex( { orderDate: 1, zipcode: -1 }, {background: true} ) | |
db.events.ensureIndex( { "timestampISO": 1 }, { expireAfterSeconds: 120*24*60*60 } ) // <3.0, TTL index, 120day retention period | |
db.collection.getIndexes() //get all indexes | |
db.collection.dropIndex("name"); //drop single index | |
db.collection.dropIndexes(); //drop all indexes | |
db.collection.find({ email: 'test@sendgrid.com' }).explain("executionStats") // <3.0 : https://docs.mongodb.org/manual/reference/method/cursor.explain/#cursor.explain | |
//https://docs.mongodb.org/manual/tutorial/measure-index-use/ | |
db.collection.explain("executionStats").find({ email: 'test@sendgrid.com' }) // 3.0 + | |
db.events.totalIndexSize() // in bytes, should not exceed RAM |
This file contains 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
/* | |
Creating Asynchronous Readable Stream in NodeJS | |
-------------------------------------------------------- | |
When data is pushed asynchronously to internal buffer, you'll get an asynchronous | |
behaviour of the stream. | |
See Synchronous Version: https://gist.github.com/hassansin/7f3250d79a386007ce45 | |
*/ | |
var Readable = require("stream").Readable; |
This file contains 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
ab \ | |
-n 1000 \ | |
-c 20 \ | |
-s 30 \ | |
-p post-data.txt \ | |
-T 'application/x-www-form-urlencoded; charset=UTF-8' \ | |
-v 3 \ | |
-H "X-Requested-With: XMLHttpRequest" \ | |
-H "X-Ajax-Referer: http://example.com" \ | |
-H "Accept-Encoding: gzip, deflate" \ |
This file contains 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/sh | |
# If commit message does not refer to any CH story number, | |
# this hook will parse the CH story from the current branch and | |
# append it to the commit message | |
# | |
# Example: | |
# Branch: hassansin/ch1643/custom-subdomains | |
# commit message: add support for EU base urls | |
# appended commit message: Add support for EU base urls [ch1643] |
This file contains 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
package main | |
import ( | |
"errors" | |
"fmt" | |
"math/rand" | |
"net/http" | |
"sync" | |
"time" |