Skip to content

Instantly share code, notes, and snippets.

@leroycep
leroycep / shell.nix
Created April 14, 2019 16:17
nix-shell environment for running veloren
let
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
in
with nixpkgs;
stdenv.mkDerivation {
name = "veloren-env";
buildInputs = [
(nixpkgs.rustChannelOf { date = "2019-04-11"; channel = "nightly"; }).rust
git
@leroycep
leroycep / RUST_BACKTRACE
Created April 24, 2019 22:31
Error loading texture in amethyst
~/p/f/g/dodger (master|✔) 1 $ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.25s
Running `target/debug/dodger`
[INFO][winit::platform::platform::x11::window] Guessed window DPI factor: 1.8333333333333333
[DEBUG][winit::platform::platform::x11::window] Calculated physical dimensions: 500x500
[INFO][gfx_device_gl::info] parsing version '4.5 (Core Profile) Mesa 18.1.7'
[INFO][gfx_device_gl::info] parsing version '4.50'
[INFO][gfx_device_gl] Info { platform_name: PlatformName { vendor: "Intel Open Source Technology Center", renderer: "Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2) " }, version: 4.5, shading_language: 4.50, extensions: {"GL_NV_depth_clamp", "GL_INTEL_performance_query", "GL_ARB_pipeline_statistics_query", "GL_ARB_texture_query_levels", "GL_ARB_map_buffer_range", "GL_ARB_draw_elements_base_vertex", "GL_AMD_vertex_shader_layer", "GL_ARB_texture_multisample", "GL_ARB_shader_texture_lod", "GL_NV_packed_depth_stencil", "GL_ARB_gpu_shader_fp64", "GL_KHR_no_error", "GL_EXT_sh
@leroycep
leroycep / build.zig
Created June 30, 2019 14:17
Kind of working Raylib in zig example
const std = @import("std");
const Builder = std.build.Builder;
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
var exe = b.addExecutable("game", "src/main.zig");
exe.setBuildMode(mode);
exe.addLibPath("lib");
@leroycep
leroycep / flexbox-cheatsheet.md
Last active January 16, 2020 17:09
Flexbox Cheatsheet

Flexbox

display: flex;

A short cheatsheet for flexbox. Assembled from w3schools and [MDN][2].

nix-shell -p cmake llvmPackages_9.clang-unwrapped llvmPackages_9.llvm clang_9 libxml2 zlib pkgconfig --run fish
@leroycep
leroycep / exact-weight-random-population.py
Created April 16, 2020 15:00
Create a new population with a weighted list of parents
scores = [(0.4, "a"), (0.5, "b"), (0.1, "c")]
# Calculate the sum of all scores.
#
# Will probably be 1 since the bots are scored with a percentage,
# but just in case...
denominator = 0
for score in scores:
denominator += score[0]
// 2000 lines of generated zig...
const struct_unnamed_36 = extern struct {};
pub const wasmer_instance_t = struct_unnamed_36;
// 2000 more lines of generated zig...
@leroycep
leroycep / test.wat
Created July 4, 2020 18:02
2020-07-04 zig table not exported
(module
(type (;0;) (func (param i32)))
(type (;1;) (func (param i32 i32)))
(type (;2;) (func))
(type (;3;) (func (param i32) (result i32)))
(import "env" "register" (func $register (type 0)))
(func $std.builtin.default_panic (type 1) (param i32 i32)
(local i32 i32 i32)
global.get 0
local.set 2
begin
set_fill_style(FillStyle{ .Color = Color{ .r = 255, .g = 255, .b = 255, .a = 255 } })
fill_rect(0, 0, 640, 480)
set_stroke_style(FillStyle{ .Color = Color{ .r = 204, .g = 204, .b = 204, .a = 255 } })
set_line_cap(LineCap.square)
set_line_width(1.5)
set_line_dash(f32@7ffde74f5c18)
set_fill_style(FillStyle{ .Color = Color{ .r = 100, .g = 100, .b = 100, .a = 255 } })
set_fill_style(FillStyle{ .Color = Color{ .r = 100, .g = 100, .b = 100, .a = 255 } })
set_text_align(TextAlign.Left)
@leroycep
leroycep / forth.zig
Last active February 18, 2021 03:10 — forked from ikskuh/forth.zig
Zig Comptime Forth
const std = @import("std");
pub fn main() !void {
const argv = try std.process.argsAlloc(std.heap.page_allocator);
defer std.process.argsFree(std.heap.page_allocator, argv);
const result = forth("a b +", .{
.a = try std.fmt.parseInt(i32, argv[1], 10),
.b = try std.fmt.parseInt(i32, argv[2], 10),
});