Skip to content

Instantly share code, notes, and snippets.

View josefmonje's full-sized avatar

@josefmonje josefmonje

View GitHub Profile
@josefmonje
josefmonje / Dockerfile
Last active September 4, 2017 16:43 — forked from alexellis/Dockerfile
Flask on FaaS - minimal example with CGI Handler
FROM python:2.7-alpine
ADD https://github.com/alexellis/faas/releases/download/0.5.6-alpha/fwatchdog /usr/bin
RUN chmod +x /usr/bin/fwatchdog
WORKDIR /root/
RUN pip install flask
ENV fprocess="python handler.py"
@josefmonje
josefmonje / Three Wise Monkeys.md
Created August 15, 2017 09:08
Three Wise Monkeys (NDA)

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?

@josefmonje
josefmonje / Contract Killer 3.md
Created August 15, 2017 09:05
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

Using TensorFlow for Fast Style Transfer

Directions for using TensorFlow with the Fast-Style-Transfer repo.

This aritcle assumes that you followed the setup directions found here OR that you have python correctly setup on your machine with an anaconda environment that has TensorFlow installed.

Clone the Fast-Style-Transfer repo: $ git clone https://github.com/lengstrom/fast-style-transfer.git

$ cd fast-style-transfer

# -*- coding: utf-8 -*-
# Copyright 2016 Matt Martz
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@josefmonje
josefmonje / HowToOTG.md
Created June 14, 2017 12:29 — forked from gbaman/HowToOTG.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@josefmonje
josefmonje / HowToOTGFast.md
Created June 14, 2017 11:20 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

###Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)
More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH is

@josefmonje
josefmonje / tmux-cheatsheet.markdown
Created January 21, 2017 16:21 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@josefmonje
josefmonje / fullquery
Created June 8, 2016 09:23 — forked from OllieJones/fullquery
Fast nearest-location finder for SQL (MySQL, PostgreSQL, SQL Server)
SELECT zip, primary_city,
latitude, longitude, distance
FROM (
SELECT z.zip,
z.primary_city,
z.latitude, z.longitude,
p.radius,
p.distance_unit
* DEGREES(ACOS(COS(RADIANS(p.latpoint))
* COS(RADIANS(z.latitude))
@josefmonje
josefmonje / betterpaginator.py
Created March 29, 2016 07:24 — forked from pylemon/betterpaginator.py
django: better paginator
from django.core.paginator import Paginator, EmptyPage
class BetterPaginator(Paginator):
"""An enhanced version of the Paginator"""
def __init__(self, getvars, *args, **kwargs):
"""default args are:
self, object_list, per_page, orphans=0, allow_empty_first_page=True