Skip to content

Instantly share code, notes, and snippets.

@wh13371
wh13371 / args.py
Created February 9, 2017 18:31
python - args from file(s) or STDIN
#! /usr/bin/python
import fileinput, argparse
from glob import glob
"""
# read from <file(s)> or <STDIN>
# Examples:
args.py *.txt
args.py 1.txt 2.txt 3.txt
@wh13371
wh13371 / utc.py
Created March 15, 2017 12:02
python - epoch tool
#! /usr/bin/env python
import os, argparse, time, datetime, pytz, json
import logging, logging.handlers
from pprint import pprint
"""
usage examples:
>utc.py # current epoch to timestamp for each timezone
>utc.py 1234567890 # epoch to timestamp for each timezone
>utc.py -t "2009-02-13 23:31:30" # timestamp string to epoch for each timezone
>utc.py -r # run forever
@wh13371
wh13371 / oraexp.py
Created July 21, 2017 12:12
python - oracle export
#! /usr/bin/python
import sys, time, os, datetime, json
import logging, logging.handlers
import subprocess
log = logging.getLogger(__name__)
UID = "moo"
PWD = "moo"
@wh13371
wh13371 / get_python_3.7.4.sh
Last active September 9, 2019 10:33
install Python 3.7.4 on CentOS 7
#!/bin/bash
###############################################################################
# basics
###############################################################################
yum -y install wget
###############################################################################
# python 3.7.4
@wh13371
wh13371 / get_docker.sh
Created September 9, 2019 10:33
install Docker on CentOS 7
#!/bin/bash
###############################################################################
# docker
###############################################################################
curl -kfsSL https://get.docker.com/ | sh
systemctl start docker
@wh13371
wh13371 / get_mongodb.sh
Created September 9, 2019 10:35
install MongoDB 4.2 on CentOS 7
#!/bin/bash
###############################################################################
# mongodb
###############################################################################
cat > /etc/yum.repos.d/mongodb-org-4.2.repo << ENDOFFILE
[mongodb-org-4.2]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/
@wh13371
wh13371 / get_ntp.sh
Created September 9, 2019 10:37
install NTP on CentOS 7
#!/bin/bash
sudo yum install ntp
sudo firewall-cmd --permanent --add-service=ntp
sudo firewall-cmd --reload
sudo systemctl start ntpd
@wh13371
wh13371 / centos_install_mail.md
Last active September 18, 2019 16:38
CentOS - Install Mail

install mailx

yum -y update
yum install -y mailx
docker run -d --name=dev-consul --net=host consul
docker run -d \
-p 3000:3000 \
--name=grafana \
-v grafana-storage:/var/lib/grafana \
-e "GF_SMTP_ENABLED=true" \
-e "GF_SMTP_HOST=CHANGEME!:25" \
-e "GF_SMTP_FROM_ADDRESS=CHANGEME!" \
grafana/grafana