Skip to content

Instantly share code, notes, and snippets.

@sansumbrella
sansumbrella / query-sparsebundle-band-size.sh
Created November 4, 2012 17:10
Query band size of a sparsebundle (also accessible in Info.plist of bundle)
# find out how big the sparse-band-size is in a mounted volume
hdiutil info -verbose | grep band-size
# default Time Machine sparsbundle virtual-band-size = 16384 (8MB)
# create-sparsebundle's virtual-band-size = 262144 (128MB)
@sansumbrella
sansumbrella / EventDispatcher.cpp
Created August 3, 2009 07:02
C++ observer pattern for event handling.
#include "EventDispatcher.h"
void EventDispatcher::addListener( Listener *l )
{
mListeners.push_back(l);
}
void EventDispatcher::removeListener( Listener *l )
{
mListeners.erase( std::remove( mListeners.begin(), mListeners.end(), l ), mListeners.end() );
@sansumbrella
sansumbrella / circular.cpp
Last active December 19, 2021 19:20
Sample showing use of forward declarations to handle circular dependencies. Also note the use of weak_ptr to break circular references (which would leak).
#include <iostream>
#include <memory>
using namespace std;
/**
Demonstration of circular dependencies broken with forward declarations.
Compile like so:
clang++ -std=c++11 -stdlib=libc++ circular.cpp -o build/circular && build/circular
*/
@sansumbrella
sansumbrella / PrecipitationDownloader.py
Created February 10, 2011 19:54
Downloads the current day's precipitation shapefile from NOAA.
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
import commands
from datetime import date
def main():
downloadDaysData( date.today() )
@sansumbrella
sansumbrella / create-sparsebundle.sh
Created November 1, 2012 22:49
Sparse bundle creation for time machine on NAS.
# creates a sparsebundle disk image with a 128MB band size
MACHINE_NAME=your-machine-name
echo $MACHINE_NAME
hdiutil create -size 900g -type SPARSEBUNDLE -nospotlight -volname "Backup of $MACHINE_NAME" -fs "Case-sensitive Journaled HFS+" -imagekey sparse-band-size=262144 -verbose ./$MACHINE_NAME.sparsebundle
@sansumbrella
sansumbrella / ProjectSetup.md
Last active April 3, 2021 22:20
Brief instructions for project setup using submodules.

Instructions for project setup using submodules.

Initialization

# Add Cinder and Soso submodules, specifying the branches we want
git submodule add -b release --name Cinder git@github.com:sosolimited/Cinder.git lib/Cinder
git submodule add -b cinder --name Soso git@github.com:sosolimited/ofxSoso.git lib/ofxSoso
@sansumbrella
sansumbrella / build_for_tvos.sh
Last active March 16, 2021 14:50
Build OpenCV3 for tvos
#!/bin/bash
# Place this file adjacent to opencv and you should be able to build for tvos.
# The OpenCV CMakeLists.txt file is pretty huge, but it is well organized,
# so if you need to make changes, consult what options there are in that file.
# A whole bunch of compiler tests fail, but that doesn't seem to matter.
#
# After this runs CMake, you will want to build the binaries and install the headers.
# $ make -j 8
# $ make install
#
@sansumbrella
sansumbrella / LICENSE
Last active June 11, 2020 07:45
Reaction Diffusion Simulation in GLSL
/*
* Copyright (c) 2016 David Wicks, sansumbrella.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
@sansumbrella
sansumbrella / MapboxMap.css
Last active September 27, 2019 18:27
Copy of the Mapbox data-driven-lines sample using React+Hooks
.mapbox-map {
min-height: 100%;
width: 100%;
position: fixed;
top: 0;
left: 0;
}
@sansumbrella
sansumbrella / index.html
Last active June 21, 2019 21:29
Pickable 3D buildings with feature state and buildings plus
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Highlight 3D Building By ID</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.js"></script>
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.css" rel="stylesheet" />
<style>
body {