Given a collection of intervals, merge all overlapping intervals.
For example, given [1,3],[8,10],[2,6],[15,18]
return [1,6],[8,10],[15,18]
.
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
def print_progress(iteration, total, prefix='', suffix='', | |
decimals=1, bar_length=100): | |
"""Call in a loop to create terminal progress bar. | |
Required keyword arguments: |
from win32gui import * | |
import time | |
import win32con | |
NIIF_USER = 0x4 | |
""" | |
Show toast notification messages in Windows 10 | |
Based on https://github.com/jithurjacob/Windows-10-Toast-Notifications/blob/master/main.py |
#!/usr/bin/env python | |
# Module : SysTrayIcon.py | |
# Synopsis : Windows System tray icon. | |
# Programmer : Simon Brunning - [email protected] | |
# Date : 11 April 2005 | |
# Notes : Based on (i.e. ripped off from) Mark Hammond's | |
# win32gui_taskbar.py and win32gui_menu.py demos from PyWin32 | |
'''TODO | |
For now, the demo at the bottom shows how to use it...''' |
#!python | |
# coding: utf-8 | |
# by GaryLee | |
# https://gist.github.com/GaryLee/d1cf2089c3a515691919 | |
import sys | |
import ctypes | |
def run_as_admin(argv=None, debug=False): |
resolution = 10 | |
k = 4 |
import xmltodict | |
xml_string = 'your_xml_string' | |
d = xmltodict.parse(xml_string) | |
def pretty(d, indent=0): | |
for key, value in d.items(): | |
print('\t' * indent + str(key)) | |
if isinstance(value, dict): | |
pretty(value, indent + 1) |
#!/bin/bash | |
# usage: source cd_extentions.sh | |
# for best results add the above command to your .bashrc file | |
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
CD_HISTORY_FILE="${SCRIPT_DIR}/.cd_history" | |
if [ ! -e "$CD_HISTORY_FILE" ] ; then | |
touch "$CD_HISTORY_FILE" | |
fi |
Given a collection of intervals, merge all overlapping intervals.
For example, given [1,3],[8,10],[2,6],[15,18]
return [1,6],[8,10],[15,18]
.
Given a non-empty string s
and a list word_list
containing a list of non-empty words, determine if s
can be segmented into a space-separated sequence of one or more dictionary words. You may assume the word_list
does not contain duplicates, but each word can be used more than once.
For example, given:
s = 'whataniceday'
word_list = ['a', 'what', 'an', 'nice', 'day']
Return True
, because 'whataniceday'
can be segmented as 'what a nice day'
.
" Set font on start | |
:Guifont DejaVu Sans Mono for Powerline:10 |