Skip to content

Instantly share code, notes, and snippets.

@foundry
foundry / random_weights.pl
Created December 1, 2012 13:52
various weighted random number algorithms in perl
#!/usr/bin/perl
=comment
various attempts at getting weighted random number distributions
first,second are dice-roll convergences
(if you roll multiple die multiple times the results will converge on a normal curve)
http://en.wikipedia.org/wiki/Central_limit_theorem
boxmuller gives a normal/gaussian distribution (classic bell curve)
rayleigh and weibull have more variables to play with
@foundry
foundry / .gitignore
Last active December 10, 2015 04:48 — forked from adamgit/.gitignore
#########################
#update 19 September 2015
# Xcode 7 introduces a new file .xcscmblueprint
# following this advice
# http://stackoverflow.com/questions/31584297/xcode-7-ignore-xcscmblueprint-in-repository
*.xcscmblueprint
#########################
#########################
@foundry
foundry / UIImage+Rotate.h
Last active March 11, 2016 23:38
UIKit rotation category on UIImage
//
// UIImage+Rotate.h
//
// Created by Foundry on 21/09/2013.
//
#import <UIKit/UIKit.h>
@interface UIImage (Rotate)
@foundry
foundry / gist:7169773
Created October 26, 2013 13:59
bash_profile additions to show your current git branch
:parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1="\[\033[0;31m\]\h:\w\n\u\$(parse_git_branch)>\[\033[0m\] "
@foundry
foundry / Progressive image loading for iOS
Last active September 8, 2018 00:13
Progressive image loading for iOS. This is a GIST - detailed implementation is left as an exercise for the reader.
/*
typical usage (FYImageStore is a singleton)
[[FYImageStore instance] retrieveFullsizeImageFromPath:path
completion:^(UIImage* image){
self.imageView.image = image
}];
*/
#import "FYImageURL.h" //URL-building utilities, omitted from this Gist.
@foundry
foundry / gist:b6b4cedbcaed86fdf434
Created June 8, 2015 11:20
Crashlytics logging macro
//
// WNLog.h
// testCrash
//
// Created by foundry on 08/06/2015.
// Copyright (c) 2015 foundry. All rights reserved.
//
#ifndef testCrash_WNLog_h
#define testCrash_WNLog_h
@foundry
foundry / gist:d677255c07862c1dd044
Created June 8, 2015 16:59
crash reporting log-tastic
0 | 00:06:36:297 | $ +[WNMediaItem(Methods) urlKeyForSize:]166
1 | 00:06:36:305 | $ -[WNGalleryCell prepareForReuse]200{{0, 0}, {154, 154}}
2 | 00:06:36:309 | $ -[WNGalleryCell prepareForReuse]201-[WNGalleryCell prepareForReuse]
3 | 00:06:36:312 | $ -[WNMediaItemFetcher cancelNotification:]207
4 | 00:06:36:315 | $ +[WNMediaItem(Methods) photoSizeString:]183
5 | 00:06:36:318 | $ -[WNMediaItemFetcher cancelNotification:]209 mediaItemID: 38240EFA-48F6-4C38-9B51-378A34F25179 size: WNPhotoSizeMedium
6 | 00:06:36:320 | $ +[WNMediaItem(Methods) photoSizeString:]183
7 | 00:06:36:323 | $ -[WNMediaItemFetcher cancelNotification:]212userInfoID: D8490E9A-3110-4884-8B49-A1F0D6F26DFB size: WNPhotoSizeMedium
8 | 00:06:36:327 | $ -[WNGalleryCell setSelected:]86-[WNGalleryCell setSelected:] 0
9 | 00:06:36:329 | $ -[WNGalleryCell update]178-[WNGalleryCell update] mongoID 05EF13CE-7E27-474A-A11F-21CB973A37A2 localID (null)
@foundry
foundry / peopledetect.cpp
Last active February 5, 2021 11:18
OpenCV Hog Descriptor trial
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "openCVUtils.h"
using namespace cv;
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "openCVUtils.h"
#include <iostream>
using namespace cv;
using namespace std;
static Mat _inImage;
static Mat _outImage;
//
// svm_hog.cpp
// OpenCVSamples
//
// Created by jonathan on 29/07/2015.
// Copyright (c) 2015 foundry. All rights reserved.
//
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"