Skip to content

Instantly share code, notes, and snippets.

@serser
serser / libjpeg.sh
Last active July 6, 2017 10:26 — forked from dulacp/libjpeg.sh
Download & Compile Libjpeg for OSX (all architectures)
# Builds a Libjpeg framework for the OSX.
# This is a fork from:
# https://gist.github.com/dulaccc/25dbe620422c07e0253e
#===============================================================================
export SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk"
: ${LIB_VERSION:=8d}
: ${XCODE_ROOT:=`xcode-select -print-path`}
: ${TARBALLDIR:=`pwd`}
@serser
serser / mondrian.c
Last active July 28, 2017 04:07
Book of Shaders
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
@serser
serser / image_viewer.py
Last active November 22, 2017 09:23
using matplotlib to continously show a series of images without closing current window
# press any key like ESC to exit
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import scipy.misc
import glob
import os
import sys
@serser
serser / localization.py
Created November 25, 2017 15:14
Histogram filters, Monte-Carlo robot localization
# From cs373, my implementation based on
# https://classroom.udacity.com/courses/cs373/lessons/48684821/concepts/487362110923
#
# The function localize takes the following arguments:
#
# colors:
# 2D list, each entry either 'R' (for red cell) or 'G' (for green cell)
#
# measurements:
# list of measurements taken by the robot, each entry either 'R' or 'G'
@serser
serser / kalman_filter.py
Created November 30, 2017 07:27
2d Kalman filter from cs373
# a copy from https://classroom.udacity.com/courses/cs373/lessons/48696618/concepts/487431440923
# Fill in the matrices P, F, H, R and I at the bottom
#
# This question requires NO CODING, just fill in the
# matrices where indicated. Please do not delete or modify
# any provided code OR comments. Good luck!
from math import *
class matrix:
@serser
serser / get_italian_comuni.py
Created December 2, 2017 06:13
get list of italian community with wikitables
from wikitables import import_tables
import string
import json
import sys
title_fmt = "Comuni d'Italia (%s)"
alphabet=string.ascii_uppercase[:26]
titles = []
for i in range(26):
ch = alphabet[i]
# https://classroom.udacity.com/courses/cs373/lessons/48532754/concepts/487174160923
# --------------
# USER INSTRUCTIONS
#
# Now you will put everything together.
#
# First make sure that your sense and move functions
# work as expected for the test cases provided at the
# bottom of the previous two programming assignments.
# Once you are satisfied, copy your sense and move
# https://classroom.udacity.com/courses/cs373/lessons/48646841/concepts/487263470923
# ----------
# User Instructions:
#
# Define a function, search() that returns a list
# in the form of [optimal path length, row, col]. For
# the grid shown below, your function should output
# [11, 4, 5].
#
# If there is no valid path from the start point
@serser
serser / maze_path.py
Last active December 6, 2017 03:34
print out maze path
# -----------
# User Instructions:
#
# Modify the the search function so that it returns
# a shortest path as follows:
#
# [['>', 'v', ' ', ' ', ' ', ' '],
# [' ', '>', '>', '>', '>', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# https://classroom.udacity.com/courses/cs373/lessons/48646841/concepts/486468390923
# -----------
# User Instructions:
#
# Modify the the search function so that it becomes
# an A* search algorithm as defined in the previous
# lectures.
#
# Your function should return the expanded grid
# which shows, for each element, the count when