Skip to content

Instantly share code, notes, and snippets.

View WillSams's full-sized avatar
🚀

Will Sams WillSams

🚀
View GitHub Profile
@WillSams
WillSams / cplusplus_lambdas_kata.cpp
Last active January 16, 2023 12:36
GoF Command Pattern using C++ Lambdas
#include <iostream>
#include <stack>
#include <functional>
using Receiver = std::function<void(std::function<void()>)>;
class Command {
public:
virtual void setReceiver(Receiver receiver) = 0;
virtual void execute() = 0;
@WillSams
WillSams / 2018-samba
Last active January 13, 2023 17:04
Easy samba configuration
sudo bash -c "apt update && sudo update -y"
sudo bash -c "apt install samba"
sudo smbpasswd -a # type in a password
sudo bash -c "echo '
####################################################
[videos]
path = $HOME/Pictures
available = yes
valid users =
@WillSams
WillSams / sdl2-pkgs-install.sh
Last active January 8, 2023 14:25
Script to get SDL2 up & running on your system
#SCRIPTVERSION="2014.06.16-Debian"
SCRIPTVERSION="2022.12.13-Debian"
SCRIPTNAME="sdl2-pkgs-install.sh"
SCRIPTFULLNAME="$0"
BUILDDIR=/tmp/sdlbuild
sudo bash -c "apt update"
sudo bash -c "apt install libxext-dev build-essential automake autoconf libtool -y"
sudo bash -c "apt install mesa-common-dev libasound2-dev libpulse-dev -y"
sudo bash -c "apt install libpng-dev libjpeg-dev libwebp-dev libtiff-dev -y"
@WillSams
WillSams / ubuntu-postgres.sh
Last active January 5, 2023 14:16
Getting Postgres up & running
!#/bin/sh
# REMOVAL ##################################
sudo apt-get --purge remove postgresql
sudo apt-get purge postgresql*
sudo apt-get --purge remove postgresql postgresql-doc postgresql-common
sudo rm -rf /var/lib/postgresql/
sudo rm -rf /var/log/postgresql/
sudo rm -rf /etc/postgresql/
@WillSams
WillSams / psx_dev_setup.sh
Last active December 11, 2022 20:17
Playstation 1 Dev Setup
#!/bin/bash
TEMPBUILDDIR=/tmp/psxbuild
GCCBUILDIR=$TEMPBUILDDIR/pkgs/gcc-build
BINUTILS_VERSION=2.39
GCC_VERSION=7.1.0
PSXDEV=/opt/toolchains/psx
@WillSams
WillSams / sh2_dev_setup.sh
Last active December 3, 2022 17:15
Saturn/32x Tool chain
#!/bin/bash
# I'm just going by what I've done before and the configuration flags found here:
# https://github.com/kentosama/sh2-elf-gcc/
TEMPBUILDDIR=/tmp/saturn
GCCBUILDIR=$TEMPBUILDDIR/pkgs/gcc-build
BINUTILS_VERSION=2.39
GCC_VERSION=7.1.0
@WillSams
WillSams / dc_dev_setup.sh
Last active December 1, 2022 16:50
Dreamcast - sh4 toolchain and KOS
#!/bin/bash
DCDEV=/opt/toolchains/dc
sudo bash -c "apt-get install -y genisoimage squashfs-tools libpng-dev libjpeg-dev liblzo2-dev"
sudo bash -c "mkdir -p $DCDEV/tools/kos"
sudo bash -c "chown -R $(id -u):$(id -g) $DCDEV"
cd /tmp && git clone https://github.com/LuaDist/tolua.git && cd tolua
mkdir build && cd ./build
@WillSams
WillSams / fullstack_macbook_setup.sh
Last active November 15, 2022 19:32
Fullstack Macbook Setup
# March 11th, 2022 will be a day of infamy....
echo '# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi' >| ~/.bash_profile
echo 'set -o noclobber
PS1="\[\e]0;will@samswebs.com \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]willsams@samswebs.com\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\]"
' >> ~/.bashrc
@WillSams
WillSams / m68k_dev_setup.sh
Last active October 23, 2022 18:06
Setup for Motorola 68000 (Sega, Neo Geo) Cross Compiler on Windows-based System
#!/bin/bash
echo "==================================================================="
echo
echo " My m68000 Development Setup "
echo " You may be prompted by UAC for credentials to complete the install "
echo
echo " Pre-req: Latest 64-bit MSYS2 from http://www.msys2.org/ "
echo
echo " Howto: Use 'wget' to download the raw version of this script "
@WillSams
WillSams / main.py
Last active September 28, 2022 02:48
MonoGame w/ IronPython Example
import os, clr
clr.AddReferenceToFile("MonoGame.Framework.dll")
clr.AddReferenceToFile("OpenTK.dll")
from Microsoft.Xna.Framework import *
from Microsoft.Xna.Framework.Graphics import *
class App(Game):
def __init__(self):
self.graphics = GraphicsDeviceManager(self)