Skip to content

Instantly share code, notes, and snippets.

View ejmg's full-sized avatar
💾

ejmg ejmg

💾
View GitHub Profile
@ejmg
ejmg / gist:bc8d8bb629e9bb82561504683ddacc9b
Created October 25, 2016 10:21 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@ejmg
ejmg / UTC_Timezone_Codes.py
Created November 2, 2016 06:29
Dictionary with UTC offset values mapped to their phonetic codes
timezones = {"-12:00": "Y",
"-11:00": "X",
"-10:00": "W",
"-09:00": "V",
"-08:00": "U",
"-07:00": "T",
"-06:00": "S",
"-05:00": "R",
"-04:00": "Q",
"-03:00": "P",
@ejmg
ejmg / PrettyPrint2DArray.py
Created November 3, 2016 01:48
Print the contents of a square 2d array as a nicely formatted string
# Prints a square 2d array nicely with spacing of elements
# Modify frmt for the number of elements in each row, as well as the matrix itself of course
newline, empty, frmt = "\n", "", "{:4}"
print(newline.join([empty.join([frmt.format(element) for element in row])
for row in matrix]))
@ejmg
ejmg / getContinousInput.py
Created November 3, 2016 06:17
get an unknown number of lines of input
try:
while True:
inp = input()
if inp != "":
# code
else:
break
except EOFError:
pass
@ejmg
ejmg / ubuntu_py3.md
Created December 26, 2016 20:06 — forked from softwaredoug/ubuntu_py3.md
Ubuntu 14.04 Python 3.4.2 Setup using pyenv and pyvenv

What I did to get Python 3.4.2 on Ubuntu 14.04. The stock version of Python 3 on Ubuntu is 3.4.0. Which is missing some of the best parts! (asyncio, etc). Luckily I discovered pyenv which solved my problem.

Install pyenv

Pyenv (not to be confused with pyvenv) is the Python equivelant of rbenv. It lets you configure which Python environment/version is available per directory, user, or other session variables.

I followed the instructions here to install pyenv in my home directory. Verbatem, those instructions are:

sudo apt-get install git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev
@ejmg
ejmg / org-to-latex-to-pdf.org
Last active January 22, 2017 23:18
This is a template for making a well formatted/tweaked org file that you can export to pdf via latex. It overrides the default headings and footers using the fancyhdr package. I included other customizations I'd use, like biblatex-chicago, but that's up to you. How Gist displays this file is obviously not how it will look once exported via org-m…

@@latex: \Large Here’s how to break a large title@@

\newpage

@ejmg
ejmg / org-to-latex-with-biber.md
Created January 23, 2017 07:15
How to use biber with orgmode --> latex

I may be wrong, but to my knowledge org-mode does not natively play well with biber for bibliography/reference purposes. Until I figure out a work around, here's what I've figured out along with what the internet has shown me.

Given that you are using biblatex with biber as your bibliography system, the file is test.org, and you have the necessary configurations (packages, .bib file, etc) you must:

  1. Export orgmode as latex with org-latex-export-to-latex

  2. Then via terminal:

pdflatex test.tex

Keybase proof

I hereby claim:

  • I am ejmg on github.
  • I am ejmg (https://keybase.io/ejmg) on keybase.
  • I have a public key ASCoBbTOgBbATFzQQ5kkAn7dw45Ufp-Xp5SLJBAclFvUOQo

To claim this, I am signing this object:

Verifying that "eliasjmgarcia.id" is my Blockstack ID. https://onename.com/eliasjmgarcia
@ejmg
ejmg / two-figures.tex
Created October 19, 2017 23:37
how to put two figures, side by side proportionally, in a latex file
\usepackage{multirow,array}
\usepackage{floatrow}
% in combination with floatrow for properly adjusted figures, placeins ensures said figures appear
% where they are declared within the latex code, i.e. in subsection Part I of this paper. For proper
% usage with subsections, MUST use \FloatBarrier command after done with a figure
\usepackage[section]{placeins}
% ensures captions are properly centered under their respective figures
\usepackage[justification=centering]{caption}
% special command for table captions
\newfloatcommand{capbtabbox}{table}[][\FBwidth]