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
| // List all files in a directory in Node.js recursively in a synchronous fashion | |
| var walkSync = function(dir, filelist) { | |
| var fs = fs || require('fs'), | |
| files = fs.readdirSync(dir); | |
| filelist = filelist || []; | |
| files.forEach(function(file) { | |
| if (fs.statSync(dir + file).isDirectory()) { | |
| filelist = walkSync(dir + file + '/', filelist); | |
| } | |
| else { |
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
| #first seen here: http://www.snip2code.com/Snippet/63701/Ansible-task-to-install-nvm-and-node | |
| # Here is how to install nvm and node in an Ansible task. | |
| # I tried a bunch of different things, and as usual it's simple, but you have to get it right. | |
| # The important part is that you have to shell with /bin/bash -c and source nvm.sh | |
| --- | |
| - name: Install nvm | |
| shell: > | |
| curl https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh | |
| creates=/home/{{ ansible_user_id }}/.nvm/nvm.sh |
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
| // Copyright 2007 Amazon Elena@AWS | |
| // http://aws.amazon.com/code/developertools/1137 | |
| // | |
| // Licensed under the Apache License, Version 2.0 (the "License"); | |
| // you may not use this file except in compliance with the License. | |
| // You may obtain a copy of the License at | |
| // | |
| // http://www.apache.org/licenses/LICENSE-2.0 | |
| // | |
| // Unless required by applicable law or agreed to in writing, software |
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
| #!/usr/bin/python3 | |
| #required libraries | |
| import sys | |
| import ssl | |
| import paho.mqtt.client as mqtt | |
| #called while client tries to establish connection with the server | |
| def on_connect(mqttc, obj, flags, rc): | |
| if rc==0: |
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
| #!/usr/bin/python3 | |
| #required libraries | |
| import sys | |
| import ssl | |
| import paho.mqtt.client as mqtt | |
| #called while client tries to establish connection with the server | |
| def on_connect(mqttc, obj, flags, rc): | |
| if rc==0: |
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
| # -*- coding: utf-8 -*- | |
| import json | |
| import urllib2 | |
| from M2Crypto import X509 | |
| from base64 import b64decode | |
| from M2Crypto.Err import M2CryptoError | |
| SNS_MESSAGE_TYPE_SUB_NOTIFICATION = "SubscriptionConfirmation" | |
| SNS_MESSAGE_TYPE_NOTIFICATION = "Notification" | |
| SNS_MESSAGE_TYPE_UNSUB_NOTIFICATION = "UnsubscribeConfirmation" |
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
| from time import strftime,gmtime,time | |
| import urllib2 | |
| import hmac | |
| import hashlib | |
| import base64 | |
| import string | |
| def publishAmazonSnsMsg(Subject,TopicArn,Message,AWSAccessKeyId,privatekey): | |
| #http://docs.amazonwebservices.com/AWSSimpleQueueService/2008-01-01/SQSDeveloperGuide/ | |
| amzsnshost = 'sns.us-east-1.amazonaws.com' |
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 | |
| function jsonval { | |
| temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop` | |
| echo ${temp##*|} | |
| } | |
| json=`curl -s -X GET http://twitter.com/users/show/$1.json` | |
| prop='profile_image_url' | |
| picurl=`jsonval` |
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
| using UnityEngine; | |
| using System.Collections; | |
| /// <summary> | |
| /// Utility class for working with planes relative to a camera. | |
| /// </summary> | |
| public static class CameraPlane | |
| { | |
| /// <summary> | |
| /// Returns world space position at a given viewport coordinate for a given depth. |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| </body> | |
| </html> |
NewerOlder