Skip to content

Instantly share code, notes, and snippets.

View constantineg1's full-sized avatar

constantineg1

View GitHub Profile
@constantineg1
constantineg1 / zappa-flask-zero2prod-01.docs
Created February 26, 2017 18:28
Zero to Prod / Flask @ Ubuntu 14.04
Instructions to create and deploy production ready web app to Lambda
Dev environment @ Ubuntu 14.04
#Install python 2.7.9 (to resolve urllib3\util\ssl_.py: SNIMissingWarning, InsecurePlatformWarning.
#https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings)
sudo apt-get install -y gcc-multilib g++-multilib libffi-dev libffi6 libffi6-dbg python-crypto python-mox3 python-pil python-ply libssl-dev zlib1g-dev libbz2-dev libexpat1-dev libbluetooth-dev libgdbm-dev dpkg-dev quilt autotools-dev libreadline-dev libtinfo-dev libncursesw5-dev tk-dev blt-dev libssl-dev zlib1g-dev libbz2-dev libexpat1-dev libbluetooth-dev libsqlite3-dev libgpm2 mime-support netbase net-tools bzip2
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar xfz Python-2.7.9.tgz
cd Python-2.7.9/
@constantineg1
constantineg1 / BuildTimeLapseViewController.swift
Created December 21, 2016 22:56 — forked from acj/ATTENTION.md
Build a movie from jpeg images in Swift using AVFoundation
//
// BuildTimelapseViewController.swift
//
// Created by Adam Jensen on 5/9/15.
//
import JGProgressHUD
import JoePro
import UIKit
@constantineg1
constantineg1 / analytic_wfm.py
Created December 2, 2016 03:52 — forked from sixtenbe/analytic_wfm.py
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See
@constantineg1
constantineg1 / matrix_transformation.py
Last active November 15, 2016 07:29
Matrix Transformation (Turn Left / Turn Right) / Python
t = np.arange(16).reshape((4, 4))
t_r90 = np.zeros((4, 4)) #90 deg right
t_l90 = np.zeros((4, 4)) #90 deg left
t_180 = np.zeros((4, 4)) #180 deg
N = t.shape[0]
for x in range(0,N):
for y in range(0,N):
x1=y
y1=N-x-1
@constantineg1
constantineg1 / googlenet.py
Created November 5, 2016 21:18 — forked from joelouismarino/googlenet.py
GoogLeNet in Keras
from scipy.misc import imread, imresize
from keras.layers import Input, Dense, Convolution2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Dropout, Flatten, merge, Reshape, Activation
from keras.models import Model
from keras.regularizers import l2
from keras.optimizers import SGD
from googlenet_custom_layers import PoolHelper,LRN
def create_googlenet(weights_path=None):
@constantineg1
constantineg1 / install_ffmpeg_ubuntu.sh
Created November 2, 2016 12:14 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@constantineg1
constantineg1 / wwdc.sh
Created September 27, 2016 09:14 — forked from idiomatic/wwdc.sh
Fetch WWDC videos, slides, and sample code.
#!/bin/bash
# usage: get [ RESOLUTION [ YEAR [ IDS... ] ] ]
resolution=${1:-SD}
year=${2:-2015}
shift
shift
ids=$*
RESOLUTION=$(echo $resolution | tr '[:lower:]' '[:upper:]')
extension NSImage {
func tint(color: NSColor) -> NSImage {
let targetImage = copy() as! NSImage
targetImage.lockFocus()
color.set()
NSRectFillUsingOperation(NSRect(origin: NSZeroPoint, size: size), .CompositeSourceAtop)
targetImage.unlockFocus()
return targetImage
}
}
extension NSImage{
static func create(imageRef:CGImage)->NSImage{
let width:Int = Int(CGImageGetWidth(imageRef))
let height:Int = Int(CGImageGetHeight(imageRef))
return NSImage(CGImage: imageRef, size: NSSize(width: width, height: height))
}
}
extension NSImage{
func resize(targetSize:NSSize) -> NSImage {
let newImage = NSImage(size: targetSize)
newImage.lockFocus()
self.drawInRect(NSMakeRect(0, 0, targetSize.width, targetSize.height), fromRect: NSMakeRect(0, 0, self.size.width, self.size.height), operation: NSCompositingOperation.CompositeSourceOver, fraction: CGFloat(1))
newImage.unlockFocus()
newImage.size = targetSize
return NSImage(data: newImage.TIFFRepresentation!)!
}
}