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.
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.
| \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: |
| 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 |
| """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. |
| #!/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=$? |
| #!/usr/bin/python | |
| """ | |
| Completely reset TCC services database in macOS | |
| Note: Both the system and individual users have TCC databases; run the script as both | |
| a user and as root to completely reset TCC decisions at all levels. | |
| 2018-08-15: Resetting the 'Location' service fails; unknown cause | |
| 2018-08-16: Confirmed the 'All' service does not really reset _all_ | |
| services, so individual calls to each service is necessary. |
| # 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 |
| "\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 |