Skip to content

Instantly share code, notes, and snippets.

@bvanderveen
bvanderveen / howtopython.md
Last active October 4, 2022 19:33
How to get Python on OS X

2022 M1 Mac OS 10.12.5

Download OpenSSL 1.1.1q source.

Extract and change into source directory. Applied this workaround (should be fixed in next openssl release, "r").

$ mkdir /opt && chown -R veen:staff /opt
$ ./config --prefix=/opt/openssl-1.1.1q
$ make -j 4 && make install

How even GPG

Good question. We'll assume a gpg2 install available at gpg.

Make a keypair

First you have to have a key-pair.

gpg --full-generate-key

@bvanderveen
bvanderveen / howtoruby.md
Last active September 4, 2016 21:44
How I installed Ruby on a clean Mac (August 2015)

First prepare your Mac for Developer Mode™.

  • xcode-select --install (now all sorts of stuff works)
  • Install homebrew

Install rbenv and use it to install a Ruby:

  • brew install rbenv ruby-build
  • echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
  • rbenv install
// view model
self.figureOutWhatToShowNext = [RACCommand commandWithCanExecuteSignal:self.okayToShowNextThing];
self.nextVM = [[self.figureOutWhatToShowNext addSignalBlock:^ RACSignal *(id value) {
return [self.model.figureItOut map:id (id x) { return x.boolValue ? [[OkayVM alloc] init] : [[NotOkayVM alloc] init] }];
] flatten];
// view
@bvanderveen
bvanderveen / controllersimulator.md
Created December 16, 2015 05:52
controller/simulator workbench

Some notions on making a simulator/control loop bench

With apologies to ML:

iteration :: setpoint -> system-state -> system-state
iteration sp sys = let 
    control-output = control (sp, sys.control-state, sys.dynamic-state)
    control-state' = fst control-output

control-signal = snd control-output

// from RichB, https://groups.google.com/forum/#!msg/kayak-http/ivzlD8HoF9w/7reCjodx2-AJ%5B1-25%5D
class FileProducer : IDataProducer
{
// Members
private string m_fileName;
private FileStream m_fileStream;
private IDataConsumer m_consumer;
@bvanderveen
bvanderveen / gist:3260382
Created August 4, 2012 22:34 — forked from jacksonh/gist:3257926
Objective-C assertion ideas
- (void) assertionIdeasLikeNUnit
{
[Assert that:@"foobar" is:[Equal to:@"other"]];
[Assert that:@"foobar" isNot:[Equal to:@"other"]];
[Assert that:collection isAll:[Less than:@10]];
[Assert that:collection isAll:[Less thanOrEqualTo:@10]];
[Assert that:collection isAll:[Less thanOrEqualTo:@10]];
[Assert that:collection isAll:[Greater than:@10]];
[Assert that:collection isAll:[Greater thanOrEqualTo:@10]];
@bvanderveen
bvanderveen / servo_4mixer.pde
Created July 7, 2012 20:41
Four-channel (pitch, roll, yaw, speedbrake) servo mixing algorthim for flying wing designs
int windowWidth;
int windowHeight;
float surfaceHeight = 50;
// sum should be 1
float kYaw = .5, kBrake = .5;
float[] mix(float pitch, float yaw, float roll, float brake) {
float brakeSeparation = kBrake * (1 + brake) / 2;
float yawMix = Math.max(kYaw, 1 - brakeSeparation);
@bvanderveen
bvanderveen / gist:1326305
Created October 30, 2011 19:20
OWIN request BodyDelegate in Environment Dictionary vs. passed to App Delegate
// body-in-env
void AppDelegate(IDictionary<string, object> env, Action<string, IDictionary<string, string>, BodyDelegate> result, Action<Error> error) {
var requestBody = (BodyDelegate)env["owin.RequestBody"];
...
}
// body-as-arg
@bvanderveen
bvanderveen / DefaultContentType.cs
Created August 16, 2011 00:25
Set a default content-type with an OWIN middleware
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gate;
using Gate.Kayak;
using Nancy.Hosting.Owin;
using Gate.Helpers;
namespace KayakNancyTest01