Skip to content

Instantly share code, notes, and snippets.

View andylind's full-sized avatar

andylind andylind

View GitHub Profile
@andylind
andylind / build_status.py
Last active December 14, 2015 08:28
This script prints the status of a set of Jenkins jobs in color (works on windows only). Example Usage: "C:\Python33\python.exe" build_status.py https://ci.jenkins-ci.org/view/Jenkins%20core/api/json
def set_text_color(color):
#This method works on windows only
color_codes = {"BLUE" : 0x0001, "GREEN" : 0x0002, "RED" : 0x0004, "MAGENTA" : 0x0005, "YELLOW" : 0x0006, "GRAY" : 0x0007}
STD_OUTPUT_HANDLE = -11
from ctypes import windll, Structure, c_short, c_ushort, byref
stdout_handle = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute
SetConsoleTextAttribute(stdout_handle, color_codes[color])
def print_build_status(jenkins_url):
@andylind
andylind / ValidatedResponse.cs
Created February 12, 2013 01:44
This C# class can be used to return both a result and a validation value. In some cases it may also make sense to include an optional validation error message in the class.
// Used when both a result and a validation value are needed
public class ValidatedResponse<T>
{
private readonly bool isOk;
public T Item { get; private set; }
public ValidatedResponse(bool isOk, T item)
{
this.isOk = isOk;
Item = item;
@andylind
andylind / console.xml
Created June 5, 2012 13:34
My Settings for Console2
<?xml version="1.0"?>
<settings>
<console change_refresh="10" refresh="100" rows="25" columns="160" buffer_rows="9000" buffer_columns="0" shell="C:\Windows\SysWOW64\cmd.exe /c &quot;&quot;C:\Program Files (x86)\Git\bin\sh.exe&quot; --login -i&quot;" init_dir="C:\dev" start_hidden="0" save_size="0">
<colors>
<color id="0" r="2" g="26" b="46"/>
<color id="1" r="0" g="0" b="128"/>
<color id="2" r="0" g="150" b="0"/>
<color id="3" r="0" g="150" b="150"/>
<color id="4" r="170" g="25" b="25"/>
<color id="5" r="128" g="0" b="128"/>
@andylind
andylind / git svn workflow.sh
Last active October 4, 2015 14:48
workflow for using git with svn
##############################
# Setup
##############################
# create local repo
git svn init -s http://url-of-repo
git svn fetch
git svn rebase
@andylind
andylind / jQuerycrossdomainajaxexample.html
Created May 11, 2011 01:04
jQuery cross domain ajax example
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>jQuery cross domain ajax example</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
@andylind
andylind / gist:720966
Created November 30, 2010 01:23
jquerymobiledemo.html
<!DOCTYPE html>
<html>
<head>
<title>jQuery Mobile Demo</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
<script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
</head>
<body>
@andylind
andylind / sofrep.go
Last active August 29, 2015 14:06
Go command line app to get StackOverflow User Rep by Id
package main
import (
"encoding/json"
"flag"
"fmt"
"net/http"
)
type sofUser struct {