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
| io.sockets.on('connection', function(socket) { | |
| const redisQueue = redis.createClient(port, hostname); | |
| redisQueue.subscribe('reporting'); | |
| socket.emit('connected', "connected to the server" ); | |
| count++; | |
| socket.emit('real-action', getVisitEvent(count)); | |
| socket.on('disconnect', function() { |
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
| <script src="/socket.io/socket.io.js"></script> | |
| <script type="text/javascript"> | |
| var socket = io.connect(); | |
| var presence = 0; | |
| socket.on('real-action', function(data) { | |
| presence = data.data; | |
| }); | |
| </script> |
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 str = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/12.0.782.220 Safari/535.1"; | |
| var found = (new RegExp("Chrome/1[2-3]", "g").exec(str)); | |
| alert(found); |
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
| cat /proc/cpuinfo | grep processor | wc -l |
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
| ssh eqsupport@192.168.20.22 su -l root -c \'eqcfg weight qa.platform.cinchcast.com:QA-Platform-AWS 100\' |
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/sh | |
| # | |
| # chkconfig: 35 99 99 | |
| # description: Node.js /home/nodejs/sample/app.js | |
| # | |
| . /etc/rc.d/init.d/functions | |
| USER="nodejs" |
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 | |
| # Danny Gershman | |
| # Cinchcast | |
| FILE="/tmp/out.$$" | |
| # Make sure only root can run our script | |
| if [ "$(id -u)" != "0" ]; then | |
| echo "This script must be run as root" 1>&2 | |
| 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
| # retrieve | |
| curl https://gist.github.com/radius314/4348083/download > centos5.8-upgrade-nodejs0.10.28.tar.gz | |
| # extract | |
| tar -xvf centos5.8-upgrade-nodejs0.10.28.tar.gz --strip 1 | |
| # prepare | |
| chmod 744 centos5.8-upgrade-nodejs0.10.28.sh | |
| # execute |
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/sh | |
| # | |
| # chkconfig: 35 99 99 | |
| # description: Node.js /home/nodejs/sample/app.js | |
| # | |
| . /etc/rc.d/init.d/functions | |
| USER="nodejs" |
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 async = require('async'); | |
| var obj = [ "apple", "banana", "orange", "pineapple", "kiwi", "watermelon", "grape" ]; | |
| function getObj(i, callback) { | |
| setTimeout(function() { | |
| console.log(i) | |
| callback(null); | |
| }, 2000); | |
| } |
OlderNewer