Skip to content

Instantly share code, notes, and snippets.

View dmsul's full-sized avatar

Daniel M. Sullivan dmsul

View GitHub Profile
@dmsul
dmsul / main.py
Created January 11, 2019 15:17
Solution to Riddler basic, 190111
THE_NUMBER = ('53013180176278773980288979275410970{}13935854771006625765205034'
'6294484433323974747960297803292989236183040000000000')
def factorize(x: int) -> list:
""" Return list of prime factors of `x` """
last_factor = 1
factors = []
while True:
last_factor = find_factor(x)
@dmsul
dmsul / preamble.tex
Created September 27, 2018 01:44
Example preamble
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage[utopia]{mathdesign}
%\usepackage{mathptmx}
%\usepackage{mathpazo}
%\usepackage{fontspec}
%\setmainfont{Cambria}
@dmsul
dmsul / git-latexdiff.sh
Last active April 12, 2019 03:25
A small script to easily use Git with `latexdiff`
#!/bin/bash
# Special flag to clean up the mess
# Example: ./git-latexdiff.sh -c
# Deletes all the files created by this script; be careful, it will delete
# files with the names `old.tex` and `diff.tex` even if they weren't created
# by this script.
if [[ "$1" == "-c" ]] ; then
latexmk -C diff.tex
rm old.tex diff.tex
@dmsul
dmsul / vim_crash_course.md
Last active April 16, 2024 01:32
Vim Crash Course

NOTE: Specific examples given for options, flags, commands variations, etc., are not comprehensive.

NORMAL MODE

Vim has 2 main "modes", that chance the behavior of all your keys. The default mode of Vim is Normal Mode and is mostly used for moving the cursor and navigating the current file.

Some important (or longer) commands begin with ":" and you will see the text you enter next at the bottom left of the screen.

:q[uit] - quit (the current window of) Vim. ("Window" here is internal to Vim, not if you have multiple OS-level windows of Vim open at once.)
:q! - force quit (if the current buffer has been changed since the last save)
:e[dit] {filename} - read file {filename} into a new buffer.