Skip to content

Instantly share code, notes, and snippets.

View niazangels's full-sized avatar
🔥
Beast mode: ON

Niyas Mohammed niazangels

🔥
Beast mode: ON
View GitHub Profile
@niazangels
niazangels / api-explosion.py
Last active April 24, 2017 08:04
Explosion NER api
import requests
import json
url = "https://api.explosion.ai/displacy/ent/"
HEADER = {'Content-type': 'text/plain'}
while True:
data = {'text':raw_input(), 'model':'en'}
data = json.dumps(data)
@niazangels
niazangels / lesson-6.ipynb
Last active May 24, 2017 20:47
3-char RNN model mostly always predicts a space
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@niazangels
niazangels / DRAGONS.txt
Last active July 8, 2017 11:19
DRAGONS.md
/*
, ,
/ \/ \
(/ //_ \_
.-._ \|| . \
\ '-._ _,:__.-"/---\_ \
______/___ '. .--------------------'~-'--.)__( , )\ \
`'--.___ _\ / | Here ,' \)|\ `\|
/_.-' _\ \ _:,_ Be Dragons " || (
.'__ _.' \'-/,`-~` |/
@niazangels
niazangels / render-malaylam-text.py
Created December 2, 2017 18:19
How to render malayalam text as images
from PIL import Image, ImageDraw, ImageFont
import matplotlib.pyplot as plt
import numpy as np
image = Image.new('RGB', (700, 40))
# Make sure the location to the font is correct
draw.text((40,5), 'നമ്മുടെ മലയാളം അടിപൊളിയായി ഇമേജിൽ വരുന്നു', font=ImageFont.truetype('./Manjari-Bold.ttf', 25))
plt.imshow(np.asarray(image))
@niazangels
niazangels / celery-flask-progressbar.py
Created January 22, 2018 19:11
Simple progressbar with Flask + Celery
'''
testing celery progress reporting/polling
* start server
python tempserver.py
* start worker
celery -A tempserver.celery worker -c 1 --loglevel=DEBUG
* browse to localhost:5000/
'''
from flask import Flask, request, render_template_string
@niazangels
niazangels / export-all-cypher.c
Last active January 28, 2018 14:10
Export entire Neo4j graph using APOC
// Export entire database
CALL apoc.export.graphml.all('/tmp/complete-graph.graphml', {useTypes:true, storeNodeIds:false})
@niazangels
niazangels / import-cypher.c
Last active January 28, 2018 14:15
Cypher query to import a graph from file using APOC
// Import from GraphML
CALL apoc.import.graphml('/tmp/complete-graph.graphml', {batchSize: 10000, storeNodeIds: false})
@niazangels
niazangels / pdf-2-tiff-2-txt.sh
Last active May 6, 2018 20:49 — forked from poppingtonic/extract.sh
convert a PDF to TIFF using gs, convert from TIFF to txt using tesseract
# $1 is the first argument
# remove result.txt
#rm output/result.txt
fname=`echo "$1" | awk -F "/" '{print $(NF)}'`
# convert the pdf to a group of tiffs
if [ ! -e extracted_tz_parliament/$fname.txt ];
then
@niazangels
niazangels / qa-sample.json
Last active August 7, 2018 17:34
Sample QA log document
{
"query": "how much revenue did we generate in the last quarter from XYZ Corp?",
"response": { ... }
}