Skip to content

Instantly share code, notes, and snippets.

View nickcharlton's full-sized avatar

Nick Charlton nickcharlton

View GitHub Profile
public string Import()
{
/*
* This is an example of how to import the MealDeliveries.txt file provided with SOFT130
*
* It loads the text file into an SQLite Database
*
*/
// define variables we'll use

TermiSoc Description

Events and Affiliations

  • currently part of the O'Reilly user group programme.
  • have hosted events such as our own version of the CharityHack, where we built a project to track module deadlines, and donate money to charity if we missed our own deadlines.
  • want to host similar events, here in Plymouth
  • in the past we have gone on trips to for talks in London, such as the Open Rights Group talk by Bruce Schneier, or BarCamps.
@nickcharlton
nickcharlton / gist:726843
Created December 3, 2010 11:23
calculateHeuristic2
// 6.1 calculateHeuristic2 function for Open^Computer - Open^Player
function calculateHeuristic2(possiblerow, possiblecolumn):void {
// heurist function 2 = OpenX - OpenO
// the computer (player X) looks for the max value
// extra check for choices with 2 Os
// when 2 Os are found, chosen move will stop it
// results saved into optimalmove[]
var row:int, column:int;
var you:int, computer:int;
@nickcharlton
nickcharlton / gist:859141
Created March 7, 2011 20:24
Python Class Example
class MyClass:
def f(self):
print 'hello world'
x = MyClass()
x.f()
@nickcharlton
nickcharlton / gist:1257847
Created October 2, 2011 19:48
A Quick Introduction to Linux & A Few TermiSoc Specifics
A Quick Introduction to Linux & A Few TermiSoc Specifics
- [ ] Philosophies
- [ ] Open Source
- [ ] Distributions
- [ ] But first, login (SSH)
You can connect to the server using ssh. Or "secure shell".
If you've ever heard of telnet, it's like that, but doesn't
send everything in plain text.
If you're already using Linux or a Mac, you already have ssh
21:30 <termibot> Traceback (most recent call last):
21:30 <termibot> File "./plugins/url_filter", line 113, in <module>
21:30 <termibot> print(channel + " " + lookup(url, nick))
21:30 <termibot> File "./plugins/url_filter", line 106, in lookup
21:30 <termibot> return "[ %s -- %s ]" % (short, gettitle(url))
21:31 <termibot> File "./plugins/url_filter", line 79, in gettitle
21:31 <termibot> parser.feed(data.read().decode(charset))
21:31 <termibot> File "/usr/local/lib/python3.2/html/parser.py", line 133, in feed
21:31 <termibot> self.goahead(0)
21:31 <termibot> File "/usr/local/lib/python3.2/html/parser.py", line 181, in goahead
@nickcharlton
nickcharlton / butts.c
Created December 6, 2011 15:19 — forked from anonymous/butts.c
butts
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mt64.h"
int n,i; //Define n and i as integers
double *array; //Dynamic array as a double
FILE *myfile;
int main()
{
@nickcharlton
nickcharlton / tidy_csv.rb
Created January 6, 2012 10:50
A snippet for cleaning up a CSV file by removing whitespace. Messy, but works.
#!/bin/ruby
#
# Parses a given CSV file, and writes it back out.
# The CSV library handles types nicer.
#
# Author: Nick Charlton
# Date: 6/1/12
# License: MIT
#
# accept arguments
on open these_items
# loop through them
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items)
# parse the input, to ensure it'll open okay in the terminal
set posix_path to POSIX path of this_item
set safe_path to quoted form of posix_path
# open up iTerm
@nickcharlton
nickcharlton / less_converter.rb
Created May 13, 2012 14:57
For Jekyll. Fixed to work with the new Less gem.
#
# Less to CSS converter for Jekyll.
# In your less file, add two lines of --- at the top.
#
module Jekyll
class LessConverter < Converter
safe true
priority :high
def setup