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
#!/usr/bin/env node | |
require('fs').readFile('image.png',function(err, data){ | |
console.log(require('crypto').createHash('sha1').update(data).digest('hex')) | |
}) |
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
request = require 'request' | |
youTubeMovieInfo = | |
youTubeMovieId: 'videoId' | |
url = "http://www.youtube.com/get_video_info?video_id=#{youTubeMovieInfo.youTubeMovieId}" | |
request.get url, (err, res, body) -> | |
return callback(false) if err | |
return callback(false) if res.statusCode isnt 200 |
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
// This is the Android version of the Tweetie-like pull to refresh table: | |
// http://developer.appcelerator.com/blog/2010/05/how-to-create-a-tweetie-like-pull-to-refresh-table.html | |
var win = Ti.UI.currentWindow; | |
var alertDialog = Titanium.UI.createAlertDialog({ | |
title: 'System Message', | |
buttonNames: ['OK'] | |
}); | |
var scrollView = Ti.UI.createScrollView({ |
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
# dependencies. | |
charsetDetector = require 'node-icu-charset-detector' | |
Buffer = require('buffer').Buffer | |
Iconv = require('iconv').Iconv | |
# this is it. | |
iconv = new Iconv charsetDetector.detectCharset(data).toString(), 'UTF-8' | |
buffer = iconv.convert data | |
text = buffer.toString() |
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
# coding=UTF-8 | |
import nltk | |
from nltk.corpus import brown | |
# This is a fast and simple noun phrase extractor (based on NLTK) | |
# Feel free to use it, just keep a link back to this post | |
# http://thetokenizer.com/2013/05/09/efficient-way-to-extract-the-main-topics-of-a-sentence/ | |
# Create by Shlomi Babluki | |
# May, 2013 |
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 io.recom.howabout.category.music.net; | |
import java.io.UnsupportedEncodingException; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Random; | |
import java.util.UUID; | |
import java.util.regex.Matcher; |
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
filetype off | |
call pathogen#runtime_append_all_bundles() | |
filetype plugin indent on | |
set nocompatible | |
set modelines=0 | |
set tabstop=4 | |
set shiftwidth=4 |
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
treeString = '''(ROOT (S (NP (PRP They)) (VP (VP (VBD were) (VP (VBN cost) (S (ADJP (JJ effective))))) (, ,) (VP (VBD held) (PRT (RP up)) (NP (NP (JJ great)) (, ,) (NP (DT no) (NNS leaks)) (, ,) (NP (DT no) (NNS dyes)) (CC or) (NP (JJ harsh) (NNS chemicals)))) (, ,) (CC and) (VP (VBD had) (NP (NP (DT a) (JJ simple) (NN design)) (PP (IN on) (NP (DT the) (NN outside)))))) (. .)))''' | |
parsedList = [] | |
wordIndex = 1 | |
parseRecursive = (treeString, currentPosition) -> | |
treeString = treeString[1..-2] | |
splittedTokens = treeString.split(' ') | |
firstToken = splittedTokens[0] |
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
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common | |
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev | |
sudo rm -rf /usr/local/share/vim | |
sudo rm /usr/bin/vim | |
sudo mkdir /usr/include/lua5.1/include | |
sudo cp /usr/include/lua5.1/*.h /usr/include/lua5.1/include/ |
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
# set the default region for the AWS CLI | |
export AWS_DEFAULT_REGION=$(curl --retry 5 --silent --connect-timeout 2 http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}') | |
export JAVA_HOME=/etc/alternatives/jre | |
export HADOOP_CONF_DIR=/etc/hadoop/conf | |
export SPARK_HOME=/usr/lib/spark | |
export SPARK_WORKER_DIR=/var/run/spark/work | |
export EXTRA_CLASSPATH=/usr/lib/hadoop-lzo/lib/hadoop-lzo.jar:/etc/hive/conf | |
export SPARK_LOCAL_IP=$(ec2-metadata -o | cut -d ' ' -f2) | |
export SPARK_LOCAL_HOSTNAME=$(ec2-metadata -h | cut -d ' ' -f2) |
OlderNewer