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 PySide2.QtWidgets import * | |
from PySide2.QtGui import * | |
import base64 | |
# icon base64 encoded data | |
ico_encoded = b'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ\nbWFnZVJlYWR5ccllPAAAAyZpVF' \ | |
b'h0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdp\nbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+' \ | |
b'IDx4OnhtcG1ldGEgeG1sbnM6\neD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1\n' \ | |
b'OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJo\ndHRwOi8vd3d3LnczLm9yZy8xOT' \ | |
b'k5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlw\ndGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMu' \ |
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 time | |
import os | |
def compute(): | |
array = [] | |
for i in range(10): | |
start = time.perf_counter() | |
for i in range(1000000): | |
x = 2*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
from concurrent.futures import ProcessPoolExecutor | |
import multiprocessing | |
def infinite_compute(a): | |
print('Core', a) | |
while True: | |
x = 2 * 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
""" | |
Python-ANTIPATTERN counter | |
""" | |
class Counter(object): | |
def __init__(self, init=0): | |
self.val = init | |
def __repr__(self): | |
return 'Count: {}'.format(self.val) |
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 collections import deque | |
import time | |
# append right | |
print('Test append right') | |
st = time.perf_counter() | |
for _ in range(1000): | |
l1 = deque() | |
for i in range(5000): | |
l1.append(i) |
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 ProgressBar(object): | |
def __init__(self, label='Progress', start_message=None, end_message=None, | |
chunk_full='#', chunk_empty='-', border='[]'): | |
self.lb = label | |
self.sm = start_message | |
self.em = end_message | |
self.cf = chunk_full | |
self.ce = chunk_empty | |
self.br = border |
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 bas | |
# start as SUDO | |
# install libs | |
apt-get install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev curl | |
mkdir ~/build | |
# build ssl | |
cd ~/build |
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
#include <SPI.h> | |
#include <TFT_eSPI.h> | |
#define PIXELPIN 5 | |
#define NUMPIXELS 5 | |
#define pixlux 20 | |
#define BUTTON_1 35 | |
#define BUTTON_2 0 | |
#define SW 135 | |
#define SH 240 |
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 | |
pyinstaller compile.spec --distpath=${PWD}/dist |
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 nuke | |
def get_nodes_by_type(node, types): | |
array = [] | |
for inp in range(node.inputs()): | |
inp_node = node.input(inp) | |
if inp_node.Class() in types: | |
array.append(inp_node) | |
array.extend(get_nodes_by_type(inp_node, types)) | |
return array |