This file sets the title of this gist.
This gist gives an example of how to implement SO question 27138751 by defining a 'segment_plot' function.
"""Utilities for managing database sessions.""" | |
from __future__ import with_statement | |
import contextlib | |
import functools | |
@contextlib.contextmanager | |
def temp_session(session_cls, **kwargs): | |
"""Quick and dirty context manager that provides a temporary Session object | |
to the nested block. The session is always closed at the end of the block. |
"\e[1~": beginning-of-line | |
"\e[4~": end-of-line | |
"\e[5~": history-search-backward | |
"\e[6~": history-search-forward | |
"\e[3~": delete-char | |
"\e[2~": quoted-insert | |
"\e[5C": forward-word | |
"\e[5D": backward-word | |
"\e\e[C": forward-word | |
"\e\e[D": backward-word |
\documentclass{tufte-handout} | |
%% Just draws a baseline grid on the page | |
\usepackage{pagegrid} | |
\pagegridsetup{ | |
top-left, | |
step=\baselineskip, | |
arrowlength=1pt, | |
} | |
% End baseline grid code |
#!/usr/bin/python | |
from selenium import webdriver | |
import unittest, time, re | |
from random import choice | |
correctanswers = [] | |
def tryitnow (): | |
# Copy and paste the module url below, including the key: |
#!/usr/bin/env bash | |
cabal configure && cabal build && cabal haddock --hyperlink-source \ | |
--html-location='/package/$pkg-$version/docs' \ | |
--contents-location='/package/$pkg' | |
S=$? | |
if [ "${S}" -eq "0" ]; then | |
cd "dist/doc/html" | |
DDIR="${1}-${2}-docs" | |
cp -r "${1}" "${DDIR}" && tar -c -v -z --format=ustar -f "${DDIR}.tar.gz" "${DDIR}" | |
CS=$? |
# There are 3 levels of git config; project, global and system. | |
# project: Project configs are only available for the current project and stored in .git/config in the project's directory. | |
# global: Global configs are available for all projects for the current user and stored in ~/.gitconfig. | |
# system: System configs are available for all the users/projects and stored in /etc/gitconfig. | |
# Create a project specific config, you have to execute this under the project's directory. | |
$ git config user.name "John Doe" | |
# Create a global config |
This file sets the title of this gist.
This gist gives an example of how to implement SO question 27138751 by defining a 'segment_plot' function.
Emulating an Enigma machine | |
=== | |
In this gist I'll go over the development of an Enigma machine encoder | |
in Haskell. | |
Here are some useful background info about how the Enigma machine works: | |
- Enigma Simulator: http://enigmaco.de/enigma/enigma.html | |
- "How Enigma Machines Work" http://enigma.louisedade.co.uk/howitworks.html |
# Note – this is not a bash script (some of the steps require reboot) | |
# I named it .sh just so Github does correct syntax highlighting. | |
# | |
# This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5 | |
# | |
# The CUDA part is mostly based on this excellent blog post: | |
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/ | |
# Install various packages | |
sudo apt-get update |
Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.
Translations: (No guarantee that the translations are up-to-date)