Skip to content

Instantly share code, notes, and snippets.

View chrismiles's full-sized avatar

Chris Miles chrismiles

View GitHub Profile
@chrismiles
chrismiles / gist:8bbdbb74fab79b290298
Created November 3, 2014 06:19
discoveryd_kick.sh
#!/bin/sh
set -x
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
sleep 10
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist

Keybase proof

I hereby claim:

  • I am chrismiles on github.
  • I am chrismiles (https://keybase.io/chrismiles) on keybase.
  • I have a public key whose fingerprint is 830F F4A6 3613 7F3F 87DA C42D CE2B 7306 7333 35C2

To claim this, I am signing this object:

@chrismiles
chrismiles / cggradient.swift
Created August 7, 2014 12:02
Core Graphics gradient drawing with Swift? No problem.
let colorSpace = CGColorSpaceCreateDeviceRGB()
let componentCount : UInt = 4
let components : [CGFloat] = [
0, 0, 0, 0,
1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0,
0, 0, 0, 0
]
echo "HD Video Download"
curl https://developer.apple.com/videos/wwdc/2014/ | grep -iIoh 'http.*._hd_.*dl=1">HD' | sed -e 's/\?dl=1">HD//g' | xargs -n1 wget -N
echo "PDFs Download"
curl https://developer.apple.com/videos/wwdc/2014/ | grep -iIoh 'http.*.pdf' | sed -e 's/\?dl=1">PDF//g' | xargs -n1 wget -N
@chrismiles
chrismiles / reveal.py
Last active September 2, 2021 00:26
Lazy script to wrap Reveal lib load/start commands in one LLDB command.
""" File: reveal.py
Add to ~/.lldbinit:
command script import ~/.lldb-scripts/reveal.py
Q: Want to automatically load the Reveal lib on launch while debugging from Xcode?
A: In Xcode:
Add a Symbolic Breakpoint
Symbol: "UIApplicationMain"
Action: Debugger Command with value "reveal"
@chrismiles
chrismiles / Main Program.h
Created February 3, 2013 08:01
Invalid source code generated by SLE Sensor Tag iOS app. Ref TI forum thread http://e2e.ti.com/support/low_power_rf/f/538/t/243474.aspx
//
// Main Program.h
//
//
// Created by BLE Sensor Tag.
//
//
#include <CoreBluetooth/CoreBluetooth.h>
#include "Sensors.h"
@chrismiles
chrismiles / UIImageView+CMAsyncExtension.m
Created March 6, 2012 02:23
UIImageView (CMAsyncExtension) - async load image from URL
@interface UIImageView (CMAsyncExtension)
- (void)asyncLoadImageFromURL:(NSURL *)imageURL;
@end
@implementation UIImageView (CMAsyncExtension)
- (void)asyncLoadImageFromURL:(NSURL *)imageURL
{
@chrismiles
chrismiles / NSArray+CMRandomised.h
Created October 15, 2011 05:23
Return a randomised copy of an NSArray
//
// NSArray+CMRandomised.h
//
// Copyright 2011 Chris Miles. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@chrismiles
chrismiles / ModelUtil.h
Created June 22, 2011 08:28
My Core Data model helper functions
//
// ModelUtil.h
//
// Copyright 2011 Chris Miles. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@chrismiles
chrismiles / UIView+CMExtras.h
Created June 9, 2011 09:24
UIView class extension with some of my handy convenience methods
//
// UIView+CMExtras.h
//
// Created by Chris Miles on 9/06/11.
// Copyright 2011 Chris Miles.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell