Skip to content

Instantly share code, notes, and snippets.

View tomdaley92's full-sized avatar
💾
Loading...

Tom Daley tomdaley92

💾
Loading...
View GitHub Profile
@tomdaley92
tomdaley92 / makefile
Last active December 5, 2018 09:38
Build template for Windows C/C++ programs
# Author: Thomas Daley
# Date: September 16, 2016
# Purpose: Build template for Windows C/C++ Programs.
#
# Note: Microsoft Visual C/C++ Build Tools are assumed to be installed and
# added to PATH. The folders "src" and "bin" are expected.
#
# 1) vcvarsall
# 2) nmake
@tomdaley92
tomdaley92 / ethos.py
Last active December 31, 2017 07:23
Ethos programming challenge <http://dev.getethos.com>
#!/usr/bin/env python3
'''
Thomas Daley
October 16, 2017
This code contains the solution for the programming
challenge hosted at dev.getethos.com
The first step is to find the instructions which can be
#!/usr/bin/env python
import os
from sys import argv
from subprocess import Popen
def create_file(hidden, n):
with open(hidden, 'wb') as f:
f.seek(n-1)
f.write(b'\x00')
@tomdaley92
tomdaley92 / makefile
Last active April 15, 2024 07:44
Generic makefile for C/C++ programs
# Thomas Daley
# September 13, 2021
# A generic build template for C/C++ programs
# executable name
EXE = app
# C compiler
CC = gcc
@tomdaley92
tomdaley92 / ast.py
Last active June 27, 2022 05:49
Abstract Syntax Trees and the Shunting Yard Algorithm
#!/usr/bin/env python3
'''
Abstract Syntax Trees
01/04/2018
You may override the constants OPERATORS and PRECEDENCE
to define your own grammar. The is_operand() function is
intended to be redefined as well and is used to determine
if a given token within an expression string is a valid
@tomdaley92
tomdaley92 / update_requirements.sh
Last active February 8, 2018 18:55
Update all pip packages within a virtualenv
# Check and update all local packages
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
# Write the new requirements to a file
pip freeze > requirements.txt
@tomdaley92
tomdaley92 / rsub_setup.md
Last active July 19, 2021 11:16
Installing and configuring rsub for editing files with sublime through ssh
  1. Install rmate on the remote server
sudo wget -O /usr/local/bin/rsub https://raw.github.com/aurora/rmate/master/rmate && sudo chmod a+rx /usr/local/bin/rsub
  1. Modify your ~/.ssh/config file on your local machine
Host *
@tomdaley92
tomdaley92 / example.h
Created December 19, 2018 00:25
Prevent name mangling of C code with C++ compiler
#ifdef __cplusplus
extern "C" {
#endif
/* Declarations of this file */
#ifdef __cplusplus
}
#endif
@tomdaley92
tomdaley92 / filename.h
Last active January 29, 2019 23:00
C/C++ Header guards
#ifndef FILENAME_H
#define FILENAME_H
/* Declarations of this file */
#endif /* FILENAME_H */
@tomdaley92
tomdaley92 / .zshrc
Last active November 28, 2021 02:12
Zsh Configuration (oh-my-zshell)
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/tom/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes