Skip to content

Instantly share code, notes, and snippets.

@tinaun
tinaun / cjk_font_fallback.rs
Last active May 30, 2023 02:45
using fontdb to load system fonts
use fontdb::{Database, Family, Query, Source};
use eframe::egui;
use std::{fs, io};
fn cjk_font_query() -> Query<'static> {
Query {
families: &[
Family::Name("MS UI Gothic"),
Family::Name("Arial Unicode MS"),
@tinaun
tinaun / keybase.md
Created February 6, 2023 15:37
keybase.md

Keybase proof

I hereby claim:

  • I am tinaun on github.
  • I am tinaun (https://keybase.io/tinaun) on keybase.
  • I have a public key ASATybrr271QEpC0DCbaYfwpwqS4cjBeMxvyACPNOZzSrgo

To claim this, I am signing this object:

source_filename = "1tyt6immxwy9a8vn"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%.win32.image_import_desc = type { i32, i32, i32, i32, i32 }
@__ImageBase = external global i8
@import.mydll.1.dll.dll_name = private constant [11 x i8] c"mydll.1.dll", section ".idata$7"
//! deserialization from horrible xml
//!
//!
mod helpers;
use quick_xml::Reader;
use quick_xml::events::{Event, BytesStart};
use error::{Error, Result};
#![allow(unused)]
mod prelude;
use self::prelude::*;
use rand::Rng;
use std::cmp;
#[derive(Debug, Copy, Clone, Deserialize, PartialEq)]
pub struct Nanobot {
#![allow(unused)]
mod prelude;
use self::prelude::*;
const DEPTH: usize = 8787;
const TARGET: (usize, usize) = (10, 725);
fn geo_index(x: usize, y: usize, world: &mut Map<(usize, usize), usize>) -> usize {
if let Some(&value) = world.get(&(x,y)) {
#![feature(dbg_macro)]
#![allow(unused)]
mod prelude;
use self::prelude::*;
#[derive(Debug, Deserialize, PartialOrd, PartialEq, Eq, Ord)]
struct TS {
year: u32,
month: u32,
@tinaun
tinaun / my_oldest_surviving_rust.rs
Last active November 21, 2018 06:57
my_oldest_surviving_rust.rs
// july 2014
use std::io;
use std::from_str::FromStr;
// [], argument is optional, defaults to rax
#[deriving(Show)]
enum Operator {
MOV, // conditional move - MOV reg_from,reg_to,reg_test
IDA, // array index - IDA reg_array,reg_offset,[reg_output]
@tinaun
tinaun / rotating_rect.rs
Created June 14, 2018 07:49
rotating rect luminance example
extern crate luminance;
extern crate luminance_glfw;
use luminance_glfw::{Device, GLFWDevice, WindowDim, WindowOpt, WindowEvent};
use luminance::framebuffer::Framebuffer;
use luminance::shader::program::{Program, Uniform};
use luminance::pipeline::{BoundTexture, RenderState, entry, pipeline};
use luminance::texture::{self, Texture, Sampler, TextureError};
use luminance::pixel;
@tinaun
tinaun / main.rs
Created December 22, 2017 08:09
day22 p2
extern crate gif;
use std::collections::HashMap;
use gif::{Frame, Encoder, Repeat, SetParameter};
use std::fs::File;
use std::io::prelude::*;
static COLOR_MAP: [u8; 15] = [
20, 12, 28, // CLEAN