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
//utility method to return an array from comma separated string | |
//it will convert all trackInput into arrays. | |
private int seekLOOK(String trackInput, int startPoint) { | |
// TODO Auto-generated method stub | |
return 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
import tweetClassifier as tc | |
#example to check a sentence | |
tc.isWant("my car is broken") | |
#example to check a file having tweets | |
tc.wantFromFile('tweets_train.txt') | |
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 docker run -i -t -v <local path>/GoogleNews-vectors-negative300.bin:/app/GoogleNews-vectors-negative300.bin codeashu/twt-cats |
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 bash | |
#dependencies | |
sudo apt-get install -y build-essential libgoogle-glog-dev libgflags-dev libeigen3-dev\ | |
libopencv-dev libcppnetlib-dev libboost-dev libcurlpp-dev libcurl4-openssl-dev protobuf-compiler\ | |
libopenblas-dev libhdf5-dev libprotobuf-dev\ | |
libleveldb-dev libsnappy-dev liblmdb-dev libutfcpp-dev cmake | |
# few more | |
sudo apt-get install -y build-essential autoconf libtool pkg-config python-opengl python-imaging\ | |
python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4\ |
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/bash | |
kill -9 $(ps aux | grep 'uwsgi' | awk '{print $2}') | |
source /home/ubuntu/.env/myappenv/bin/activate | |
cd /home/ubuntu/myapp | |
kill -9 $(ps -aux | grep 'worker.py' | awk '{print $2}') | |
nohup redis-server & | |
nohup python -u worker.py > worker.out & | |
uwsgi --socket :8881 --plugin python --wsgi-file main.py --callable app --buffer-size 32768 --process 4 --logto /home/ubuntu/myapp/log/myapp.log & | |
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
import os | |
import redis | |
from rq import Worker, Queue, Connection | |
listen = ['default'] | |
redis_url = os.getenv('REDISTOGO_URL', 'redis://localhost:6379') | |
conn = redis.from_url(redis_url) |
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 install python-pip | |
sudo apt-get install python-virtualenv | |
# create a virtualenv | |
mkdir ~/.env | |
cd ~/.env | |
virtualenv myenv | |
#activate environment | |
source ~/.env/myenv/bin/activate |
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
# if language is not english | |
if lang[:2] != 'en': | |
text = text.replace(' ', '%2520') | |
text = u"text:Noto%20Sans_20:" + text | |
res = CloudinaryImage(image_url).image(transformation=[ | |
{"background": "black", "opacity": 80}, | |
{"width": 400, "height": 300, "crop": "scale"}, | |
{"overlay": text, "color": "yellow", "crop": "fit", "width": 300, "height": 250}, |
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
from moviepy.editor import * | |
from moviepy.video.tools.subtitles import SubtitlesClip | |
audio_path = "/path/to/audio/05022357-a41f-11e7-b42c-f45c89a1211f.mp4" | |
srt_path = "path/to/srt/06665ef8-a41f-11e7-b3eb-f45c89a1211f.srt" | |
image_path = '/path/to/image/DSC_0265.JPG' | |
#generate srt | |
generator = lambda txt: TextClip(txt, font='Arial', fontsize=16, color='white') | |
subtitles = SubtitlesClip(srt_path, generator) |
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
class ClosableSSEClient(SSEClient): | |
def close(self): | |
self.should_connect = False | |
self.retry = 0 | |
try: | |
self.resp.raw._fp.fp._sock.shutdown(socket.SHUT_RDWR) | |
self.resp.raw._fp.fp._sock.close() | |
except AttributeError: | |
pass | |
OlderNewer