Skip to content

Instantly share code, notes, and snippets.

@rwev
rwev / resurgence.py
Last active August 2, 2018 02:23
Python script for restarting a process on file changes.
"""
RESURGENCE.PY
Python script for restarting a process on file changes.
Author: rwev (https://github.com/rwev)
See usage:
>python resurgence.py --help
@rwev
rwev / BAW.py
Last active March 1, 2024 02:33
Python implementation of the Barone-Adesi And Whaley model for the valuation of American options and their greeks.
"""
BAW.PY
Implements the Barone-Adesi And Whaley model for the valuation of American options and their greeks.
"""
import numpy as _np
import cmath as _cm
# Option Styles
@rwev
rwev / csvc.py
Last active May 23, 2019 16:35
Combines all .csv files in the current directory into a single file if they are of the same format (i.e. columns / fields match). Preserves chronology of data as provided by filenames.
'''
CSVC.PY: Comma-Separated Value Combine
Combines all .csv files in the current directory into a single file if of same format. Preserves chronology of data as provided by filenames.
Author: rwev (https://github.com/rwev)
Built-in dependencies only.
USAGE:
@rwev
rwev / vanillize.py
Created August 15, 2018 01:08
Applies a naming standard to set of files specified by arguments.
'''
VANILLIZE.PY
Applies a naming standard to set of files specified by arguments.
Author: rwev (https://github.com/rwev)
Built-in dependencies only.
Optional command-line arguments:
@rwev
rwev / csvp.py
Last active May 24, 2019 16:07
Python script for previewing large CSV datasets without loading into memory.
'''
CSVP.PY: Comma-Separated Value Preview
Python script for previewing large CSV datasets without loading into memory.
Author: rwev (https://github.com/rwev)
Built-in dependencies only.
Provides a preview of CSV data, including header fields and a list of unique values for each, from the first N lines of the target file.
@rwev
rwev / pacc.py
Created August 15, 2018 22:53
Python script for generating (password) strings of specified length and character composition.
"""
PACC.PY: Passwords, Accidentally
Python script for generating (password) strings of specified length and character composition.
Author: rwev (https://github.com/rwev)
Built-in dependencies only.
See usage:
@rwev
rwev / MBD.py
Created August 28, 2018 04:41
Implements MemBerDict, a nested dictionary-like Python object offering member attributes for faster access and improved code aesthetic.
"""
MBD.PY: MemBerDict
Implements MemBerDict, a nested dictionary-like object offering member attributes for faster access and improved code aesthetic.
Standard Python dictionaries can be converted to an MBD instance with convertDictToMBD,
enabling streamlined connection to many Python serialization libraries, whose load functions return a Python dictionary.
Similarly, an MBD instance can be converted to a Python dictionary to be fed to a serialization save.
"""
@rwev
rwev / econev.py
Created December 16, 2018 04:29
Python web-scraper for economic events on the Bloomberg Econoday calendar.
# -*- coding: utf-8 -*-
"""
ECONEV.PY: Economic Events
Python web-scraper for economic events on the Bloomberg Econoday calendar.
Saves result of scrape to plain text (in Eastern Time) for flexible processing by other applications.
Author: rwev (https://github.com/rwev)
@rwev
rwev / leaflet-openweathermap.d.ts
Last active April 15, 2019 02:58
TypeScript definitions for leaflet-openweathermap
// Type definitions for leaflet-openweathermap
// By rwev <https://github.com/rwev>
import * as L from 'leaflet';
declare module 'leaflet' {
namespace OWM {
interface Clouds extends L.TileLayer {}
import sys
from RGBtoXTerm256 import rgb2short
nord_colormap = {
# Polar Night black -> grey
"___nord00":"2E3440",
"___nord01":"3B4252",
"___nord02":"434C5E",
"___nord03":"4C566A",
# Snow Storm: grey -> white