Skip to content

Instantly share code, notes, and snippets.

View appsandwich's full-sized avatar

Vinny Coyne appsandwich

View GitHub Profile
@hollance
hollance / neural.c
Last active April 21, 2023 17:13
Playing with BNNS on macOS 10.12. The "hello world" of neural networks.
/*
The "hello world" of neural networks: a simple 3-layer feed-forward
network that implements an XOR logic gate.
The first layer is the input layer. It has two neurons a and b, which
are the two inputs to the XOR gate.
The middle layer is the hidden layer. This has two neurons h1, h2 that
will learn what it means to be an XOR gate.
@rudelm
rudelm / autofs.md
Last active April 3, 2025 21:48
Use autofs on Mac OS X to mount network shares automatically during access

Autofs on Mac OS X

With autofs you can easily mount network volumes upon first access to the folder where you want to mount the volume. Autofs is available for many OS and is preinstalled on Mac OS X so I show you how I mounted my iTunes library folder using this method.

Prepare autofs to use a separate configuration file

autofs needs to be configured so that it knows where to gets its configuration. Edit the file /etc/auto_master and add the last line:

#
# Automounter master map
#

+auto_master # Use directory service

@prendio2
prendio2 / SUPTableViewController.m
Created March 26, 2014 15:05
Custom viewWillApear to restore selected row when transition is cancelled
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow];
if (selectedRowIndexPath) {
[self.tableView deselectRowAtIndexPath:selectedRowIndexPath animated:YES];
[[self transitionCoordinator] notifyWhenInteractionEndsUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if ([context isCancelled]) {
[self.tableView selectRowAtIndexPath:selectedRowIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@breeno
breeno / gist:7010222
Created October 16, 2013 15:57
Hooking NSNotificationCenter to trace all messages. Useful stuff!
CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(),
NULL,
notificationCenterHookProc,
NULL,
NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
void notificationCenterHookProc (CFNotificationCenterRef center,
void *observer,
@calvinmetcalf
calvinmetcalf / theme.html
Last active December 19, 2015 06:19 — forked from soemarko/theme.html
<!-- Add the following lines to theme's html code right before </head> -->
<link rel="stylesheet" href="//gist.github.com/assets/embed-bfcadee384027982121fdeb9930e78b2.css" />
<!-- add the folowing if jquery isn't already included in your theme-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<!-- add the following to the bottom of the theme-->
<script>
$(function() {
function makeGist(d){
var link = $($(d).html())[0];
@mmdumi
mmdumi / EncodePolyline
Created November 2, 2012 09:09
Encode polyline. Google Maps API v3 algorithm. Objective c.
+ (NSString *)encodeStringWithCoordinates:(NSArray *)coordinates
{
NSMutableString *encodedString = [NSMutableString string];
int val = 0;
int value = 0;
CLLocationCoordinate2D prevCoordinate = CLLocationCoordinate2DMake(0, 0);
for (NSValue *coordinateValue in coordinates) {
CLLocationCoordinate2D coordinate = [coordinateValue MKCoordinateValue];