Skip to content

Instantly share code, notes, and snippets.

View OniDaito's full-sized avatar

Benjamin Blundell OniDaito

View GitHub Profile
@OniDaito
OniDaito / gist:eba56584df119673fe7b6c02d1e91213
Created October 3, 2023 15:39
Vulkan Ash Render to Image Snippet
// Command Pool Functions
pub fn create_command_pool(
device: &ash::Device,
queue_families: &QueueFamilyIndices,
) -> vk::CommandPool {
let command_pool_create_info = vk::CommandPoolCreateInfo {
s_type: vk::StructureType::COMMAND_POOL_CREATE_INFO,
p_next: ptr::null(),
flags: vk::CommandPoolCreateFlags::empty(),
queue_family_index: queue_families.graphics_family.unwrap(),
@OniDaito
OniDaito / test_custom_runner.py
Created July 5, 2023 07:56
platform.io script to alter the the Unity Tests to use Serial1 instead of Serial for the ATMega32u4
from platformio.public import UnityTestRunner
class CustomTestRunner(UnityTestRunner):
UNITY_FRAMEWORK_CONFIG = dict(
native=dict(
code="""
#include <stdio.h>
void unityOutputStart(unsigned long baudrate) { (void) baudrate; }
void unityOutputChar(unsigned int c) { putchar(c); }
@OniDaito
OniDaito / gist:1cd3ee5efd3c6e8ebd3ece15a8d15238
Last active October 21, 2022 16:05
Minimising a set of distances between 4 points
/**
* ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
* █░███░██▄██░▄▄▄█░▄▄▄█░██░▄▄
* █▄▀░▀▄██░▄█░█▄▀█░█▄▀█░██░▄▄
* ██▄█▄██▄▄▄█▄▄▄▄█▄▄▄▄█▄▄█▄▄▄
* ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
* @file solver.cpp
* @author Benjamin Blundell - k1803390@kcl.ac.uk
* @date 21/10/2022
* @brief Go through all centroids and create the best average
@OniDaito
OniDaito / plague_doctor.ino
Created April 25, 2021 17:44
Plague Doctor Mask Arduino Gist
#include <FastLED.h>
#include <SoftwareSerial.h>
SoftwareSerial MyBlue(11, 12); // RX | TX
#define PIN_LEFT_EYE 3
#define PIN_RIGHT_EYE 4
#define LEFT_OFFSET 2
#define RIGHT_OFFSET -4
#define STRIP_SIZE 16
@OniDaito
OniDaito / pytorchvis.py
Created May 14, 2020 16:41
Given a model from pytorch, print out to console and graphviz to see what is going on
# Our drawing graph functions. We rely / have borrowed from the following
# python libraries:
# https://github.com/szagoruyko/pytorchviz/blob/master/torchviz/dot.py
# https://github.com/willmcgugan/rich
# https://graphviz.readthedocs.io/en/stable/
def draw_graph(start, watch=[]):
from graphviz import Digraph
-- Searching an n'ary tree returning the char or null
-- Benjamin Blundell
-- me@benjamin.computer
--
-- https://www.reddit.com/r/haskellquestions/comments/3han54/how_do_you_flatten_a_nested_list_of_arbitrary/
module Main where
data Tree a = Leaf a | Branch a [Tree a] deriving (Show)
# 3 atoms from the previous residue
# The first residue already has the first 3 atoms laid out
a = prev_res.a.clone()
b = prev_res.b.clone()
c = prev_res.c.clone()
d = @a
na = [@b,@c]
# Bond lengths, bond angles and torsions (already in radians, as extracted from the DB)
blengths = [1.53, 1.453, 1.325]

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

Come fork bombs, and fall on Slough It isn't fit for servers now No disk space I hear you howl rm minus rf

Come fork bombs and crash the machines Those air-conditioned, Windows XPs Dell Racks, Dell Blades, Dell Screens Dell Minds, Dell Invoices

@OniDaito
OniDaito / grapher.pl
Created February 25, 2016 10:27
Cheeky IRSSI Level Bar Graph Script
use strict;
use Irssi;
use Irssi::Irc;
use vars qw($VERSION %IRSSI);
use POSIX;
sub grapher {