Skip to content

Instantly share code, notes, and snippets.

View dmitryhd's full-sized avatar

Dmitry Khodakov dmitryhd

View GitHub Profile
@dmitryhd
dmitryhd / supervisord-example.conf
Created August 15, 2016 16:41 — forked from didip/supervisord-example.conf
Example configuration file for supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
import time
import psutil
import os
class Timer:
def __init__(self, logger=None, msg='', log_start=True):
self.logger = logger
self.msg = msg
self.enter_memory_usage_mb = 0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/*
Name: Base16 Monokai Dark
Author: Wimer Hazenberg (http://www.monokai.nl)
CodeMirror template adapted for IPython Notebook by Nikhil Sonnad (https://github.com/nsonnad/base16-ipython-notebook)
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools)
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
Fixed by DKhodakov
vim ~/.jupyter/custom/custom.css
/*
Name: Base16 Monokai Dark
Author: Wimer Hazenberg (http://www.monokai.nl)
CodeMirror template adapted for IPython Notebook by Nikhil Sonnad (https://github.com/nsonnad/base16-ipython-notebook)
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools)
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
Fixed by DKhodakov
vim ~/.jupyter/custom/custom.css
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dmitryhd
dmitryhd / pandas_cat_data_example.py
Created July 12, 2016 11:59
pandas: categorical data
import pandas as pd
df = pd.DataFrame({
'a': ['a', 'a', 'b', 'b', 'cc'],
'b': ['d', 'e', 'f', 'g', 'h'],
})
df.a.astype('category').cat.codes # + df.b.astype('category')
class Timer:
def __init__(self, precision=1):
self.precision = precision
self.creation_time = time.time()
self.start()
def start(self):
self.btime = time.time()
@property
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.