Skip to content

Instantly share code, notes, and snippets.

View ttencate's full-sized avatar
🍊

Thomas ten Cate ttencate

🍊
View GitHub Profile
addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
if (event.getTarget() == DefaultDialog.this && x < 0 || y < 0 || x > getWidth() || y > getHeight()) {
hide();
return true;
}
return false;
}
package com.frozenfractal;
import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.utils.Json;
import java.util.Locale;
public class BaseSettings {
protected final Preferences prefs;
@ttencate
ttencate / sorceress.py
Created August 19, 2016 11:23
Python program to fit all possible tiles into a 4x4 grid, where each tile side either has a door or not.
#!/usr/bin/python3
class Piece:
def __init__(self, mask):
self.up = bool(mask & 1)
self.down = bool(mask & 2)
self.left = bool(mask & 4)
self.right = bool(mask & 8)
@ttencate
ttencate / sorceress.py
Created August 20, 2016 11:50
Finds arrangements of rooms in a 4x4 grid using all possible room types, where each wall either has a door or not
#!/usr/bin/python3
class Piece:
def __init__(self, mask):
self.up = bool(mask & 1)
self.down = bool(mask & 2)
self.left = bool(mask & 4)
self.right = bool(mask & 8)
+--+--+ +
| | | |
| | | |
+--+--+ +
| | | |
| | | |
+--+--+ +
@Test
fun forceMovesObject() = physicsTest {
- " "
- " A "
- " "
A isPushed right
A shouldMove right
typedef enum{
response,
animation,
idle,
load
} phase_state;
struct AI_gov_info{
phase_state phase;
phase_state prev_phase;
@ttencate
ttencate / alakajam.service
Last active September 25, 2017 14:13
Alakajam systemd unit
# Usage:
# - Put this content into /etc/systemd/system/alakajam.service
# - systemctl enable alakajam
# - systemctl start alakajam (or systemctl restart apache)
[Unit]
Description=Alakajam server
Requires=network.target
After=network.target
[ 0.000000] random: get_random_bytes called from start_kernel+0x42/0x4b7 with crng_init=0
[ 0.000000] Linux version 4.13.5-1-ARCH (builduser@tobias) (gcc version 7.2.0 (GCC)) #1 SMP PREEMPT Fri Oct 6 09:58:47 CEST 2017
[ 0.000000] Command line: initrd=\initramfs-linux.img root=PARTUUID=4a405e71-b7a3-416e-8f15-a15debbfebfa rw
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
[ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x0000000000086fff] usable
@ttencate
ttencate / Makefile
Created February 23, 2017 08:31
The best Makefile ever
ifeq ($(MAKECMDGOALS),me a sandwich)
.PHONY: me a sandwich
me a:
@true
sandwich:
@if [[ $$(id -u) == "0" ]]; then \
echo "Okay."; \
else \
echo "What? Make it yourself."; \
false; \