Skip to content

Instantly share code, notes, and snippets.

View dxsmiley's full-sized avatar
🐕
bark bark

Ashley dxsmiley

🐕
bark bark
View GitHub Profile
@dxsmiley
dxsmiley / Main.elm
Created April 2, 2020 02:31
Simple Main.elm file
module Main exposing (..)
-- elm init
-- elm install elm/url
-- elm install rtfeldman/elm-css
import Browser
import Browser.Navigation as Nav
import Css
import Css.Global
@dxsmiley
dxsmiley / AsciiMathToTeX.js
Created November 6, 2018 11:39
Standalone script to convert AsciiMath to LaTeX
#!/usr/bin/env node
/*
ASCIIMathTeXImg.js
Based on ASCIIMathML, Version 1.4.7 Aug 30, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen
Modified with TeX conversion for IMG rendering Sept 6, 2006 (c) David Lippman http://www.pierce.ctc.edu/dlippman
Updated to match ver 2.2 Mar 3, 2014
Modified to run as a standalone script using November 6, 2018 (c) Declan McDonnell https://probablyaweb.site
Program reads from stdin and writes to stdout
@dxsmiley
dxsmiley / readme.md
Created April 26, 2018 11:43
Head and tail functions for those who really want them.

A small library for MathBot that adds head and tail functions for manipulating lists.

@dxsmiley
dxsmiley / source
Last active April 29, 2018 07:53
Thing with an error
# Nothing
f ->
@dxsmiley
dxsmiley / grammarbot.py
Created October 26, 2017 04:49
A discord bot that corrects your writing and makes suggestions.
'''
grammar_bot.py
A discord bot that unrelentingly corrects your
writing and makes suggestions.
This is silly. Don't actually use it in anything
serious.
@dxsmiley
dxsmiley / befunge.c
Last active April 16, 2017 06:30
Befunge interpreter in one c file.
/*
Befunge interpereter, in one large file.
Code taken from this repo: https://github.com/programble/befungeec
It's been smooshed into one file and modified somewhat.
Improvements:
- Shows a special symbols for unprintable characters in debug mode.
- Shows a help message when run with no arguments, rather than crashing.
@dxsmiley
dxsmiley / persist.cpp
Created April 13, 2017 11:04
Persistent range tree
/*
Implementation of a (relatively) simple persistent range tree.
Supports point updates (set) and range-query of sums.
Note that all the ranges in this code are [inclusive, exclusive)
Compiles with
g++ persist.cpp -o persist -std=c++11 -Wall -Wextra -Wshadow -Wpedantic -O2
@dxsmiley
dxsmiley / type_check_time.py
Created January 2, 2017 05:08
Measure different ways of differentiating between ints/floats and tuples/lists.
import random
import numbers
from timeit import timeit
data = [0] * 1000000 + [0.0] * 1000000 + [(0, 0)] * 1000000 + [[0, 0]] * 1000000
random.shuffle(data)
def is_int_float(x):
return isinstance(x, int) or isinstance(x, float)
@dxsmiley
dxsmiley / python_tricks.md
Last active January 13, 2017 12:03
Python Tricks

Python Tricks

These are some tricks in python that should help with speed-based programming competitions, like ProgComp.

The enumerate function

enumerate is usually used when you want to iterate over a list, and have easy access to both the value and the index.

for index, value in enumerate(my_list):
@dxsmiley
dxsmiley / splay-tree.cpp
Last active February 10, 2016 03:52
Implementation of a Splay Tree
#include <iostream>
/*
Implementation of a splay tree
Derived from
- github.com/jonnyhsy/splay-tree
- en.wikipedia.org/wiki/Splay_tree
*/