Skip to content

Instantly share code, notes, and snippets.

@garyjohnson
garyjohnson / rpi_disable_wifi_power_mgmt.sh
Created November 28, 2014 04:22
Raspberry Pi - Disable Wifi Power Management
#!/bin/bash
sudo echo -e "wireless-power off" >>/etc/network/interfaces
sudo echo -e "options 8192cu rtw_power_mgnt=0" >>/etc/modprobe.d/8192cu.conf
sudo echo -e "options 8188eu rtw_power_mgnt=0" >>/etc/modprobe.d/8188eu.conf
@garyjohnson
garyjohnson / udp_ios.m
Created February 1, 2014 13:24
UDP Multicast Chat for Different Mobile Platforms
#import "ViewController.h"
#import <netinet/in.h>
#import <sys/socket.h>
#import <CFNetwork/CFSocketStream.h>
#include <arpa/inet.h>
@interface ViewController()
-(void)openSocket;
# http://www.mono-project.com/Compiling_Mono_on_OSX
require 'formula'
class Mono < Formula
#url 'http://download.mono-project.com/sources/mono/mono-3.0.6.tar.bz2'
#sha1 'e2187f80366fcd65c55a1ab946f8d3b39e81be77'
url 'http://download.mono-project.com/sources/mono/mono-2.10.9.tar.bz2'
sha1 '1a6e8c5a0c3d88d87982259aa04402e028a283de'
@garyjohnson
garyjohnson / Compare-VB.ps1
Created March 7, 2013 15:44
Powershell script for comparing CS to VB file
Function Compare-VB($csFilePath) {
$tempFile = [System.IO.Path]::GetTempPath() + [guid]::NewGuid() + ".vb"
& 'C:\Program Files\InstantVB\InstantVB.exe' $csFilePath $tempFile
WaitForFile($tempFile)
& 'C:\Program Files (x86)\Beyond Compare 3\BCompare.exe' $csFilePath.Replace(".cs",".vb") $tempFile
}
Function WaitForFile($path) {
while(!(Test-Path $path)) {
Start-Sleep -s 1
@garyjohnson
garyjohnson / svnconfig
Created February 12, 2013 15:54
SVN config file
### This file configures various client-side behaviors.
###
### The commented-out examples below are intended to demonstrate
### how to use this file.
### Section for authentication and authorization customizations.
[auth]
### Set password stores used by Subversion. They should be
### delimited by spaces or commas. The order of values determines
### the order in which password stores are used.
@garyjohnson
garyjohnson / UbuntuEC2Script
Created February 10, 2013 16:12
Getting Ubuntu EC2 instance up and running as Jenkins slave for Ruby
sudo apt-get install -f default-jdk
sudo apt-get install -f git-all
\curl -L https://get.rvm.io | bash -s stable
sudo apt-get --no-install-recommends install -y bash curl git patch bzip2
sudo apt-get --no-install-recommends install -y build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev
sudo apt-get install -y nodejs
@garyjohnson
garyjohnson / TelerikAnnotations.xaml
Created November 21, 2012 15:20
Telerik Annotations
<UserControl x:Class="Telerik.Windows.Examples.ChartView.Annotations.MicrosoftChart"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<UserControl.Resources>
@garyjohnson
garyjohnson / Chart Control Example - Telerik - Custom Individual Bar Colors.xaml
Created September 17, 2012 18:32
Chart Control Example - Telerik - Custom Individual Bar Colors
<chart:RadCartesianChart Name="radChart1" Palette="Metro" VerticalAlignment="Stretch" Margin="0,0,0,10">
<chartView:BarSeries ItemsSource="{Binding MonthRevenues}" ValueBinding="Actual" CategoryBinding="Month" >
<chartView:BarSeries.PointTemplate>
<DataTemplate>
<Rectangle Fill="{Binding Converter={StaticResource detailedInfoToBrushConverter}, ConverterParameter={StaticResource brushes}}"/>
</DataTemplate>
</chartView:BarSeries.PointTemplate>
</chartView:BarSeries>
<chartView:LineSeries ItemsSource="{Binding MonthRevenues}" ValueBinding="Target" CategoryBinding="Month" Stroke="{StaticResource ChartBrush2}" >
<chartView:LineSeries.PointTemplate>
@garyjohnson
garyjohnson / NanoContainer.cs
Created July 31, 2012 01:44
Small IoC Container
using System;
using System.Collections.Generic;
namespace SharkDice
{
public class NanoContainer
{
private readonly Dictionary<Type, object> _registeredDependencies = new Dictionary<Type, object>();
private readonly Dictionary<Type, Type> _registeredTypes = new Dictionary<Type, Type>();
@garyjohnson
garyjohnson / gist:3012249
Created June 28, 2012 16:17
Chart Control Example - Telerik - Alternating Grid Color
<chart:RadCartesianChart.Grid>
<chartView:CartesianChartGrid MajorLinesVisibility="Y" StripLinesVisibility="Y">
<chartView:CartesianChartGrid.YStripeBrushes>
<SolidColorBrush Color="#FFD7D7D7" Opacity="0.3" />
<SolidColorBrush Color="Transparent" />
</chartView:CartesianChartGrid.YStripeBrushes>
</chartView:CartesianChartGrid>
</chart:RadCartesianChart.Grid>