Skip to content

Instantly share code, notes, and snippets.

@bag-man
bag-man / cv.html
Last active August 29, 2015 14:19
CV Viewer
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Owen Garland</title>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<style>
.pdf {
width: 100%;
height: 100%;
@bag-man
bag-man / template.tex
Last active August 29, 2015 14:18
LaTeX template
\documentclass[10pt]{article}
\usepackage{a4wide}
\usepackage[english]{babel}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{lastpage}
\usepackage{graphicx}
\usepackage[section]{placeins}
\usepackage[superscript,biblabel]{cite}
\usepackage[margin=1in]{geometry}
@bag-man
bag-man / owg1Snapper.java
Last active August 29, 2015 14:17
CS221 Assignment 2
package cs21120.assignment2.solution;
import cs21120.assignment2.FloatImage;
import cs21120.assignment2.ISnapper;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.LinkedList;
import java.awt.Point;
/**
@bag-man
bag-man / JuicerURLTester.js
Created March 20, 2015 10:31
[Node.js] Test if a URL is on juicer
var crypto = require('crypto');
var http = require('http');
var JUICER_API_KEY = "YB0MY3VMHyllzPqEf5alVj5bUvGpvDVi";
var urls = [
'http://www.bbc.co.uk/news/science-environment-31965456',
'http://news.sky.com/story/1448732/north-korea-defectors-are-human-scum',
'http://www.independent.co.uk/news/world/asia/north-korea-ready-anytime-for-nuclear-war-as-diplomat-calls-defectors-animals-and-scum-10121587.html',
'http://www.theguardian.com/education/2015/mar/20/labour-calls-time-on-exam-factory-approach-to-schooling',
'http://www.ft.com/cms/s/eb98baa4-ce49-11e4-86fc-00144feab7de,Authorised=false.html?_i_location=http%3A%2F%2Fwww.ft.com%2Fcms%2Fs%2F0%2Feb98baa4-ce49-11e4-86fc-00144feab7de.html%3Fsiteedition%3Duk&siteedition=uk&_i_referer=http%3A%2F%2Fwww.ft.com%2Fhome%2Fuk#axzz3Uv0Y2KoV',
'http://www.telegraph.co.uk/finance/economics/11484544/Europe-squeezes-more-reforms-from-Greece-as-Merkel-steps-into-bail-out-talks.html',
@bag-man
bag-man / C - Language Tests
Last active April 19, 2016 20:14
Language tests
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
void end() {
printf("Game over.\n");
exit(0);
}
@bag-man
bag-man / Reversible.java
Created December 17, 2014 16:52
Clock test
import java.util.ArrayList;
public class Reversible implements IReversible {
public ArrayList<Integer> listReversible(int upperLimit) {
ArrayList<Integer> list = new ArrayList();
for(int i = 0; i < upperLimit; i++) {
@bag-man
bag-man / Install Arch
Last active December 25, 2015 16:59 — forked from Apsu/uefisetup.sh
loadkeys uk
wifi-menu
lsblk
cgdisk /dev/sda #100M EF01 boot
cryptsetup -y -v luksFormat /dev/sdaX
cryptsetup open /dev/sdaX cryptroot
mkfs -t ext4 /dev/mapper/cryptroot
mount -t ext4 /dev/mapper/cryptroot /mnt
mkfs -t ext4 /dev/sdaY
mkdir /mnt/boot
@bag-man
bag-man / cpu.js
Last active March 29, 2024 12:01
How to calculate the current CPU load with Node.js; without using any external modules or OS specific calls.
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores