Skip to content

Instantly share code, notes, and snippets.

View bandaangosta's full-sized avatar
🌎

José L. Ortiz bandaangosta

🌎
View GitHub Profile
@pszaflarski
pszaflarski / _remap_dict.py
Created July 9, 2018 17:49
remap a python dictionary with new keys
def _remap_dict(d, fromto_mapping, method='delete'):
"""
Remap dictionary keys from a certain set of keys to a new set of keys
:param d: the dictionary that needs to be remapped
:param fromto_mapping: a dictionary mapping of keys in the original dictionary to the output dictionary
:param method: what do do with keys that aren't found in the mapping
'delete' means that they will be removed from the output dictionary
'remain' means that they will have their original names in the output dictionary
:return: the output dictionary with keys remapped, will return None if method is not recognized
"""
@hwgao
hwgao / my_logger.py
Created May 21, 2014 08:20
Terminator plugin -- log the output of the terminator into a file with the current time as the default file name and with the time stamp on each line
#!/usr/bin/python
# Plugin by Sinan Nalkaya <sardok@gmail.com>
# See LICENSE of Terminator package.
""" logger.py - Terminator Plugin to log 'content' of individual
terminals """
import os
import sys