Skip to content

Instantly share code, notes, and snippets.

View marknorgren's full-sized avatar

Mark Norgren marknorgren

View GitHub Profile
## get the weather condition (rainy, cloudy) for any given city
## by @limitedmage julianapena.com
import urllib2
def getWeather(city):
#create google weather api url
url = "http://www.google.com/ig/api?weather=" + urllib2.quote(city)
#!/bin/sh
# Use BeyondCompare as difftool for git in cygwin.
# git config --global difftool.bc3.cmd "beyondcompare-diff.sh \"\$LOCAL\" \"\$REMOTE\""
# git difftool -t bc3 branch1..branch2
# Reference: http://www.tldp.org/LDP/abs/abs-guide.pdf
library=githelperfunctions.sh
#[ -f $library ] && . $library
@dlivingstone
dlivingstone / Triangle_opengl_3_1.cpp
Created October 15, 2010 14:59
OpenGL 3.0+ Rendering Example - A complete and fairly minimal example of rendering with shaders
// Triangle_opengl_3_1
// A cross platform version of
// http://www.opengl.org/wiki/Tutorial:_OpenGL_3.1_The_First_Triangle_%28C%2B%2B/Win%29
// with some code from http://www.lighthouse3d.com/opengl/glsl/index.php?oglexample1
// and from the book OpenGL Shading Language 3rd Edition, p215-216
// Daniel Livingstone, October 2010
#include <GL/glew.h>
#define FREEGLUT_STATIC
#include <GL/freeglut.h>
@marknorgren
marknorgren / xcode-git-version.sh
Created January 23, 2012 23:12 — forked from jpwatts/xcode-git-version.sh
This Xcode 4 build phase script automatically sets the version and short version string of an application bundle based on information from the containing Git repository.
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode 4, add the contents to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@jonathanpenn
jonathanpenn / device_uuid.rb
Created May 15, 2012 03:37
Ruby script that fetches the UUID of the first iOS device plugged into your machine
#!/usr/bin/env ruby
ioreg = `ioreg -w 0 -rc IOUSBDevice -k SupportsIPhoneOS`
device_uuid = ioreg[/"USB Serial Number" = "([0-9a-z]+)"/] && $1
if device_uuid
puts device_uuid
else
puts "No device detected."
exit 1
@wgbartley
wgbartley / Spark-DHT22.pde
Last active November 20, 2016 17:09
Class for reading DHT22 values on a Spark Core
#define MAXTIMINGS 85
#define cli noInterrupts
#define sei interrupts
#define DHT11 11
#define DHT22 22
#define DHT21 21
#define AM2301 21
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 11, 2024 22:46
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

(* Script to record and tag spotify tracks, by Lloyd Moore *)
(* Modified by Tiffany G. Wilson to resolve audio splitting issues, automate starting/stopping, and add recording customization *)
(* Snippets for controlling Spotify are from Johnny B on tumblr (http://johnnyb.tumblr.com/post/25716608379/spotify-offline-playlist) *)
(* The idea of using delayed tagging/filename updating is from a guest user on pastebin (http://pastebin.com/rHqY0qg9) *)
(* The only thing to change in the script is the output format; you must change the file extension and the recording format to match *)
(* Run this script once a song you want to record is queued (stopped at beginning) or playing *)
(* Running the script will initiate hijacking, recording and audio playback *)
(* To stop script, pause Spotify or wait for album/playlist to end*)
(* To set id3 tags, use application Kid3 (http://sourceforge.net/projects/kid3/) and copy '%{artist} - %{album} - %{track} - %{title}' from file name to Tag 2 *)