Skip to content

Instantly share code, notes, and snippets.

View guyhughes's full-sized avatar

guy hughes guyhughes

  • /boot/efi/vmlinuz+0x0
View GitHub Profile
@guyhughes
guyhughes / git-ls-branches-porcelain.sh
Last active July 17, 2024 00:43
list git branches porcelain
git branch --list -q | sed 's/[\*\ ]*//g'
public class Foo implements Cloneable {
static class Bar {
public int i;
public Bar() { }
}
static class Qux {
public int a[];
public int b;
public Qux() { }
}
TAGS := .tags
OUT := out
DEBUG_CFLAGS:=-Wextra -Wall -Wshadow -Wno-strict-aliasing -Woverflow -Wno-unused-parameter -Wno-unused-variable -g -pipe -march=native
CFLAGS:= -pipe -O2 -march=native
.PHONY: default debug tags out_run
out_run: run
./$(OUT)
out:
$(CC) $(CFLAGS) *.c -o $(OUT)
debug:
@guyhughes
guyhughes / Likeable.java
Created February 18, 2016 18:36
ITI1121 2013 exam question 1, code implementation
interface Likeable {
void like();
int getLikes();
}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct studentRecord
{
char lastName[100];
char firstName[100];
long studentId;
double mark;
};
#include <stdlib.h>
#include <stdio.h>
struct car{
char make[30];
char model[30];
int year;
int mileage;
};
@guyhughes
guyhughes / AStack.java
Last active February 18, 2016 21:12
ITI1121 exam question from 2013/2014, implemented
class AStack implements Stack {
public static final int MAX_ITEMS = 1000;
public static final int ITERATIONS = 9;
private int items[] = new int[MAX_ITEMS];
private int i = 0;
public void push(int item) {
if (i < MAX_ITEMS) {
@guyhughes
guyhughes / i915.conf
Created February 10, 2016 15:42
thinkpad
options i915 enable_rc6=1 enable_fbc=1 semaphores=1
#!/bin/bash
# ______ __ __ __
# / ____/_ ____ __ / / / /_ ______ _/ /_ ___ _____
# / / __/ / / / / / / / /_/ / / / / __ `/ __ \/ _ \/ ___/
# / /_/ / /_/ / /_/ / / __ / /_/ / /_/ / / / / __(__ )
# \____/\__,_/\__, / /_/ /_/\__,_/\__, /_/ /_/\___/____/
# /____/ /____/
A="$1"
#include <assert.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#define ITERATIONS 10000000
// This is the result of me mocking other students in a class who insisted on
// printing out the bits of a byte using a for loop. The requirement was to
// print the byte as '0000 0000' with a space. I insisted that a for loop is