Skip to content

Instantly share code, notes, and snippets.

@nandyne
nandyne / .jsbeautifyrc
Created January 3, 2018 08:17 — forked from wzup/.jsbeautifyrc
.jsbeautifyrc file example
{
// The plugin looks for a .jsbeautifyrc file in the same directory as the
// source file you're prettifying (or any directory above if it doesn't exist,
// or in your home folder if everything else fails) and uses those options
// along the default ones.
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "dust"],
import os
from socket import gethostname
formatters = {
'GREEN': '\033[92m',
'RED': '\033[91m',
'END': '\033[0m',
}
hostname = gethostname()
username = os.environ['USER']
@nandyne
nandyne / install_packages.sh
Created September 6, 2018 10:10 — forked from luiscape/install_packages.sh
Install Python dependency packages from requirements.txt using conda.
#
# Original solution via StackOverflow:
# http://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t
#
#
# Install via `conda` directly.
# This will fail to install all
# dependencies. If one fails,
# all dependencies will fail to install.
@nandyne
nandyne / date_formats.txt
Created October 18, 2018 09:37
Python Date Formats
Directive Meaning Notes
%a Locale’s abbreviated weekday name.
%A Locale’s full weekday name.
%b Locale’s abbreviated month name.
%B Locale’s full month name.
%c Locale’s appropriate date and time representation.
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%I Hour (12-hour clock) as a decimal number [01,12].
@nandyne
nandyne / _config_loader.py
Created October 18, 2018 17:48
yaml Config Loader
class _Config_Loader:
"""
Loads the Config file given while instantiating
"""
def __init__(self, config_path):
from utility.exceptions import ImproperlyConfigured
from pathlib import Path
import yaml
__config_path = Path(config_path).resolve()
@nandyne
nandyne / profiler.py
Created April 22, 2019 08:29
Profiler as decorator
import cProfile
import pstats
from functools import wraps
def profile(func):
"""
Profiles a given function and dumps stats
:return:
"""
@nandyne
nandyne / bobp-python.md
Created March 27, 2020 08:48 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens