Skip to content

Instantly share code, notes, and snippets.

View Iainmon's full-sized avatar
🥶

Iain Moncrief Iainmon

🥶
View GitHub Profile
@Iainmon
Iainmon / snippet.rb
Created April 25, 2018 08:04
Ruby sample
puts “Enter an integer: “
num = gets
puts “You entered: #{num}”
@Iainmon
Iainmon / snippet.c
Created April 25, 2018 08:04
C sample code
#include <stdio.h>
int main()
{
int number;
printf("Enter an integer: ");
scanf("%d", &number);
printf("You entered: %d", number);
return 0;
}
const int knobPin = 3;
const int onButtonPin = 2;
const int relayPin = 4;
const int potPin = 2; //analog
int onButtonState = 0;
int potVal;
bool onState;
int hertz;
@Iainmon
Iainmon / newcomputer.sh
Created December 13, 2018 02:06
newcomputer
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install zsh
brew install wget
brew install crystal
brew install php@7.2
brew install composer
composer global require weprovide/valet-plus
sudo apt-get update;
sudo apt-get install php7.2;
sudo apt-get install php7.2-mbstring;
sudo apt-get install php7.2-zip;
//install composer and move to bin directory.
composer install --no-dev;
cp .env.example .env;
php artisan key:generate;
sudo git reset --hard origin/master; sudo git pull origin master;
#nosudo
git reset --hard origin/master; git pull origin master;
# ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.zip
# extract and cd into the directory
./configure --enable-utf8 --enable-unicode-properties
make
sudo make install
# Build executable normally
shards build --release
# See dependant libraries
otool -L bin/EXECUTABLE
# Install any the static libs that are required
brew reinstall -s libgc
brew reinstall -s libevent
abstract class Animal
abstract def speak
end
class Dog < Animal
def speak
"Bark!"
end
end
@Iainmon
Iainmon / SamplePatternDecoder.ts
Last active May 30, 2019 06:48
A decoder algorithm I wrote for parsing, and incrementing Chain of Custody asbestos sample numbers.
// PatternDecoder.ts
export class PatternDecoder {
private prefix: string;
private splitter: string;
private startIndex: number | string;
private currentIndex: number | string;