Skip to content

Instantly share code, notes, and snippets.

import click
import random
def random_choice(input):
line = random.choice(open(input, encoding='utf8').readlines())
if line:
return line
else:
@a358003542
a358003542 / add_mingw64.reg
Created November 18, 2016 01:03
quickly open your cmd in windows or quickly open your msys2 or mingw64 cmd window.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_mingw64]
@="Open MINGW64 here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_mingw64\command]
@="c:\\msys64\\msys2_shell.cmd -mingw64 -here"
@a358003542
a358003542 / Vagrantfile
Created October 19, 2016 05:09 — forked from leifg/Vagrantfile
Add a second disk to system using vagrant
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
### from http://www.laurentluce.com/posts/binary-search-tree-library-in-python/
class Node(object):
"""Tree node: left and right child + data which can be any object
"""