Skip to content

Instantly share code, notes, and snippets.

View Day0Dreamer's full-sized avatar

Mikhail Talalaevskiy Day0Dreamer

View GitHub Profile
worker_processes 1;
user nobody nogroup;
# 'user nobody nobody;' for systems with 'nobody' as a group instead
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # set to 'on' if nginx worker_processes > 1
import requests
import json
import urllib.parse
URL = "http://10.10.10.105/link/"
PROXY = "http://10.10.10.105/link/proxy/"
class Request(object):
class KaperkarConstant(object):
_run = 0
def __init__(self, starting_number):
self._starting_n = None
self._first_n = None
self._second_n = None
self._resulting_n = None
@Day0Dreamer
Day0Dreamer / PullString.py
Created October 29, 2018 13:54
Just some pullstring stuff
project.current_category
['add_entry', 'copy', 'cut', 'delete_entry', 'enabled', 'entries', 'move', 'name', 'paste', 'toplevel_entries']
SCRIPT_INFO = {'name': '0'}
import sys
from time import sleep
# if not ui.selection:
# ui.error("Nothing selected")
class WrapWithBokeh(object):
def __init__(self):
self.plot = figure()
def __enter__(self):
return self.plot
def __exit__(self, exc_type, exc_val, exc_tb):
output_file = output_file_name
show(self.plot)
def decorator(func):
def wrapper():
plot = figure()
func(plot)
output_file = output_file_name
show(plot)
return wrapper
@decorator
def python_list(plot):
"""
Python Parallel Processing (in 60 seconds or less)
https://dbader.org/blog/python-parallel-computing-in-60-seconds
"""
import collections
import multiprocessing
Scientist = collections.namedtuple('Scientist', [
'name',
'born',
@Day0Dreamer
Day0Dreamer / TasksPool.py
Created December 10, 2017 16:42
This module allows you to queue and launch processes using PySide's QProcess
"""
This module allows you to queue and launch processes using PySide's QProcess
"""
from PySide.QtCore import QObject, QProcess, Signal, QEventLoop
from PySide.QtGui import QApplication
class TasksPool(QObject):
"""
This class allows you to add_task() for execution queue. Launch_list() starts the queue.
from PySide import QtGui
from PySide.QtCore import QThread, QProcess, Signal, QObject
import sys
class MainDialog(QtGui.QDialog):
def __init__(self):
super(MainDialog, self).__init__()
self.proc = QProcess()
@Day0Dreamer
Day0Dreamer / sequence_check.py
Created October 18, 2017 16:44
This class can generate a file sequence, clean a folder, find missing files, rename the sequence. Expected sequence 'text00000.text'
from os import path, makedirs, scandir, listdir, remove, rename
from re import search, compile
from warnings import warn
# ##################################################### CONFIG ####################################################### #
conf_default_working_path = '.'
conf_default_new_name = 'default_'
# #################################################################################################################### #