Skip to content

Instantly share code, notes, and snippets.

View meikj's full-sized avatar

John Meikle meikj

  • Glasgow, Scotland
View GitHub Profile
public class Node {
private Node left;
private Node right;
private int value;
public Node(int value) {
this.left = null;
this.right = null;
this.value = value;
#!/usr/bin/env python
import asyncore
import socket
HOST = 'localhost'
PORT = 8080
class EchoHandler(asyncore.dispatcher_with_send):
#!/usr/bin/env python
'''
Udacity CS101
Lesson 1, Homework 1
'''
PAGE = '''
<html xmlns="http://www.w3.org/1999/xhtml"><br/> <head><br/><title>Udacity</title> <br/></head><br/><br/><body> <br/><h1>Udacity</h1><br/><br/> <p><b>Udacity</b> is a private institution of <a href="http://www.wikipedia.org/wiki/Higher_education"> higher education founded by</a> <a href="http://www.wikipedia.org/wiki/Sebastian_Thrun">Sebastian Thrun</a>, David Stavens, and Mike Sokolsky with the goal to provide university-level education that is "both high quality and low cost".<br/>It is the outgrowth of a free computer science class offered in 2011 through Stanford University. Currently, Udacity is working on its second course on building a search engine. Udacity was announced at the 2012 <a href="http://www.wikipedia.org/wiki/Digital_Life_Design">Digital Life Design</a> conference.</p><br/></body><br/></html>
'''
@meikj
meikj / folder.py
Last active December 20, 2015 00:29
#!/usr/bin/env python
from os import listdir, mkdir
from os.path import isfile, join
from shutil import move
PATH = "D:/Videos/Movies/"
def main():
files = [ f for f in listdir(PATH) if isfile(join(PATH, f)) ]
#include <stdio.h>
#define BUF_SIZE 256
void reverse(char dst[], char src[], int len);
int strend(char string[], int len);
int getline(char line[], int maxline);
int main(void) {
int len;
#include <stdio.h>
#define MAXLINE 1000
#define NEWLINE_ON 1
#define NEWLINE_OFF 0
int strend(char string[], int len);
int getline(char line[], int maxline);
int main(void) {
#include <stdio.h>
#include <stdlib.h>
#define DEFAULT_TAB_STOP 4
#define DEFAULT_REPLACE ' ' // used as tab replacement
int main(int argc, char *argv[]) {
char *arg_end;
int c, tab_stop, curr_col, spaces;
/**
* The Central Processing unit (CPU).
* Consists of an ALU and a set of registers, designed to fetch and
* execute instructions written in the Hack machine language.
* In particular, functions as follows:
* Executes the inputted instruction according to the Hack machine
* language specification. The D and A in the language specification
* refer to CPU-resident registers, while M refers to the external
* memory location addressed by A, i.e. to Memory[A]. The inM input
* holds the value of this location. If the current instruction needs
type Name = String
type Customer = (Name, Int, Int, Int)
type VStore = [Customer]
-- BEGIN TEST DATA --
cust1 :: Customer
cust1 = ("Neil", 311, 271, 345)
cust2 :: Customer
import Data.List
type NI = Int
type Age = Int
type Balance = Int
type Person = (NI, Age, Balance)
type Bank = [Person]
type Market = [Bank]
type Pop = [NI]