Skip to content

Instantly share code, notes, and snippets.

View andburn's full-sized avatar

Andrew Burnett andburn

View GitHub Profile
@DanielSWolf
DanielSWolf / Program.cs
Last active July 16, 2024 20:29
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@soeminnminn
soeminnminn / DDSImageParser.cs
Last active November 18, 2023 16:39
Read DDS image in C# way. Converted from "[il_dds.c] https://github.com/DentonW/DevIL/blob/master/DevIL/src-IL/src/il_dds.c" (DevIL).
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.IO;
namespace S16.Drawing
{
#region DDSImage Class
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@drewda
drewda / gist:1299198
Created October 19, 2011 18:23
Jenks natural breaks classification
# code from http://danieljlewis.org/files/2010/06/Jenks.pdf
# described at http://danieljlewis.org/2010/06/07/jenks-natural-breaks-algorithm-in-python/
def getJenksBreaks( dataList, numClass ):
dataList.sort()
mat1 = []
for i in range(0,len(dataList)+1):
temp = []
for j in range(0,numClass+1):
temp.append(0)
@zdxerr
zdxerr / glUtils.js
Created October 4, 2011 10:16
Small webgl example
// augment Sylvester some
Matrix.Translation = function (v)
{
if (v.elements.length == 2) {
var r = Matrix.I(3);
r.elements[2][0] = v.elements[0];
r.elements[2][1] = v.elements[1];
return r;
}