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
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 / uvdownload.py
Created Nov 3, 2014
Script to replace uvdownload in older (read: non-supported) McAfee Virus Scanner for Linux.
View uvdownload.py
#!/usr/bin/python
# Configuration Items
basedir = "/data/avdefs/uvscan/"
ftpsrv = "12.120.74.237" # dns: ftp.nai.com
ftpdir = "/pub/datfiles/english"
randwait = (1, 60) # Random wait range between connection attempts
waittime = 5 # Time to wait before failure (in minutes)
### DO NOT EDIT BELOW THIS LINE ###
@zanloy
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
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
@zanloy
zanloy / uvupdate.py
Created Mar 26, 2012
Script to update McAfee uvscan on *nix cli
View uvupdate.py
#!/usr/bin/python
import ftplib
import os
import os.path
import sys
import tarfile
import tempfile
# User variables
You can’t perform that action at this time.