Skip to content

Instantly share code, notes, and snippets.

@tyfkda
tyfkda / SimpleScene.java
Created April 12, 2016 07:41
jogl sample
// Modified from
// JOGL Tutorial 3 - Creating a Render Loop - Justin's Home
// https://sites.google.com/site/justinscsstuff/jogl-tutorial-3
// for jogl-1.1.1
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.*;
//import javax.media.opengl.awt.GLCanvas;
@tyfkda
tyfkda / run.py
Created April 12, 2016 07:57
Run command and handle pipes.
import subprocess
def run(command, input=None):
try:
process = subprocess.Popen(
command, stdin=subprocess.PROCESS,
stdout=subprocess.PROCESS, stderr=subprocess.PROCESS,
close_fds=True)
if input:
process.stdin.write(input)
@tyfkda
tyfkda / aobench.rs
Last active September 5, 2018 10:55
AOBench written in Rust
extern crate rand;
use std::fs;
use std::io::{BufWriter, Write};
use std::ops::{Add, AddAssign, Sub, Mul, Div};
const WIDTH: usize = 256;
const HEIGHT: usize = 256;
const NSUBSAMPLES: usize = 2;
const NAO_SAMPLES: usize = 8;
@tyfkda
tyfkda / setgetscreenres.m
Created September 25, 2018 03:48
Resolution changer for Mac OSX
// http://apple.stackexchange.com/questions/139548/changing-display-resolution-on-retina-machines-while-in-command-line-mode
/*
* COMPILE:
* c++ setgetscreenres.m -framework ApplicationServices -o setgetscreenres
* USE:
* setgetscreenres 2048 1280 # 1440 900
*/
#include <ApplicationServices/ApplicationServices.h>
@tyfkda
tyfkda / linear-scan-algo.py
Created October 21, 2019 13:09
Linear scan register allocation algorithm
LinearScanRegisterAllocation
active <- {}
foreach live interval i, in order of increasing start point
ExpireOldIntervals(i)
if length(active) == R then
SpillAtInterval(i)
else
register[i] <- a register removed from pool of free registers
add i to active, sorted by increasing end point
@tyfkda
tyfkda / jit-wasm-calc.html
Last active November 20, 2020 01:39
JIT WASM Calculator
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no" />
<title>JIT WASM Calculator</title>
<style type="text/css">
.code {
font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;
@tyfkda
tyfkda / ScreenSwitcherWindow.cs
Last active July 15, 2021 12:36
SceneSwitcher for Unity
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using System.IO;
public class SceneSwitcherWindow : EditorWindow {
private List<SceneAsset> scenes;
private Vector2 scrollPos = Vector2.zero;
@tyfkda
tyfkda / kakuro-sample.txt
Created January 3, 2022 03:24
Kakuro solver
-1, -1,1000, 400, -1, -1
-1, 703, 0, 0,3000, 800
16, 0, 0, 0, 0, 0
3, 0, 0, 913, 0, 0
17, 0, 0, 0, 0, 0
-1, -1, 16, 0, 0, -1
@tyfkda
tyfkda / numberlink-sample.txt
Last active January 5, 2022 00:24
Number-link solver
@tyfkda
tyfkda / slither-sample.txt
Last active January 5, 2022 00:19
Slither-link solver
.02.1.3
.......
...3.31
30...30
31.2...
.......
3.3.02.