Skip to content

Instantly share code, notes, and snippets.

@corbett
corbett / figure_formatting.py
Created October 31, 2017 21:06
Create beautiful square figures with big labels and the correct number of ticks
def create_figure(size=3.6,nxticks=6):
import matplotlib
from matplotlib.ticker import MaxNLocator
figure=matplotlib.pyplot.figure(figsize=(size,size))
ax = figure.add_subplot(1, 1, 1, position = [0.2, 0.15, 0.75, 0.75])
ax.xaxis.set_major_locator(MaxNLocator(nxticks))
return ax
def format_axes(ax,xf='%d',yf='%d',nxticks=6,nyticks=6,labelsize=10):
import pylab
@corbett
corbett / git best practices.md
Last active July 22, 2019 16:42
git best practices

#to get started with dev -create a fork of the Signal-iOS repo https://github.com/WhisperSystems/Signal-iOS (click fork)

-clone that repo into a nice local directory

-add the original repository as a remote git remote add upstream https://github.com/WhisperSystems/Signal-iOS.git

Keybase proof

I hereby claim:

  • I am corbett on github.
  • I am corbett (https://keybase.io/corbett) on keybase.
  • I have a public key whose fingerprint is 9D7D 02B9 4503 4211 A414 943F 958C 7705 421C 3B6F

To claim this, I am signing this object:

s = Server.local;
TempoClock.default.tempo_(100/60);
s.recSampleFormat = "int16";
s.recChannels = 2;
(
var clock, sf1, sf2, cut1, cut2, group;
clock=ExternalClock(TempoClock.default);
@corbett
corbett / BulbViewController.m
Last active December 18, 2015 00:08
Relevant code snippet for Philips Hue SDK to be put into color loop mode
/* Just a snippet from a modified PHViewController.m in Philips Hue's iOS SDK.
Here I have a IBOutlet UISwitch *partyTimeSwitch
which is hooked up to a toggle Switch in my UI via Interface Builder */
/**
Action for the party mode button
*/
-(IBAction) switchValueChanged{
PHLightState *lightState = [[PHLightState alloc] init];
if(_partyTimeSwitch.on) {
[lightState setEffectMode:EFFECT_COLORLOOP];
@corbett
corbett / create_latex.py
Last active December 10, 2015 22:28
Takes images in the directory input via command line and resizes it to Latex floating image table of desired dimensions (rows x columns)
#!/usr/bin/env python
# encoding: utf-8
"""
create_latex.py
Created by Christine Corbett Moran on 2013-01-10.
Takes images in the directory input via command line and resizes it to Latex floating image table of desired dimensions (rows x columns)
usage: ~/Documents/Projects/astrophysics/Scripts/Plotting/create_latex.py 3 4 *png
@corbett
corbett / resizeForAndroid.py
Created September 12, 2012 08:18
resize images for Android
import os
import glob
from PIL import Image
from math import ceil
xhdpi2hdpi=0.75
hdpi2mdpi=2/3.
mdpi2ldpi=0.75
for asset in glob.glob('drawable-xhdpi/*png'):
img = Image.open(asset)
xhdpi = img.size
@corbett
corbett / QuickAndAccurateiOSLocation.m
Created March 17, 2012 15:55
Objective-C to obtain quick and accurate location in iOS
// setup
- (void)viewDidLoad
{
...
self.locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
locationManager.distanceFilter = 250;
self.desiredLocationFreshness = 15.0; // desired freshness in s
self.desiredLocationAccuracy = 100.0; // desired location accuracy in m