Skip to content

Instantly share code, notes, and snippets.

View jasper-lyons's full-sized avatar
💭
Full time educator, part time developer

Jasper Lyons jasper-lyons

💭
Full time educator, part time developer
View GitHub Profile
@jasper-lyons
jasper-lyons / Zipping lists in a text file in vim
Created August 19, 2016 12:03
Zipping lists in a text file
Given:
(1, 2, 3, 4, 5), (a, b, c, d ,e ,f)
run:
V:!ruby -e "puts ARGF.read.scan(/\(([^()]*)\)/).map {|m| m[0].split(',') }.inject {|a,b| a.zip(b) }.map {|m| \"(\#{m.join(', ')})\"}.join(', ')"
and get:
@jasper-lyons
jasper-lyons / Loading vboxdrv in Ubuntu 16.04.md
Last active August 13, 2016 14:12
Gist containing all of the information I used to solve this issue and the extra things I had to do between.

First is googled the error message "vboxdrv not loaded" and ubuntu 16.04

This lead me to this ask ubuntu answer.

I read this a few times and began to understand that the issue is, vortial box's kernel modules are not signed which means that Ubuntu running secure boot will fail to load those modules. Since I have never signed modules before I figured I would read this enough times to understand. Unfortunately this answer in and of it's self was not informative enough for me to be comfortable with fixing this problem, I must know more.

I decided to take a look at this gist, linked to in the above answer. Again, this was insufficient for me to fully grok what was heppening but I did realise that:

  1. I needed to already have a directory with "keys" in
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script type="application/javascript">
var html = {
createElement: function (tagName, options) {
var element = document.createElement(tagName);
for (var attribute in options) {
@echo off
set/p host=host Address:
set logfile=Log_%host%.log
echo Target Host = %host% >%logfile%
for /f "tokens=*" %%A in ('ping %host% -n 1 ') do (echo %%A>>%logfile% && GOTO Ping)
:Ping
for /f "tokens=* skip=2" %%A in ('ping %host% -n 1 ') do (
echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A>>%logfile%
List<int> weekendDays = Array.asList(1,7);
List<Thing> productiveThings = Array.asList(study, laundry, foodShopping, gym);
List<Thing> thingsDone = days.stream()
// Split infinite stream of days into those that are wednesdays and those that are not
.collect(Collectors.partitionBy(day -> weekendDays.contains(day.get(Calendar.DAY_OF_WEEK))))
.entrySet().stream().map(entry ->
// if day is not weekend and william isn't "busy"
return (!entry.getKey() && isQuoteBusyEndQuote(william))
? beProductive(william, productiveThings)
<link rel="import" href="https://rawgit.com/Polymer/polymer/master/polymer.html">
<dom-module id="my-component">
<template>
<content></content>
</template>
<style>
</style>
machine:
environment:
JAVA_TOOL_OPTIONS: '-Dfile.encoding=UTF8 -Duser.timezone=UTC'
_JAVA_OPTIONS: '-Xms512m -Xmx1024m -Xss2m'
java:
version: oraclejdk8
python:
version: 2.7.6
services:
- docker
@jasper-lyons
jasper-lyons / Seq.java
Created May 7, 2015 14:23
Super Simple Java7 Functional Collection Interface
package utils;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
// This can be replaced with any other Function / Function2 interface
import play.libs.F.Function;
@jasper-lyons
jasper-lyons / gist:c4ceaa8556a9c2d9e78c
Created September 28, 2014 12:20
Safely remove / purge old linux headers.
dpkg -l linux-{image,headers}-* | awk '/^ii/{print $2}' | egrep '[0-9]+\.[0-9]+\.[0-9]+' | grep -v $(uname -r) | xargs sudo apt-get -y purge
class SomeClass {
public int someMethod(int[] data) {
//do some things
}
public int someMethod(Integer[] data) {
// this bit convert an Integer array into an int array.
int[] newData = int[data.length];