Skip to content

Instantly share code, notes, and snippets.

View EdgeCaseBerg's full-sized avatar
📉
Wondering why Github added statuses instead of something useful

Ethan Eldridge EdgeCaseBerg

📉
Wondering why Github added statuses instead of something useful
View GitHub Profile
@EdgeCaseBerg
EdgeCaseBerg / 295evo.cpp
Created February 13, 2014 03:18
295 Evo Final. Code from several years ago
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
@EdgeCaseBerg
EdgeCaseBerg / reverse.c
Last active August 29, 2015 13:56
Reverse a forward linked list in Theta(N) time. (Note no checks on malloc because this is a toy program)
#include <stdio.h>
#include <stdlib.h>
struct node
{
struct node * next;
int seq;
};
@EdgeCaseBerg
EdgeCaseBerg / 60.go
Created May 13, 2014 12:29
http://tour.golang.org/#60 GoLang tutorial number 60
package main
import (
"fmt"
"net/http"
)
type String string
type Struct struct {
@EdgeCaseBerg
EdgeCaseBerg / hillClimber.go
Created May 20, 2014 12:48
Implementation of a Simple Binary Genome hill climber. The fitness is determined simply by how many 1's are turned on in the genome of the child. So a perfect fitness is 100.
package main
import (
"fmt"
"math/rand"
"time"
"runtime"
)
/* HillClimber
@EdgeCaseBerg
EdgeCaseBerg / 21game.cpp
Created October 17, 2014 13:57
A version of the 21 game without proper error checking or rule checking.
#include <stdio.h>
#include <iostream>
using namespace std;
const char * welcometext =
"Welcome to the game of 21! \n\
Rules: \n\
First choose who goes first, the game starts with 21 sticks in\n\
a pile, the player forced to take the last stick loses. \n\
@EdgeCaseBerg
EdgeCaseBerg / 21game-improved.cpp
Last active August 29, 2015 14:07
This is a version of the 21 game with error checking, a computer player, scoreboard, and the ability to play multiple times.
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
const char * welcometext =
"Welcome to the game of 21! \n\
Rules: \n\
First choose who goes first, the game starts with 21 sticks in\n\
@EdgeCaseBerg
EdgeCaseBerg / i3-exit
Last active August 29, 2015 14:13 — forked from jcyamo/i3-exit
#!/usr/bin/env python
# based on cb-exit used in CrunchBang Linux <http://crunchbanglinux.org/>
import pygtk
pygtk.require('2.0')
import gtk
import os
import getpass
@EdgeCaseBerg
EdgeCaseBerg / ConcurrencyTest.java
Created February 6, 2015 19:01
ConcurrencyTest for timing out and putting a limit on tasks.
import java.util.List;
import java.util.Collection;
import java.util.ArrayList;
import java.util.concurrent.*;
import java.lang.InterruptedException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.CancellationException;
import java.util.Random;
public class ConcurrentTest {
@EdgeCaseBerg
EdgeCaseBerg / event.sh
Last active August 29, 2015 14:16
event.sh file for mcabber to send notifications via notify-send when recieving messages or updates from users.
#!/bin/sh
#set the following in your .mcabberrc file for notifications
#set events_command = ~/.mcabber/event.sh
#set events_ignore_active_window = 0
#set event_log_files = 1
#set event_log_dir = /tmp
if [ $1 = "MSG" ]; then
@EdgeCaseBerg
EdgeCaseBerg / faster.py
Last active August 29, 2015 14:20
Python shell of checking to see which one is faster, addition of strings or interpolation
>>> import dis
>>> def addStr(s):
... return ">" + s + "<"
...
>>> dis.dis(addStr)
2 0 LOAD_CONST 1 ('>')
3 LOAD_FAST 0 (s)
6 BINARY_ADD
7 LOAD_CONST 2 ('<')
10 BINARY_ADD