Skip to content

Instantly share code, notes, and snippets.

View edwin-jones's full-sized avatar
👨‍💻
Coding things!

Edwin Jones edwin-jones

👨‍💻
Coding things!
View GitHub Profile
@edwin-jones
edwin-jones / fisher-yates.cs
Created August 12, 2022 14:32
Basic fisher yates randomisation algo implementation in C# 10
// Basic Demo of fisher yates randomisation algorithm in C# 10.
var input = Enumerable.Range(1, 10).ToList();
// iterate through the array from last time to first
// for each index i in reversed array:
// var j = (random number >= 0 && < i)
// swap j, i.
input.Reverse();
@edwin-jones
edwin-jones / Local.ini
Created June 24, 2022 22:58
WIP Dawn of war .ini file template for maxing out settings (make sure to set res to your monitor - only 4:3 is supported)
[global]
cameradetail=2
currentmod=w40k
dynamiclights=2
event_detail_level=2
force_watch_movies=1
fx_detail_level=2
modeldetail=2
rl_sso_num_times_shown=3
screenadapter=0
#include <gb/gb.h>
#include <gbdk/console.h>
#include <stdio.h>
#define LOGO_TILE_MAP_SIZE 0x39
#define LOGO_TILE_MAP_WIDTH 0x13
#define LOGO_TILE_MAP_HEIGHT 0x03
#define LOGO_TILE_SET_SIZE 0x0350
#define BEAR_TILE_MAP_SIZE 0x10
#define BEAR_TILE_MAP_WIDTH 0x04
#define BEAR_TILE_MAP_HEIGHT 0x04
#define BEAR_TILE_SET_SIZE 0xE0
#define BEAR_TILE_SET_COUNT 0x0E
const unsigned char bear_tile_map[] ={
0x00,0x01,0x02,0x03,0x04,0x05,0x05,0x06,0x07,0x08,0x09,0x07,0x0A,0x0B,0x0C,0x0D
};
#define BACKGROUND_TILE_SET_COUNT 2
unsigned char background_tile_set[] =
{
0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,
0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
@edwin-jones
edwin-jones / Powershell_profile.ps1
Last active February 18, 2022 10:12
How to load bash formatted SSH agent details into linux/wsl2 powershell sessions
# Stick this in your "$profile" file.
# Rough explanation of ssh-agent output here: http://blog.joncairns.com/2013/12/understanding-ssh-agent-and-ssh-add/
# Note, https://github.com/ivakyb/fish_ssh_agent/blob/master/functions/fish_ssh_agent.fish takes a similar approach.
# Resolve SSH agent details by starting ssh-agent if it's not already running
# and storing current run details in $HOME/.ssh/environment
$environmentfile = "$HOME/.ssh/environment"
if(Test-Path -path $environmentfile -pathtype leaf)
{
Write-Output "ssh agent file exists"
@edwin-jones
edwin-jones / dockerfile
Last active May 21, 2022 22:31
Sample dockerfile for hosting a static webpage via a public git repo.
# Simple docker file to clone a git repo and host its contents via nginx
# assumes a static site with an index.html that lives in the root of the repo
FROM nginx:alpine
# FROM resets ARGs, so this has to be here.
ARG giturl
RUN apk add --no-cache git
RUN git clone $giturl temp
RUN mv temp/* /usr/share/nginx/html/
@edwin-jones
edwin-jones / dockerfile
Created September 8, 2021 14:13
Sample dockerfile
# Build off an existing docker container image:tag.
FROM ubuntu:20.04
# run commands during build.
RUN echo 'Building catfact image'
RUN apt-get update && apt-get install curl -y && apt-get install jq -y
# run commands when container is started from this image - this one prints a catfact!
CMD curl -X GET "https://polite-catfacts.herokuapp.com/catfact" -H "accept: application/json" -s | jq '.fact'
@edwin-jones
edwin-jones / proton
Last active September 18, 2020 13:09
A quick bash script to allow users to use Steam Proton to play Windows games.
#!/usr/bin/env bash
# This script allows us to use the command "proton binary.exe"
# to run windows games via bash.
# Make sure steam is installed and this lives in '~/.local/bin'.
# Give it execution permissions with 'chmod +x proton'
filename=$(basename $1)
export STEAM_COMPAT_DATA_PATH="$HOME/.steam/steam/steamapps/compatdata/$filename"
@edwin-jones
edwin-jones / move-files-to-parent.sh
Created May 16, 2020 17:56
Bash script to move all files in subdirectories into the current directory
find . -mindepth 2 -type f -print -exec mv {} . \;