Skip to content

Instantly share code, notes, and snippets.

Avatar

Pavel Kulyov pkulev

View GitHub Profile
View blowmymind.py
def makeTrigger(triggerMap, triggerType, params, name):
"""
Takes in a map of names to trigger instance, the type of trigger to make,
and the list of parameters to the constructor, and adds a new trigger
to the trigger map dictionary.
triggerMap: dictionary with names as keys (strings) and triggers as values
triggerType: string indicating the type of trigger to make (ex: "TITLE")
params: list of strings with the inputs to the trigger constructor (ex: ["world"])
name: a string representing the name of the new trigger (ex: "t1")
View decorators.py
from datetime import datetime
DEBUG = True
TIMER = True
def logger(func):
import sys
def inner(*args, **kwargs):
sys.stdout.write("[{}] Calling FNAME with args: {} | kwargs: {}\n".format(datetime.now(),
args,
View screensaver.py
import sys
import curses
import time
from collections import namedtuple
class App(object):
def __init__(self):
self.screen = curses.initscr()
self.screen.nodelay(True)
View <i>.py
import sys
import curses
from curses import KEY_ENTER
import time
from collections import namedtuple
KEY = "KEY"
K_A = ord("a")
K_D = ord("d")
View 234
─most@HPC ~
╰─$ inxi -v 7 -c 18 |grep -4 Graphics
Machine: Mobo: ASUSTeK model: UX32VD v: 1.0 Bios: American Megatrends v: UX32VD.212 date: 09/17/2012
CPU: Dual core Intel Core i7-3517U (-HT-MCP-) cache: 4096 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 9578
Clock Speeds: 1: 1800 MHz 2: 1800 MHz 3: 1800 MHz 4: 1800 MHz
Graphics: Card-1: Intel 3rd Gen Core processor Graphics Controller bus-ID: 00:02.0 chip-ID: 8086:0166
Card-2: NVIDIA GF117M [GeForce 610M/710M/820M / GT 620M/625M/630M/720M]
bus-ID: 01:00.0 chip-ID: 10de:1140
Display Server: X.Org 1.15.99.903 driver: intel Resolution: 1920x1080@60.0hz
View bad_duck.py
from abc import ABCMeta, abstractmethod
class Duck(object, metaclass=ABCMeta):
def quack(self):
print("Quack")
def swim(self):
print("I'm swimming!")
View lol.py
>>> def timer(t, cb):
... time.sleep(t)
... cb()
...
>>> import time
>>> def foo():
... print("Я проснулася!")
>>> th = threading.Thread(name='th1', target=timer, args=(5, foo))
View .Xresources
xterm*font: -*-terminus-medium-*-*-*-16-*-iso10646-*
xterm*wideFont: -misc-fixed-medium-r-normal-ja-16-120-75-75-c-120-iso10646-1
UXTerm.font: xft:Terminus:pixelsize=14,xft:Kochi Mono
!! Molokai Theme
*xterm*background: #101010
*xterm*foreground: #d0d0d0
*xterm*cursorColor: #d0d0d0
View l.bash
#! /bin/bash
function print_usage {
echo "Usage: $0 [start|stop|restart]"
}
if test "$#" -ne 1; then
print_usage
fi
View lol.py
#!/usr/bin/env python
from __future__ import print_function
import curses
import functools
import sys
class Settings(object):