Skip to content

Instantly share code, notes, and snippets.

Josh Simmons jsimmons

  • Melbourne, Australia
Block or report user

Report or block jsimmons

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View linux_unwind.c
#include <elfutils/libdwfl.h>
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <errno.h>
@jsimmons
jsimmons / rays.rs
Created Aug 11, 2019
Rays on a Plane
View rays.rs
use std::fs::File;
use std::io::BufWriter;
use std::io::Write as IoWrite;
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};
use std::path::Path;
use rand::{Rng, SeedableRng};
use rand_distr::{Distribution, UnitDisc, UnitSphere};
use rand_pcg;
View init.vim
let mapleader=","
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.local/share/nvim/plugged')
Plug 'godlygeek/tabular'
Plug 'rust-lang/rust.vim'
Plug 'ctrlpvim/ctrlp.vim'
View smash.lua
local sdl = require 'SDL'
local image = require 'SDL.image'
local ttf = require 'SDL.ttf'
local table, math, string = table, math, string
local status, err = sdl.init {
sdl.flags.Video
}
if not status then
View smash.lua
local sdl = require 'SDL'
local image = require 'SDL.image'
local ttf = require 'SDL.ttf'
local table, math, string = table, math, string
local status, err = sdl.init {
sdl.flags.Video
}
if not status then
View flood_fill.lua
local function clear_tile_teams()
for i = 1, conf_map_num do
local tile = g_map[i]
local tile_type = tile.tile_type
if tile_type ~= 'water' and
tile_type ~= 'bridge' and
tile_type ~= 'rocks' and
tile_type ~= 'building' then
tile.team = nil
end
@jsimmons
jsimmons / packs.rs
Last active Sep 4, 2017
Does it Pack
View packs.rs
#[derive(Copy, Clone, Debug)]
struct Tile {
/// A - B - C
/// | |
/// H D
/// | |
/// G - F - E
///
/// A = 0
@jsimmons
jsimmons / main.rs
Created Aug 28, 2017
How to use dGPU in Optimus systems via Rust
View main.rs
#![feature(link_args)]
// Don't try and do this via cargo it's a huge disaster,
// just ignore the ominous warnings about link_args being
// broken. (requires nightly, too, hurray)
#[cfg(target_os="windows")]
#[link_args="/EXPORT:NvOptimusEnablement"]
extern {}
#[allow(non_upper_case_globals)]
@jsimmons
jsimmons / TASK.md
Last active Aug 21, 2017
Thoughts on a task system
View TASK.md
  • WORK ITEM:

    • Work closure
    • pointer to TASK
  • TASK:

    • WORK ITEMs Array
    • Atomic num_open_work_items counter - init to number of WORK ITEMs
    • Permits pointer to TASK which depends on this one
  • WORKER

@jsimmons
jsimmons / link_map.c
Last active Aug 15, 2017
Linking The Hard Way
View link_map.c
You can’t perform that action at this time.