Skip to content

Instantly share code, notes, and snippets.

Zan Loy zanloy

Block or report user

Report or block zanloy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 / 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"
puts cmd
zanloy / body.html.erb
Created Nov 3, 2014
Systems Engineering MONitoring Script (SEMON)
View body.html.erb
ul {
margin: 0px;
list-style-type: none;
li {
margin: 0px;
zanloy /
Created Nov 3, 2014
Script to replace uvdownload in older (read: non-supported) McAfee Virus Scanner for Linux.
# Configuration Items
basedir = "/data/avdefs/uvscan/"
ftpsrv = "" # dns:
ftpdir = "/pub/datfiles/english"
randwait = (1, 60) # Random wait range between connection attempts
waittime = 5 # Time to wait before failure (in minutes)
zanloy / lxc-nat.rb
Last active Mar 12, 2016
LXC script to setup NAT rules based on a config file
View lxc-nat.rb
#!/usr/bin/env ruby
## lxc-nat.rb
# Simple ruby script to create port-forwarding rules based on a static table.
## Configuration
# Create /etc/lxc/lxc-nat.yml with rules such as the following:
# **Note:** interface (will assume eth0), source ip, and destination port (will
zanloy /
Created Sep 24, 2014
Regenerate SSH host keys
#Tested in RedHat but should work in other distros.
#set -x
rm -f /etc/ssh/ssh_host_key
rm -f /etc/ssh/
rm -f /etc/ssh/ssh_host_rsa_key
rm -f /etc/ssh/
rm -f /etc/ssh/ssh_host_dsa_key
zanloy / setup_git.rb
Created Sep 22, 2014
Setup git aliases
View setup_git.rb
#!/usr/bin/env ruby
require 'optparse'
options = { :realm => :local } do |opts|
opts.on('-g', '--global', 'Set aliases globally') do
options[:realm] = :global
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|
zanloy /
Created Mar 26, 2012
Script to update McAfee uvscan on *nix cli
import ftplib
import os
import os.path
import sys
import tarfile
import tempfile
# User variables
You can’t perform that action at this time.