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
""" | |
Extract PDF text using PDFMiner. Adapted from | |
http://stackoverflow.com/questions/5725278/python-help-using-pdfminer-as-a-library | |
""" | |
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter#process_pdf | |
from pdfminer.pdfpage import PDFPage | |
from pdfminer.converter import TextConverter | |
from pdfminer.layout import LAParams |
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 python | |
# encoding: utf-8 | |
import os | |
import inspect | |
import time | |
import copy | |
from twisted.internet.protocol import Factory |
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
For development it may be useful to be able to replay TCP traffic (e.g. HTTP). The dump can be created using WireShark or tcpdump: | |
$ tcpdump -s 0 port http -i en0 -w dump.pcap | |
To generate data files that can be replayed through netcat we use tcptrace: | |
$ tcptrace -e input.pcapng | |
Finally replay the HTTP traffic using netcat to host 192.168.1.1 port 80 | |
$ cat a2b_contents.dat | nc -v 192.168.1.1 80 | |
If you need to replay the raw network traffic, we need to do some massaging using tcpprep and tcprewrite before using tcpreplay to replay the raw packages. Note that due to limitation of tcprewrite this will not replay any traffic to the network: http://tcpreplay.synfin.net/wiki/FAQ#Doestcpreplaysupportsendingtraffictoaserver. |
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
# | |
# written for Amazon Linux AMI | |
# creates an AWS Lambda deployment package for pytorch deep learning models (Python 3.6.1) | |
# assumes lambda function defined in ~/main.py | |
# deployment package created at ~/waya-ai-lambda.zip | |
# | |
# | |
# install python 3.6.1 | |
# |
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/sh | |
mkdir sox | |
cd sox | |
wget http://sourceforge.net/projects/sox/files/sox/14.4.2/sox-14.4.2.tar.gz | |
tar xvfz sox-14.4.2.tar.gz | |
cd sox-14.4.2 | |
./configure | |
make -s | |
make install |
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
height: 680 |
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
chrome.runtime.onStartup.addListener(function () { | |
chrome.storage.local.set({ | |
log: "" | |
}) | |
}); | |
chrome.runtime.onInstalled.addListener(function (a) { | |
var b = { | |
log: "" | |
}; | |
b.site_manifest = { |
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
sites: | |
"joinhoney.com | |
cravehoney.com | |
wanelo.com | |
wish.com | |
acehardware.com | |
ae.com | |
aeropostale.com | |
amazon.com |
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 numpy as np | |
import tensorflow as tf | |
def dense(x, weights, bias, activation=tf.identity, **activation_kwargs): | |
"""Dense layer.""" | |
z = tf.matmul(x, weights) + bias | |
return activation(z, **activation_kwargs) | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Training a model on browser</title> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest"></script> | |
<script lang="js"> | |
async function doTraining(model){ | |
const history = | |
await model.fit(xs, ys, |
OlderNewer