Skip to content

Instantly share code, notes, and snippets.

# Generated by Django 2.2.8 on 2020-07-10 13:12
from django.db import migrations
def reverse(apps, schema_editor):
pass
class Migration(migrations.Migration):
@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.
From http://www.agcs.com/patterns/papers/respat.htm
Resign Patterns
Ailments of Unsuitable Project-Disoriented Software
by
Michael Duell
[email protected]
Abstract
$ cd path/to/submodule
$ git add <stuff>
$ git commit -m "comment"
$ git push
Then tell your main project to track the updated version:
$ cd /main/project
$ git add path/to/submodule
$ git commit -m "updated my submodule"
@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]
from __future__ import division
import doctest
def humanize_bytes(bytes, precision=1):
"""Return a humanized string representation of a number of bytes.
Assumes `from __future__ import division`.
>>> humanize_bytes(1)
@saxix
saxix / attributes.py
Created December 23, 2013 21:00
context manager to temporary set/delete object's attributes
DELETE_ATTRIBUTE = object()
@contextmanager
def attributes(*values):
""" context manager to temporary set/delete object's attributes
:param values: tulples of (target, name, value)
Es.
with attributes((django.contrib.admin.ModelAdmin, 'list_per_page', 200)):