Skip to content

Instantly share code, notes, and snippets.

View getopts.sh
#!/bin/bash
usage() {
echo "Usage: $0 -d [directories] -H [host]"
}
if [[ $# -eq 0 ]]; then
usage
exit
fi
View argparse_template.py
import argparse
def parse_arguments():
""" Process command line arguments -> arg dict() """
parser = argparse.ArgumentParser(description='Argument Parser Template')
parser.add_argument('-b', '--basic', help='basic arg consuming option')
parser.add_argument('-v', '--verbose', help='increase output verbosity, flag',
action='store_true')
parser.add_argument('-g', '--greedy', help='greedy narg=* arg',
nargs='*')
@alexcreek
alexcreek / Dockerfile
Created Mar 23, 2019
school dockerfile
View Dockerfile
FROM centos:7.6.1810
RUN yum -y groupinstall "Development Tools"
RUN yum -y install bash-completion
View two-templates.log
2019/03/02 07:20:32.106007 [INFO] consul-template v0.20.0 (b709612c)
2019/03/02 07:20:32.106025 [INFO] (runner) creating new runner (dry: false, once: false)
2019/03/02 07:20:32.106314 [DEBUG] (runner) final config: {"Consul":{"Address":"127.0.0.1:8500","Auth":{"Enabled":false,"Username":"","Password":""},"Retry":{"Attempts":12,"Backoff":250000000,"MaxBackoff":60000000000,"Enabled":true},"SSL":{"CaCert":"","CaPath":"","Cert":"","Enabled":false,"Key":"","ServerName":"","Verify":true},"Token":"","Transport":{"DialKeepAlive":30000000000,"DialTimeout":30000000000,"DisableKeepAlives":false,"IdleConnTimeout":90000000000,"MaxIdleConns":100,"MaxIdleConnsPerHost":3,"TLSHandshakeTimeout":10000000000}},"Dedup":{"Enabled":false,"MaxStale":2000000000,"Prefix":"consul-template/dedup/","TTL":15000000000},"Exec":{"Command":"","Enabled":false,"Env":{"Blacklist":[],"Custom":[],"Pristine":false,"Whitelist":[]},"KillSignal":2,"KillTimeout":30000000000,"ReloadSignal":null,"Splay":0,"Timeout":0},"KillSignal":2,"LogLevel":"trace","
View one-template.log
2019/03/02 07:18:24.407819 [INFO] consul-template v0.20.0 (b709612c)
2019/03/02 07:18:24.407837 [INFO] (runner) creating new runner (dry: false, once: false)
2019/03/02 07:18:24.408163 [DEBUG] (runner) final config: {"Consul":{"Address":"127.0.0.1:8500","Auth":{"Enabled":false,"Username":"","Password":""},"Retry":{"Attempts":12,"Backoff":250000000,"MaxBackoff":60000000000,"Enabled":true},"SSL":{"CaCert":"","CaPath":"","Cert":"","Enabled":false,"Key":"","ServerName":"","Verify":true},"Token":"","Transport":{"DialKeepAlive":30000000000,"DialTimeout":30000000000,"DisableKeepAlives":false,"IdleConnTimeout":90000000000,"MaxIdleConns":100,"MaxIdleConnsPerHost":3,"TLSHandshakeTimeout":10000000000}},"Dedup":{"Enabled":false,"MaxStale":2000000000,"Prefix":"consul-template/dedup/","TTL":15000000000},"Exec":{"Command":"","Enabled":false,"Env":{"Blacklist":[],"Custom":[],"Pristine":false,"Whitelist":[]},"KillSignal":2,"KillTimeout":30000000000,"ReloadSignal":null,"Splay":0,"Timeout":0},"KillSignal":2,"LogLevel":"trace","
View planner-db-query.java
/** Example start and end times the user will enter into the gui.
* These would then be sent from the gui into your planner code
*/
String starts = "Nov 09, 2018 0700";
String ends = "Nov 09, 2018 2200";
Database db = new Database("scheduler.db");
db.connect();
/** Note the calls to dateToEpoch() to convert the dates from the date strings the gui is using into epoch format.
* These are then concatentated into strings and used in the query
View gist:6c4e0879e7dbec88232bbbf27685a080
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
KillMode=none
ExecStartPre=/usr/sbin/nginx -t
ExecStartPre=-/usr/bin/pkill -SIGQUIT nginx
@alexcreek
alexcreek / 4gb-innodb-template
Last active Aug 29, 2015
mysql 4gb template
View 4gb-innodb-template
[mysqld]
# General
bind-address = 127.0.0.1
socket = /var/lib/mysql/mysql.sock
# Logging #
log_warnings = 0
slow_query_log = 0
slow_query_log_file = /var/log/mysql/mysql-slow.log
long_query_time = 1
@alexcreek
alexcreek / kibana-reverse-proxy.conf
Last active Aug 29, 2015
nginx reverse proxy config for kibana, includes authentication, ssl and support for elasticsearch plugins
View kibana-reverse-proxy.conf
server {
listen *:80 ;
#listen *:443;
server_name localhost;
access_log /var/log/nginx/kibana.access.log;
#ssl on;
#ssl_certificate /etc/nginx/ssl/logstash.pem;
#ssl_certificate_key /etc/nginx/ssl/logstash.pem;
@alexcreek
alexcreek / zpanel-ssl.conf
Last active Feb 2, 2016
apache config for enabling SSL on the zpanel login
View zpanel-ssl.conf
# Configuration for ZPanel control panel.
# /etc/zpanel/configs/apache/zpanel-ssl.conf
# to use this config append the include directive below to /etc/zpanel/configs/apache/httpd.conf
# Include /etc/zpanel/configs/apache/zpanel-ssl.conf
<VirtualHost *:443>
ServerAdmin zadmin@localhost
DocumentRoot "/etc/zpanel/panel/"
ServerName www.foo.bar
You can’t perform that action at this time.