Skip to content

Instantly share code, notes, and snippets.

View Devligue's full-sized avatar

Krzysztof Dziadowiec Devligue

View GitHub Profile
@Devligue
Devligue / win.spec
Created August 24, 2018 12:53
Example *.spec files for PyUpdater Python app from Pipenv managed project
# -*- mode: python -*-
import os
import sys
import subprocess
def get_venv_path():
output = subprocess.check_output(['pipenv', '--venv'])
return output.decode('utf-8').rstrip()
@Devligue
Devligue / ginit.vim
Last active August 8, 2018 11:40
My personal installation and configuration guide for NeoVim
" Set font on start
:Guifont DejaVu Sans Mono for Powerline:10
@Devligue
Devligue / INSTRUCTIONS.md
Last active July 3, 2018 22:11
INTERVIEW: Determine if string can be splitted into sentence using words in provided list.

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'.

@Devligue
Devligue / INSTRUCTIONS.md
Last active July 3, 2018 23:18
INTERVIEW: Given a list of intervals, write function that will merge the overlapping intervals and return new list. For example, given [1,3],[8,10],[2,6],[15,18] return [1,6],[8,10],[15,18].

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].

@Devligue
Devligue / cd_extensions.sh
Last active April 20, 2018 11:49
Scripting Languages - Bash Project - AGH Winter 2017
#!/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
@Devligue
Devligue / pretty_xml.py
Created March 30, 2017 11:06
print xml in a redable way
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)
@Devligue
Devligue / config.py
Last active March 2, 2017 12:19
"Fractal Spirograph" with Processing.py. The visuals are inspired by images and explanation on C. J. Chen's blog: http://benice-equation.blogspot.ca/2012/01/fractal-spirograph.html This code is a python version of the original one presented in video: https://www.youtube.com/watch?v=0dwJ-bkJwDI
resolution = 10
k = 4
@Devligue
Devligue / RunAsAdmin.py
Last active April 20, 2024 16:24
Collection of Python code snippets usefull to deal with admin privilages on Windows
#!python
# coding: utf-8
# by GaryLee
# https://gist.github.com/GaryLee/d1cf2089c3a515691919
import sys
import ctypes
def run_as_admin(argv=None, debug=False):
@Devligue
Devligue / sys_tray_icon.py
Last active January 24, 2017 10:33
window tray icon with pop-up menu
#!/usr/bin/env python
# Module : SysTrayIcon.py
# Synopsis : Windows System tray icon.
# Programmer : Simon Brunning - simon@brunningonline.net
# 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...'''
@Devligue
Devligue / balloon_tip.py
Created December 30, 2016 20:42
windows 10 balloon tip notification
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