Skip to content

Instantly share code, notes, and snippets.

View codeAshu's full-sized avatar
👋

Ashutosh Trivedi codeAshu

👋
View GitHub Profile
@codeAshu
codeAshu / pyrebase_fix_python_2.17.py
Last active July 13, 2018 04:49
Change these two functions in pyrebase to avoid the problem in closing stream.
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
#!/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 &
import pylab as pl
from itertools import cycle
def plot_2D(data, target, target_names):
colors = cycle('rgbcmykw')
target_ids = range(len(target_names))
pl.figure()
for i, c, label in zip(target_ids, colors, target_names):
pl.scatter(data[target == i, 0], data[target == i, 1],
c=c, label=label)
pl.legend()
import json
input_ls = []
f = open('inputTraining.txt')
for line in iter(f):
try:
input_ls.append(json.loads(line))
except ValueError:
print line +'is not a proper json line'
@codeAshu
codeAshu / fakemails.txt
Created July 27, 2018 07:10
List of all fake mail generators domains. Please double check before you add it, I have sourced it from other gists.
nobuma.com
15qm.com
nokiamail.com
sofimail.com
10minut.xyz
emailgo.de
inbax.tk
gowikifilms.com
mybitti.de
mierdamail.com