Skip to content

Instantly share code, notes, and snippets.

@saxix
saxix / read-flowfile-contents.py
Created July 18, 2018 12:49 — forked from ijokarumawak/read-flowfile-contents.py
Example Python script to use from NiFi ExecuteScript processor which reads the first line from an incoming flow file.
from org.apache.nifi.processors.script import ExecuteScript
from org.apache.nifi.processor.io import InputStreamCallback
from java.io import BufferedReader, InputStreamReader
class ReadFirstLine(InputStreamCallback) :
__line = None;
def __init__(self) :
pass

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@saxix
saxix / instagram_unshred.py
Created March 9, 2016 21:24 — forked from maebert/instagram_unshred.py
Instagram Engineering Challenge in 20 lines of code
# For an explanation of this code, see
# http://portwempreludium.tumblr.com/post/13108758604/instagram-unshredding
import PIL.Image, numpy, fractions
image = numpy.asarray(PIL.Image.open('TokyoPanoramaShredded.png').convert('L'))
diff = numpy.diff([numpy.mean(column) for column in image.transpose()])
threshold, width = 1, 0
def sequence(conn, start):
seq = [start]