Skip to content

Instantly share code, notes, and snippets.

# Make sure Debian is the latest and greatest
apt-get update
apt-get upgrade
apt-get dist-upgrade
# Install X, LXDE, VPN programs
apt-get install xorg lxde-core tightvncserver
# Start VNC to create config file
#!/bin/bash
# A simple cURL OAuth2 authenticator
# depends on Python's built-in json module to prettify output
#
# Usage:
# ./google-oauth2.sh create - authenticates a user
# ./google-oauth2.sh refresh <token> - gets a new token
#
# Set CLIENT_ID and CLIENT_SECRET and SCOPE
@martinbowling
martinbowling / gist:5197533
Created March 19, 2013 16:19
MonoTouch loop through fonts
String fonts = "--------------------------------------\n";
List<String> fontFamilies = new List<String> (UIFont.FamilyNames);
fontFamilies.Sort ();
foreach (String familyName in fontFamilies) {
foreach (String fontName in UIFont.FontNamesForFamilyName (familyName)) {
fonts += familyName;
fonts += "\t";
fonts += fontName;
fonts += "\n";
}
@martinbowling
martinbowling / UIImageHelper.cs
Created September 13, 2012 23:25
Helper Class for getting 16x9 Tall iPhone5+ images
using System;
using System.Drawing;
using MonoTouch.UIKit;
using System.IO;
public static class UIImageHelper
{
private static string tallMagic = "-568h@2x";
public static UIImage FromBundle16x9(string path)
@martinbowling
martinbowling / ViewExtensions.cs
Created June 17, 2012 16:29 — forked from ChuckSavage/ViewExtensions.cs
MonoTouch Swipe Event
using System.Collections.Generic;
using MonoTouch.Foundation;
using MonoTouch.ObjCRuntime;
using MonoTouch.UIKit;
namespace iOSLib
{
public static class ViewExtensions
{
static Dictionary<UIView, Dictionary<UISwipeGestureRecognizerDirection, SwipeClass>>
@martinbowling
martinbowling / AppDelegate.cs
Created April 11, 2012 17:41 — forked from conceptdev/AppDelegate.cs
CoreImage quick'n'dirty sample: Contrast/Saturation/Brightness editing (screenshot http://twitpic.com/93gfty)
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace ColorControl {
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
public void sendTweet(string updateText)
{
ACAccountStore account = new ACAccountStore();
var accountType = account.FindAccountType(ACAccountType.Twitter);
account.RequestAccess(accountType,(granted,NSError)=> {
if(!granted)
return;
var arrayOfAccounts = account.FindAccounts(accountType);
if(arrayOfAccounts != null && arrayOfAccounts.Length == 0)
@martinbowling
martinbowling / gist:1987596
Created March 6, 2012 17:23 — forked from eric/gist:701636
ReaderJSController.originalArticleFinder()
/* ReaderJSController.originalArticleFinder(): */
{
"contentDocument": [object HTMLDocument],
"didSearchForArticleNode": true,
"article": [object Object],
"didSearchForPrependedArticleNode": true,
"prependedArticle": null,
"_cachedScrollY": 0,
"_cachedScrollX": 0,
"_elementsWithCachedBoundingRects": [object HTMLDivElement],
using System;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.AudioToolbox;
namespace GoogleMusic
{
public class LevelMeter : UIView
{
public AudioQueueLevelMeterState[] AudioLevelState {get;set;}
@martinbowling
martinbowling / gist:1952000
Created March 1, 2012 18:34 — forked from Clancey/gist:1437549
Android State Manager
using System;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
public class StateManager
{
public StateManager ()
{
}