Skip to content

Instantly share code, notes, and snippets.

View maghul's full-sized avatar

Magnus Hulthén maghul

  • Professionella Arbetsstationer i Stockholm AB
  • Stockholm, Sweden
View GitHub Profile
@maghul
maghul / discovery.js
Created March 25, 2015 11:47
Discovery using UDP in GJS/Gnome-Shell
// ------
// Broadcasts discovery requests for Logitech Media Server and listens to replies and publish messages
// will send all updates as a hash to the callback.
// The content of the hash is
// IPAD: The address of the server
// NAME: The name of the server
// JSON: The port to connect to for the JSON API
// UUID: The unique identifier of the server instance.
// ------
const GLib = imports.gi.GLib;
@maghul
maghul / MagicalLand.java
Last active December 13, 2015 23:59
A solution to the MagicLand puzzle
public class MagicalLand {
public static void main(String[] args) {
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE");
}
}
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {