Skip to content

Instantly share code, notes, and snippets.

View tpowellcio's full-sized avatar

Troy Powell tpowellcio

View GitHub Profile
@tpowellcio
tpowellcio / grafana-dashboard-exporter
Created November 20, 2019 17:43 — forked from crisidev/grafana-dashboard-exporter
Command to export all grafana 2 dashboard to JSON using curl
KEY=XXXXXXXXXXXX
HOST="https://metrics.crisidev.org"
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |tr ']' '\n' |cut -d "," -f 5 |grep slug |cut -d\" -f 4); do
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash > dashboards/$dash.json
done
@tpowellcio
tpowellcio / helpful-docker-commands.sh
Created January 18, 2018 23:52 — forked from garystafford/helpful-docker-commands.sh
My list of helpful docker commands
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# helps with error: 'unexpected end of JSON input'
@tpowellcio
tpowellcio / logstash.conf
Created October 17, 2016 20:17 — forked from ollyg/logstash.conf
logstash config and filter to fully parse a syslog message (PRI, timestamp, host)
filter {
# strip the syslog PRI part and create facility and severity fields.
# the original syslog message is saved in field %{syslog_raw_message}.
# the extracted PRI is available in the %{syslog_pri} field.
#
# You get %{syslog_facility_code} and %{syslog_severity_code} fields.
# You also get %{syslog_facility} and %{syslog_severity} fields if the
# use_labels option is set True (the default) on syslog_pri filter.
grok {
type => "syslog-relay"
@tpowellcio
tpowellcio / ssl_certs.md
Created May 24, 2016 14:30
Creating SSL Certs

#Creating Certificates Reference

  1. From a terminal:
openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr
  1. Enter the requested information:
  2. Common Name: The fully-qualified domain name, or URL, you're securing. If you are requesting a Wildcard certificate, add an asterisk (*) to the left of the common name where you want the wildcard, for example *.coolexample.com.
  3. Organization: The legally-registered name for your business. If you are enrolling as an individual, enter the certificate requestor's name.
@tpowellcio
tpowellcio / software_raid_5.md
Created May 24, 2016 14:29
Setup Software Raid 5

#Software Raid

  • Installed 4 - 4TB drives onto hagrid using the motherboard SATA ports
    • Set drives to software raid 5 and initialising
  • RAID-5 has become extremely popular among Internet and e-commerce companies because it allows administrators to achieve a safe level of fault-tolerance without sacrificing the tremendous amount of disk space necessary in a RAID-1 configuration or suffering the bottleneck inherent in RAID-4. RAID-5 is especially useful in production environments where data is replicated across multiple servers, shifting the internal need for disk redundancy partially away from a single machine. RAID level 5 can replace a failed drive with a new drive without user intervention. This functionality, known as Hot-spares. Also supports Hot-Swap, Hot-swap is the ability to removed a failed drive from a running system so that it can be replaced with a new working drive. This means drive replacement can occur without a reboot. Hot-swap is useful in two situations. First, you might n
@tpowellcio
tpowellcio / prevent_mac_from_writing_supid_files_to_usb.md
Created May 24, 2016 12:51
Prevent Mac from Writing stupid files to USB

#Prevent Mac from Writing stupid files to USB

mdutil -i off /Volumes/yourUSBstick
cd /Volumes/yourUSBstick
rm -rf .{,_.}{fseventsd,Spotlight-V*,Trashes}
mkdir .fseventsd
touch .fseventsd/no_log .metadata_never_index .Trashes
cd -
@tpowellcio
tpowellcio / group_user_mod_cmds.md
Created May 24, 2016 12:49
Cleaning up users on linux machine, inconsistent user ids

#Cleaning up users on linux machine, inconsistent user ids

    $ getent group | grep 1063 (grep information for groupid 1063)
    $ getent passwd | grep 1063 (grep information for uid 1063)
    $ usermod -u <userid> <username> (change the user id for username)
    $ groupmod -n <new name> <old name> (change group name to <new name> from <old name>)
    $ usermod -g <group id> <user name> (change the <group id> of <user name>)
    $ groupmod -g <group id> <group name> (change <group id> of <group name>)
    $ id <user name> (get the information for <user name>)
@tpowellcio
tpowellcio / copyFilesToUSB.md
Created May 24, 2016 12:48
Copy files to USB sticks and unmount

#Copy files to USB sticks and unmount

##Mac copy2usb.sh

#!/bin/bash

DEVICES=/Volumes/U*
for device in $DEVICES
@tpowellcio
tpowellcio / converting_using_openss.md
Created May 24, 2016 12:47
These commands allow you to convert certificates and keys to different formats to make them compatible with specific types of servers or software. For example, you can convert a normal PEM file that would work with Apache to a PFX (PKCS#12) file and use it with Tomcat or IIS. Use our SSL Converter to convert certificates without messing with Ope…

#Converting Using OpenSSL

These commands allow you to convert certificates and keys to different formats to make them compatible with specific types of servers or software. For example, you can convert a normal PEM file that would work with Apache to a PFX (PKCS#12) file and use it with Tomcat or IIS. Use our SSL Converter to convert certificates without messing with OpenSSL.

##Convert a DER file (.crt .cer .der) to PEM openssl x509 -inform der -in certificate.cer -out certificate.pem ##Convert a PEM file to DER openssl x509 -outform der -in certificate.pem -out certificate.der ##Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes

@tpowellcio
tpowellcio / automateUSBscript-on-insert.md
Last active May 24, 2016 14:35
Automatically Clone Files to USB upon insert

#Automate USB Duplication Script on plug in ref:http://ubuntuforums.org/archive/index.php/t-502864.html

This explains how you could run a script made by you (say /usr/local/my_script) when you plug a specific USB device.

  1. First run lsusb to identify your device. Example:
$lsusb
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 040a:0576 Kodak Co.