This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import chain | |
def lcs(s, t): | |
"""Find longest common substring in strings. | |
>>> lcs('abcdxyz', 'xyzabcd') | |
(4, 'abcd') | |
>>> lcs('abcdxyzabcyzabcdzabcdefghijkllm', 'xyzabcdefghijklm') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Bash completion for click command line interfaces. | |
Provides bash completion helpers for command-line interfaces. | |
""" | |
# batteries included | |
from __future__ import absolute_import | |
# third party |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
function _error() { | |
>&2 printf "\e[31mERROR: $@\e[00m\n" | |
exit 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
export IFS=$'\n\t' | |
SSHFN=$@ | |
ohmyzsh="curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -o \~/install.sh" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
edges = {(1, 'a'): [2, 3], | |
(2, 'a'): [2], | |
(3, 'b'): [4, 2], | |
(4, 'c'): [5]} | |
edges2 = {(1, 'a'): [1], | |
(2, 'a'): [2]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* put this file in ~/.sbt/0.13/plugins/plugins.sbt */ | |
/* style */ | |
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0") | |
/* coursier -- faster dependencies */ | |
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M14") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# REQUIREMENTS | |
# | |
# Needs ruby and the watchr gem, which can be installed | |
# globally via: | |
# | |
# sudo gem install watchr | |
# USAGE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
try: | |
import dns.exception | |
import dns.resolver | |
except ImportError as ex: | |
raise SystemExit('You need to pip install dnspython') | |
import signal | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## IDoneThis | |
function _set_idonethis_token { | |
local token=$(pass datarobot/idonethis | grep Token | cut -d ' ' -f 2) | |
export IDONETHIS_TOKEN=${token} | |
} | |
function idid { | |
_set_idonethis_token | |
local team='datarobot-work-notes' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn collapse-row [row] | |
(filterv (complement nil?) | |
(reduce (fn [acc elm] | |
(let [n (peek acc)] | |
(if (= n elm) | |
(conj (pop acc) (* n 2) nil) | |
(conj acc elm)))) | |
[nil] | |
row))) |