Skip to content

Instantly share code, notes, and snippets.

Avatar

Lou Franco loufranco

View GitHub Profile
@loufranco
loufranco / make3d.py
Created Jul 17, 2017
A Python script to make red/cyan 3D photos
View make3d.py
from PIL import Image
import sys
# Check arguments
if len(sys.argv) < 3:
print "Usage: python make3d.py <leftimage> <rightimage> <3doutputname>"
quit()
# Open the left and right images
imLeft = Image.open(sys.argv[1])
View simplify.cpp
#include <iostream>
using namespace std;
struct Const {
Const(int c) : c(c) {}
int c;
};
struct One : Const {
One() : Const(1) {}
@loufranco
loufranco / WrapPatternMatching.swift
Last active Aug 29, 2015
Wrapping Swift Pattern Matching in a Closure
View WrapPatternMatching.swift
import Foundation
import Darwin
// Given Box and Result definitions from "Functional Programming in Swift"
// Buy it here: http://objc.io/books
// You need Box because Swift can't handle generics in Enums directly
public class Box<T> {
let unbox:T
init(_ value:T) { self.unbox = value }
@loufranco
loufranco / capper.c
Created Apr 4, 2014
Capitalize the first uncapped word
View capper.c
char* capper(char* s, char* outs) {
strcpy(outs, s);
for (char* s2=outs; *s2; ++s2) {
if (islower(*s2) && (s2==outs || isspace(*(s2-1)))) {
*s2=toupper(*s2);
break;
}
}
return outs;
}