Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

pomatory petrewoo

🎯
Focusing
  • shanghai
View GitHub Profile
View gist:79a6448bf82230333786459c6e06b57b

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

@petrewoo
petrewoo / logging_subprocess.py
Created Oct 10, 2016 — forked from bgreenlee/logging_subprocess.py
Variant of subprocess.call that accepts a logger instead of stdout/stderr #python
View logging_subprocess.py
import subprocess
import select
from logging import DEBUG, ERROR
def call(popenargs, logger, stdout_log_level=DEBUG, stderr_log_level=ERROR, **kwargs):
"""
Variant of subprocess.call that accepts a logger instead of stdout/stderr,
and logs stdout messages via logger.debug and stderr messages via
logger.error.
@petrewoo
petrewoo / yaml_ordered_dict.py
Created Jul 4, 2016 — forked from enaeseth/yaml_ordered_dict.py
Load YAML mappings as ordered dictionaries
View yaml_ordered_dict.py
import yaml
import yaml.constructor
try:
# included in standard lib from Python 2.7
from collections import OrderedDict
except ImportError:
# try importing the backported drop-in replacement
# it's available on PyPI
from ordereddict import OrderedDict
You can’t perform that action at this time.