Skip to content

Instantly share code, notes, and snippets.

View llbit's full-sized avatar

Jesper Öqvist llbit

View GitHub Profile
@llbit
llbit / water.c
Last active September 5, 2024 07:42
Raspberry Pi GPIO pins via C
// Compile with $ gcc water.c -o water
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
// Pin modes:
#define INPUT (0)
#define OUTPUT (1)
#define LOW (0)
#define HIGH (1)
@llbit
llbit / ScenePresets.md
Last active July 9, 2021 18:24
Chunky Scene Presets

Clear Sunset

{"sunEnabled":true,"fogColor":{"red":0.42814502293337064,"green":0.5858024691358026,"blue":1.0},"fastFog":true,"transparentSky":false,"fogDensity":0.0,"sun":{"altitude":0.44879895051282753,"azimuth":1.2566370614359172,"intensity":1.4493430876832702,"color":{"red":1.0,"green":0.47843137383461,"blue":0.0}},"sky":{"skyYaw":0.0,"skyMirrored":true,"skyLight":0.8164494214249368,"mode":"GRADIENT","horizonOffset":0.1,"cloudsEnabled":false,"cloudSize":64.0,"cloudOffset":{"x":0.0,"y":128.0,"z":0.0},"gradient":[{"rgb":"FF9966","pos":0.0},{"rgb":"FFB77D","pos":0.19811320754716982},{"rgb":"FFFFB3","pos":0.5801886792452831},{"rgb":"D5ECEE","pos":0.8891509433962265},{"rgb":"EBFCFD","pos":1.0}]}}

Foggy Sunset

{"sunEnabled":true,"fogColor":{"red":0.42814502293337064,"green":0.5858024691358026,"blue":1.0},"fastFog":true,"transparentSky":false,"fogDensity":0.09523809523809523,"sun":{"altitude":0.6981317007977318,"azimuth":1.2566370614359172,"intensity":0.6916163486090415,"color":{"red":1.0,"gre
@llbit
llbit / manufactoria.md
Last active November 1, 2016 13:50
Manufactoria Solutions

Solutions for the game Manufactoria by Pleasing Fungus

Toast is obvious (3 parts) Coffee is obvious (3 parts)

Lamp

#!/bin/bash
if [ $# -lt "1" ]; then
echo "This script copies a maven artifact to a local directory"
echo "Usage: mvnget artifactID [dest-dir]"
echo " artifactID is <group:project:version>"
exit 1
fi
if [ $# -gt "2" ]; then
@llbit
llbit / StringHash2.java
Created December 16, 2013 16:00
Find String hash collisions.
import java.util.*;
import java.io.*;
/**
* Find String hash collisions.
* @author Jesper Öqvist <jesper.oqvist@cs.lth.se>
*/
public class StringHash2 {
public static void main(String[] args) {
Map<Integer,Collection<String>> map = new HashMap<>();
@llbit
llbit / StringHash.java
Created December 16, 2013 10:51
Find string hash collisions in Java.
import java.util.*;
/**
* Find String hash collisions.
* @author Jesper Öqvist <jesper.oqvist@cs.lth.se>
*/
public class StringHash {
private static final int NCHAR = 3;
private static final char[] chars = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',