Skip to content

Instantly share code, notes, and snippets.

@andylind
andylind / sofrep.go
Last active Aug 29, 2015
Go command line app to get StackOverflow User Rep by Id
View sofrep.go
package main
import (
"encoding/json"
"flag"
"fmt"
"net/http"
)
type sofUser struct {
@andylind
andylind / build_status.py
Last active Dec 14, 2015
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
View build_status.py
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 Feb 12, 2013
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.
View ValidatedResponse.cs
// 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 Jun 5, 2012
My Settings for Console2
View console.xml
<?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 Oct 4, 2015
workflow for using git with svn
View git svn workflow.sh
##############################
# 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
jQuery cross domain ajax example
View jQuerycrossdomainajaxexample.html
<!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 Nov 30, 2010
jquerymobiledemo.html
View gist:720966
<!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>