Skip to content

Instantly share code, notes, and snippets.

View ainsleyrutterford's full-sized avatar

Ainsley Rutterford ainsleyrutterford

  • Amazon
  • London
View GitHub Profile
@ainsleyrutterford
ainsleyrutterford / instructions.md
Last active March 28, 2024 12:58
Fixing tilde key for European ISO keyboards in macOS

When plugging in the bear_face keyboard (by chemicalwill) to a new laptop, I found that it was not letting me select "ISO (Europe, Latin America, Middle East and others)" in the Keyboard Setup Assistant (which was the value on my old laptop), it was only letting me choose "ISO (International)".

As a result, the tilde (~) and plus equals (±) keys were swapped. I couldn't get any other solutions to work for me, and didn't want to manually remap, so I decided to just try and replicate the settings on my old laptop. You can edit the plist file directly like so:

cd /Library/Preferences
sudo chmod a+w com.apple.keyboardtype.plist
sudo plutil -convert xml1 com.apple.keyboardtype.plist
vim com.apple.keyboardtype.plist
sudo plutil -convert bindary1 com.apple.keyboardtype.plist
@ainsleyrutterford
ainsleyrutterford / pokemon-weaknesses.json
Created August 25, 2022 23:16
Pokémon type weaknesses chart as JSON
{
"normal": {
"normal": 1,
"fire": 1,
"water": 1,
"electric": 1,
"grass": 1,
"ice": 1,
"fighting": 2,
"poison": 1,

Hackintosh installation

Notes about the installation processes for Windows, Linux, and macOS on my new build.

Hardware

  • Case: NCASE M1 V5.0
  • CPU: Intel i7 10700K
  • GPU: Sapphire Radeon RX 5700 XT Pulse
  • Memory: Corsair Vengeance LPX DDR4 3000MHz 32GB

Using gdb, a backtrace of the crash can be found:

#0  0x0000000000407b0c in f90sac::f90sac_tshift at f90sac.F90:1126
#1  0x000000000041ae78 in analyser::an_applysplittingoperators at Analyser.F90:138
#2  0x000000000041d23c in evaluatepath at EvaluatePath.f90:84
#3  0x000000000041c1e8 in evaluatemodel at Evaluate.F90:84
#4  0x000000000041d550 in mhsampler at Samplers.f90:95
#5  0x000000000041bcec in mtssampmain at MTSSampMain.f90:47
/* This is for the central column of content */
.container {
max-width: 65rem; /* Allows the column to be resizable */
margin: 0 auto;
padding-top: 2rem;
}
h1 {
color: #000000; /* Black. */
padding: 1rem 1rem 1rem 1rem; /* top, right, bottom, left */
@ainsleyrutterford
ainsleyrutterford / listing.tex
Created April 30, 2019 22:06
Simple example of the listings package in latex.
\usepackage{listings}
\lstset{language=C,
basicstyle=\ttfamily,
keywordstyle=\color{blue}\ttfamily,
stringstyle=\color{red}\ttfamily,
commentstyle=\color{green}\ttfamily,
morecomment=[l][\color{magenta}]{\#}}
% Do everything above in your preamble
@ainsleyrutterford
ainsleyrutterford / anti-aliasing.cpp
Created April 27, 2019 19:06
Anti aliasing code for a rasteriser created using C++.
vec3 aliasing_buffer[SCREEN_HEIGHT][SCREEN_WIDTH];
screen *screen = InitializeSDL(SCREEN_WIDTH/3, SCREEN_HEIGHT/3, FULLSCREEN_MODE);
memset(screen->buffer , 0, screen->height * screen->width * sizeof(uint32_t));
memset(depth_buffer , 0, SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(float ));
memset(aliasing_buffer, 0, SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(vec3 ));
void draw_screen(screen* screen) {
for (int y = 0; y < SCREEN_HEIGHT; y+=3) {
@ainsleyrutterford
ainsleyrutterford / Loader.cpp
Last active April 23, 2019 12:15
Converts .obj files to a vector of Triangles.
#include <iostream>
#include <fstream>
#include <sstream>
#include "TestModelH.h"
using namespace std;
using glm::vec3;
using glm::vec4;
vector<Triangle> load_obj(string filename) {
@ainsleyrutterford
ainsleyrutterford / fps.cpp
Created April 14, 2019 15:27
FPS coutner SDL
Uint32 fps_lasttime = SDL_GetTicks(); //the last recorded time.
Uint32 fps_current; //the current FPS.
Uint32 fps_frames = 0; //frames passed since the last recorded fps.
while (!quit) {
if (update()) {
fps_frames++;
if (fps_lasttime < SDL_GetTicks() - 1000) {
fps_lasttime = SDL_GetTicks();
fps_current = fps_frames;
@ainsleyrutterford
ainsleyrutterford / Lerp.cs
Last active April 9, 2019 17:46
Simple linear interpolation function at a constant speed.
public float driverFloat;
public float currentFloat;
private float Interp(float current, float target, float divisor) {
if (target != current) {
return current + (target - current)/divisor;
} else {
return target;
}
}