Skip to content

Instantly share code, notes, and snippets.

Zan Loy zanloy

View GitHub Profile
@zanloy
zanloy / download-va-certs.yaml
Last active Feb 21, 2020
[Install VA Root Certificates] This ansible playbook will download and install the VA root certificates. #va #work #ansible
View download-va-certs.yaml
---
- hosts: localhost
gather_facts: true
gather_subset: distribution
become: true
vars:
ca_path:
Alpine: /usr/local/share/ca-certificates
Ubuntu: /usr/local/share/ca-certificates
@zanloy
zanloy / movey.rb
Created Jan 3, 2020
[Movey] A simple ruby script to move a movie file to the correct location. #ruby
View movey.rb
#!/usr/bin/ruby
require 'colorize'
require 'fileutils'
require 'highline/import'
require 'optparse'
exts = ['.avi', '.m4v', '.mkv', '.mp4', '.srt', '.sub']
# Loop through each ARGV
@zanloy
zanloy / caps_lock_to_control.reg
Last active Jun 26, 2018
Remap CapsLock to CTRL
View caps_lock_to_control.reg
# This will remap your capslock key to control in Windows.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
@zanloy
zanloy / db.rake
Created Mar 11, 2017 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
View db.rake
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@zanloy
zanloy / body.html.erb
Created Nov 3, 2014
Systems Engineering MONitoring Script (SEMON)
View body.html.erb
<html>
<head>
<style>
ul {
margin: 0px;
list-style-type: none;
}
li {
margin: 0px;
}
@zanloy
zanloy / gensshkey.sh
Created Sep 24, 2014
Regenerate SSH host keys
View gensshkey.sh
#!/bin/bash
#Tested in RedHat but should work in other distros.
#set -x
rm -f /etc/ssh/ssh_host_key
rm -f /etc/ssh/ssh_host_key.pub
rm -f /etc/ssh/ssh_host_rsa_key
rm -f /etc/ssh/ssh_host_rsa_key.pub
rm -f /etc/ssh/ssh_host_dsa_key
@zanloy
zanloy / setup_git.rb
Created Sep 22, 2014
Setup git aliases
View setup_git.rb
#!/usr/bin/env ruby
require 'optparse'
options = { :realm => :local }
OptionParser.new do |opts|
opts.on('-g', '--global', 'Set aliases globally') do
options[:realm] = :global
end
@zanloy
zanloy / disks.rb
Created Sep 10, 2013
To add a simple noatime to each ext3 mount point in Puppet.
View disks.rb
require 'facter'
require 'augeas'
Facter.add('fstab_missing_noatime') do
list = []
Augeas::open do |aug|
aug.match("/files/etc/fstab/*[label()=~regexp('[0-9]+') and vfstype='ext3' and count(opt[.='noatime']) = 0]").each do |match|
list.push(match)
end
end
You can’t perform that action at this time.