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 -*- coding: utf-8 -*- | |
import sys | |
import itertools | |
f = open('dictionary.txt') | |
dictionary = [w.strip() for w in f.readlines()] | |
f.close() | |
def jumble(word): |
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 -*- coding: utf-8 -*- | |
import re | |
import unittest | |
def least_numeric(strings): | |
return min(strings, key=lambda s: len(re.findall(r'\d', s))) | |
class TestLeastNumeric(unittest.TestCase): | |
def test1(self): |
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 * | |
c = range(8) | |
[v for v in permutations(c) if 8==len({v[i]+i for i in c})==len({v[i]-i for i in c})] |
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
class InOrderTree(Tree): | |
""" iterator for inorder traversal over a binary tree """ | |
def __init__(self, root): | |
self.node = root | |
self.stack = [] | |
def __iter__(self): | |
return self | |
def next(self): |
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
import sys | |
def shortest_path(g, start, end): | |
""" | |
Dijkstra's algorithm Python implementation. | |
Arguments: | |
graph: Dictionnary of dictionnary (keys are vertices). | |
start: Start vertex. |
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
nock = require 'nock' | |
quest = require 'quest' | |
# chaining | |
scope = nock('http://url.ly') | |
.filteringRequestBody (path) -> | |
if path == '*' | |
return '-' | |
else |
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 | |
# OpenSSL requires the port number. | |
SERVER=$1 | |
DELAY=1 | |
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g') | |
echo Obtaining cipher list from $(openssl version). | |
for cipher in ${ciphers[@]} |
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
#!/bin/bash | |
# remove exited containers: | |
docker ps --filter status=dead --filter status=exited --filter status=created -aq | xargs -r docker rm -v | |
# remove unused images: | |
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi | |
# remove unused volumes: | |
docker volume ls -qf dangling=true | xargs -r docker volume rm |
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
mocha test/api/responses/notFound.test.js | ts '[%Y-%m-%d %H:%M:%.S]' |
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
# show commits since master to HEAD | |
git log --oneline --decorate master~..HEAD |
OlderNewer