Skip to content

Instantly share code, notes, and snippets.

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 Feb 13, 2014
295 Evo Final. Code from several years ago
View 295evo.cpp
/*************************************************************************
* *
* 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 Aug 29, 2015
Reverse a forward linked list in Theta(N) time. (Note no checks on malloc because this is a toy program)
View reverse.c
#include <stdio.h>
#include <stdlib.h>
struct node
{
struct node * next;
int seq;
};
View 60.go
package main
import (
"fmt"
"net/http"
)
type String string
type Struct struct {
@EdgeCaseBerg
EdgeCaseBerg / hillClimber.go
Created May 20, 2014
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.
View hillClimber.go
package main
import (
"fmt"
"math/rand"
"time"
"runtime"
)
/* HillClimber
@EdgeCaseBerg
EdgeCaseBerg / 21game-improved.cpp
Last active Aug 29, 2015
This is a version of the 21 game with error checking, a computer player, scoreboard, and the ability to play multiple times.
View 21game-improved.cpp
#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 / 21game.cpp
Created Oct 17, 2014
A version of the 21 game without proper error checking or rule checking.
View 21game.cpp
#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\
View 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 Feb 6, 2015
ConcurrencyTest for timing out and putting a limit on tasks.
View ConcurrencyTest.java
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 Aug 29, 2015
event.sh file for mcabber to send notifications via notify-send when recieving messages or updates from users.
View event.sh
#!/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 Aug 29, 2015
Python shell of checking to see which one is faster, addition of strings or interpolation
View faster.py
>>> 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