Skip to content

Instantly share code, notes, and snippets.

Owen Garland bag-man

Block or report user

Report or block bag-man

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bag-man
bag-man / JuicerURLTester.js
Created Mar 20, 2015
[Node.js] Test if a URL is on juicer
View JuicerURLTester.js
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',
View C - Language Tests
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
void end() {
printf("Game over.\n");
exit(0);
}
View Reversible.java
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++) {
View Install Arch
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 Dec 7, 2019
How to calculate the current CPU load with Node.js; without using any external modules or OS specific calls.
View cpu.js
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
You can’t perform that action at this time.