Skip to content

Instantly share code, notes, and snippets.

View JAChapmanII's full-sized avatar

Jeff Chapman II JAChapmanII

View GitHub Profile
@JAChapmanII
JAChapmanII / universe.c
Created August 10, 2012 21:10
models of the universe
// an int completely represents the state of the universe, position of all particles, velocities, whatever is needed to perfectly recreate it exactly.
// strictly deterministic
int sd_step(int currentUniverse) {
return currentUniverse + 2; // magical constant
}
void sd_universe() {
int universe = 0;
while(true) {
@JAChapmanII
JAChapmanII / msa.c
Created August 7, 2012 22:14
maximum subarray problem attempt
#include <stdio.h>
// idx = p q o
// arr = [ ]
// { } { }
// s l arr[o]
//
// returns array slice, sum, leftover
//
// if(arr[o] + l >= 0)
@JAChapmanII
JAChapmanII / Rublets.java
Created July 25, 2012 17:27
simple java thing with inner class
public class Rublets {
public static void main(String[] args) {
Rublets.Test t = new Rublets.Test();
t.run();
}
public static class Test {
public void run() {
System.out.println("Hello");
}
@JAChapmanII
JAChapmanII / vector.cpp
Created July 19, 2012 11:16
simple vector thing
#include <cmath>
class Vector {
public:
Vector() : x(0), y(0), z(0) {
}
Vector(double iX, double iY, double iZ) : x(iX), y(iY), z(iZ) {
}
double magnitude() const {
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
printf("argv[1]: %s\n", argv[1]);
// this is this function, not the subproc
int outOfThis[2], intoThis[2];
if((pipe(outOfThis) < 0) || (pipe(intoThis) < 0))
return -2;
@JAChapmanII
JAChapmanII / Makefile
Created October 13, 2011 19:13
example makefile
EXEC=clock
CXXFLAGS=
LDFLAGS=-lsfml-graphics -lsfml-window -lsfml-system
#LFLAGS+=-lGL
ifdef profile
CXXFLAGS+=-pg
endif
import java.awt.Graphics;
import javax.swing.JComponent;
import javax.swing.JFrame;
class rect extends JComponent {
public static void main(String[] args) {
JFrame window = new JFrame();
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@JAChapmanII
JAChapmanII / access_log
Created July 8, 2011 10:40
httpd access log for the 5th of July
66.249.66.185 - - [05/Jul/2011:01:07:30 -0700] "GET /code/detc/.git/objects/info/ HTTP/1.1" 404 1097
67.220.78.114 - - [05/Jul/2011:01:33:49 -0700] "GET /admin/config.php HTTP/1.1" 404 1082
87.250.255.243 - - [05/Jul/2011:02:10:47 -0700] "GET / HTTP/1.1" 200 7355
66.249.66.185 - - [05/Jul/2011:02:22:47 -0700] "GET /code/detc/.git/refs/heads/ HTTP/1.1" 404 1097
66.249.66.185 - - [05/Jul/2011:03:38:13 -0700] "GET /code/detc/.git/refs/heads/master HTTP/1.1" 404 1097
66.249.66.185 - - [05/Jul/2011:04:40:16 -0700] "GET /code/detc/.git/refs/remotes/origin/ HTTP/1.1" 404 1097
71.79.168.23 - - [05/Jul/2011:07:40:37 -0700] "GET / HTTP/1.1" 200 7355
71.79.168.23 - - [05/Jul/2011:07:40:37 -0700] "GET /style/main.css HTTP/1.1" 200 2170
71.79.168.23 - - [05/Jul/2011:07:40:37 -0700] "GET /favicon.ico HTTP/1.1" 404 1093
72.14.183.116 - - [05/Jul/2011:07:40:50 -0700] "CONNECT 178.79.134.133:6667 HTTP/1.0" 200 7389
[24/Apr/2011 17:20:44] "POST /json/textchunk/submit/ HTTP/1.1" 200 118
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/django/core/servers/basehttp.py", line 279, in run
self.result = application(self.environ, self.start_response)
File "/usr/lib/pymodules/python2.6/django/core/servers/basehttp.py", line 651, in __call__
return self.application(environ, start_response)
File "/usr/lib/pymodules/python2.6/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 115, in get_response
return debug.technical_404_response(request, e)
@JAChapmanII
JAChapmanII / post-update
Created April 17, 2011 16:59
Post update hook
#!/bin/sh
cd /tmp
TMP="`mktemp -d`"
cd $TMP
git clone -l $GL_REPO_BASE_ABS/$GL_REPO
rm -rf /srv/http/*
mv $GL_REPO/* /srv/http/
chmod -R go+rx /srv/http/*