Skip to content

Instantly share code, notes, and snippets.

View crispincornett's full-sized avatar

Crispin Cornett crispincornett

  • Boise, Idaho, USA
View GitHub Profile
@crispincornett
crispincornett / mysql_db_partitioning.md
Last active February 7, 2020 19:30
MySQL Add Partitioning Plan

MySQL DB Plan

DB Export/Backup

Dump SQL Structure

  1. Dump the entire structure of the database schema using MySQL Workbench with the "Skip table data" option selected
  2. Edit the dump file to reflect the desired changes (e.g. storage engines, encoding, etc)
  3. Restore edited file using MySQL Workbench which should create a schema using the dump file, without any data
@crispincornett
crispincornett / netcomm_utils.sh
Last active December 3, 2019 19:10
Netcomm Utils
#!/bin/sh
# Carefree Utility Script for Netcomm NTC-225
# Author: Crispin Cornett - Advanced Control Systems, 2019
# Working Directory
CAREFREE_DIR="/usr/local/carefree"
CONFIG_DIR="${CAREFREE_DIR}/config"
LOG_DIR="${CAREFREE_DIR}/log"
STATUS_DIR="${CAREFREE_DIR}/status"
@crispincornett
crispincornett / netcomm_io1_din.sh
Last active December 3, 2019 19:10
Netcomm Digital Input 1
#!/bin/sh
# Carefree IO Monitoring Script for Netcomm NTC-225 Digital Input #1
# For now we need a separate script for each IO point
# Should be placed in '/etc/cdcs/conf/mgr_templates/'
# Author: Crispin Cornett - Advanced Control Systems, 2019
IO_NUM=1
IO_TRIGGER_VAL="?<sys.sensors.io.xaux1.d_in>;"
@crispincornett
crispincornett / netcomm_io2_monitor.sh
Last active November 12, 2019 23:10
Netcomm from Conf File
#!/bin/sh
if [ -f "/usr/local/carefree.conf" ]; then
. "/usr/local/carefree.conf"
fi
CAREFREE_DEVICE_ID=${carefree_device_id:-'NONAME'}
CAREFREE_DIR=${carefree_working_dir:-'/usr/local/carefree'}
LOG_DIR="${CAREFREE_DIR}/log"
ALERT_ENABLED=${carefree_d2_alert:-'NO'}
@crispincornett
crispincornett / pg_exclude_predicate.sql
Last active March 13, 2018 20:52
Postgres Exclude Constraint With Predicate
-- Add extension
CREATE EXTENSION btree_gist;
-- Add foreign tables
CREATE TABLE rooms (
id serial primary key,
description text NOT NULL
);
CREATE TABLE employees (
@crispincornett
crispincornett / exclude.sql
Created March 13, 2018 20:18 — forked from fphilipe/exclude.sql
PostgreSQL EXCLUDE constraint
CREATE EXTENSION btree_gist;
CREATE TABLE room_reservations (
room_id integer,
reserved_at timestamptz,
reserved_until timestamptz,
canceled boolean DEFAULT false,
EXCLUDE USING gist (
room_id WITH =, tstzrange(reserved_at, reserved_until) WITH &&
) WHERE (not canceled)
@crispincornett
crispincornett / iws_bat_btn.vbs
Created September 6, 2017 21:27
IWS Bat Button
Dim cmd
cmd = "CMD /C call """ + $GetAppPath() + "restart_win911.bat"""
$WinExec( cmd, 0, 0)
@crispincornett
crispincornett / restart_win911.bat
Created September 6, 2017 21:25
Batch File to Restart Win911 Services
REM Shutdown Services
net stop "WIN-911 Voice Runtime"
net stop "WIN-911 Reporting Runtime"
net stop "WIN-911 OPC DA Runtime"
net stop "WIN-911 Navigation Runtime"
net stop "WIN-911 Dispatcher Runtime"
net stop "W3SVC"
REM Ping hack to get delay
ping -n 9 127.0.0.1 >nul
@crispincornett
crispincornett / buttons.vbs
Created September 6, 2017 18:36
IWS Buttons
' Stop command
Dim cmd
cmd = "CMD /C call """ + $GetAppPath() + "restart_w3.vbs"" stop"
$WinExec( cmd, 0, 0)
' Start command
Dim cmd
cmd = "CMD /C call """ + $GetAppPath() + "restart_w3.vbs"" start"
$WinExec( cmd, 0, 0)
@crispincornett
crispincornett / restart_w3.vbs
Created September 6, 2017 18:28
IWS Script
Dim svc
Dim action
Set args = Wscript.Arguments
svc = "W3SVC"
action = args.Item(0)
'Wscript.Echo "svc: " + svc
'Wscript.Echo "action: " + action