Skip to content

Instantly share code, notes, and snippets.

View sophec's full-sized avatar
🖤
[[maybe_unused]]

Sophie Eccles sophec

🖤
[[maybe_unused]]
View GitHub Profile
@sophec
sophec / Day8.cpp
Last active December 8, 2015 22:13
Part 1 of Day 8 of Advent of Code. The reason for it being a whole new class called Day8 is that I use a single main.cpp to run each day's code, just instantiating a Day6, 7, 8, etc... and using the run() method.
#include "stdafx.h"
#include "Day8.h"
#include <iostream>
#include <string>
#include <fstream>
#include <regex>
using namespace std;
// this is just to make my code later on cleaner and simpler, whereas up here I don't really care.
@sophec
sophec / Day9.cpp
Created December 9, 2015 22:42
This is how I did Day9. Not the most efficient, but I am lazy and am willing to wait a bit longer. Also, this /can/ be wrong, but most likely won't be.
#include "stdafx.h"
#include "Day9.h"
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <algorithm>
#include <map>
using namespace std;
#include <iostream>
#include <regex>
#include <string>
#include <fstream>
#include <vector>
#include <ctime>
#include <thread>
using namespace std;
@sophec
sophec / speakfile.sh
Last active August 13, 2016 17:09
Bash file to speak a file out loud on OS X, with options for volume, voice, and interactive reading.
#! /bin/bash
if (( $# == 1 )) && [ "$1" == "?" ]
then
say -v ?
echo ""
echo "Voices should be specified in quotes if 2+ words."
exit 0
fi
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int place = 1;
int places = 100;
int main(int argc, char* argv[]) {
if (argc >= 3) {
places = atoi(argv[2]);
@sophec
sophec / english wordlist.txt
Created September 27, 2017 18:32
a list of english words, can be used for spellcheck or whatever you want :)
This file has been truncated, but you can view the full file.
aa
aah
aahed
aahing
aahs
aal
aalii
aaliis
aals
aardvark
@sophec
sophec / alfred-kitty.scpt
Last active October 12, 2024 09:03
AppleScript for using Kitty in Alfred. This was made for bash, but can easily be made to work with any shell.
(* 2019-06-07: Added nohup and output redirection to fix a bug with "Open Terminal here" feature.
Thanks to @fools-mate for bringing the issue to my attention. *)
on alfred_script(q)
do shell script "cd ~; nohup /Applications/kitty.app/Contents/MacOS/kitty /bin/bash -c \"source ~/.bashrc && " & q & ";/bin/bash\" > /dev/null 2>&1 &"
end alfred_script
@sophec
sophec / bftranspiler.cpp
Last active May 17, 2019 19:08
A C++ program that transpiles brainfuck code into usable C code.
#include <fstream>
#include <iostream>
#include <string>
#include <map>
#include <regex>
const std::map<char, std::string> bfinstructions{
{'>', "++ptr;"},
{'<', "--ptr;"},
{'+', "++*ptr;"},
@sophec
sophec / 2018day8.cpp
Created May 21, 2019 20:33
Day 8 of 2018 advent of code. Loads input from file instead of stdin so that's very slow, and I put almost no effort into making it faster after it was done.
#include <chrono>
#include <cstdio>
#include <fstream>
#include <string>
#include <vector>
#include "tree.h" // for TreeNode
using namespace std::chrono;
@sophec
sophec / bmp2arduino.cs
Last active May 29, 2026 18:42
A simple program to convert a Windows bitmap to an Adafruit GFX library bitmap array for monochrome OLED displays.
/*
* bmp2arduino.cs
* Sophie Eccles 2019
*
* Takes a Windows bitmap file and outputs a C header containing a bitmap array
* to be used with the Adafruit GFX library. Only works for monochrome files at this time.
* All pixels that are not black or transparent are assumed to be white.
*
* Run with no arguments to see usage.
*