Skip to content

Instantly share code, notes, and snippets.

@mickm
mickm / main.cpp
Created September 13, 2019 16:19
astra fps test case
// usage:
// run this with the mini and stereo s and compare the fps in different light conditions
// the fps will drop on the stereo s in low light
// the mini maintains 30 fps in all lighting conditions
// seems like the autoexposure works differently (aperture priority vs shutter priority maybe?) on the stereo s vs the mini
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <astra/capi/astra.h>
@mickm
mickm / gist:4161975cfe98d8d30179
Created April 16, 2015 18:17
rgba -> png example
#!/usr/bin/env node
var Png = require('png').Png; // https://github.com/pkrumins/node-png
var fs = require('fs');
var size = 256;
var rgba = new Buffer(size*size*4);
var x, y;
var png;
/*
* bits - pretty-print bits from a hex/dec/oct input
*
* cc -ansi -pedantic -Wall -o bits bits.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <stdint.h>
@mickm
mickm / gist:7832447
Created December 6, 2013 21:31
dump tables, sequences, indices, constraints and data (no languages, functions, types, etc.)
pg_dump --no-owner --no-privileges $(paste -sd\ <(echo '\dt' |psql -At |awk -F\| '{print $2}' |egrep -v '^(spatial_ref_sys|geometry_columns)$' |xargs -n 1 echo -t))
% strings /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal |grep adjustedRelative
colorForANSIColor:adjustedRelativeToColor:
colorForExtendedANSIColor:adjustedRelativeToColor:
%
@mickm
mickm / gist:6315020
Created August 23, 2013 02:41
ARM auto-vectorization gcc flags
# -O3 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -funsafe-math-optimizations -fsingle-precision-constant
@mickm
mickm / nginx.rb
Last active December 12, 2015 04:38
require 'formula'
class Nginx < Formula
homepage 'http://nginx.org/'
url 'http://nginx.org/download/nginx-1.2.6.tar.gz'
sha1 '432059b668e3f018eab61f99c7cc727db88464e8'
devel do
url 'http://nginx.org/download/nginx-1.3.10.tar.gz'
sha1 '11cd44bc0479594fd2e5f7a65bf8f2c36ad5ec1e'
@mickm
mickm / update-pingdom-iptables.sh
Created November 21, 2012 20:21
Whitelist Pingdom probe-servers in iptables.
#!/bin/bash
#
# Whitelist Pingdom probe-servers in iptables.
#
# Create a chain called "PINGDOM" and jump to it somewhere before
# the final REJECT/DROP, e.g.
#
# # New chain for Pingdom rules
# :PINGDOM - [0:0]
#
@mickm
mickm / 0-readme.md
Created May 27, 2012 18:02 — forked from sj26/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p194 with patches for boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

@mickm
mickm / top_terms.rb
Created February 24, 2012 15:27
Pull top site search terms and top search engine terms from GA
#!/usr/bin/env ruby
GA_USER = '[email protected]'
GA_PASS = 'secrets!'
GA_PROPERTY = 'UA-8411317-51'
require 'rubygems'
require 'garb'
class SiteSearchTerms