Skip to content

Instantly share code, notes, and snippets.

View danielpclark's full-sized avatar
✍️
Working from home on open source

Daniel P. Clark danielpclark

✍️
Working from home on open source
View GitHub Profile
@danielpclark
danielpclark / count.rb
Created September 1, 2012 10:26
count the files in the directory
#!/usr/bin/ruby
if !!ARGV[0]
if File.directory?(ARGV[0])
puts Dir[ARGV[0] + '/*'].count
else
puts Dir.glob(ARGV).count
end
else
puts Dir['*'].count
@danielpclark
danielpclark / countsize.rb
Created September 1, 2012 10:31
count the size of all files in the directory
#!/usr/bin/ruby
ttlsize = 0.0
curdir = ""
if !!ARGV[0]
curdir = ARGV[0] + "/*"
else
curdir = "*"
end
Dir[curdir].each do |x|
@danielpclark
danielpclark / vataxcalc.py
Created September 1, 2012 10:37
Figure out Virginia state and Federal tax based on income.
#!/usr/bin/env python
# Federal and Virginia State Tax Calculator
# taxhandler.py
import sys
fedTax2012 = {}
fedTax2012["s"] = ((0,8699,0.1),(8700,35349,0.15),(35350,85649,0.25),(85650,178649,0.28),(178650,388349,0.33),(388350,900000000000,0.35))
@danielpclark
danielpclark / getmac.py
Created September 1, 2012 10:41
Get mac address for current system's wireless router.
#!/usr/bin/python
import commands
def getmac(iface):
words = commands.getoutput("ifconfig " + iface).split()
if "HWaddr" in words:
return words[ words.index("HWaddr") + 1 ]
else:
return 'MAC Address Not Found!'
@danielpclark
danielpclark / alarm.py
Created September 1, 2012 11:05
An old alarm clock script. Windows only.
"""Alarm Clock ver 0.1"""
#This does not get compiled into code but the triple quotes do. Windows Only.
"""
By Daniel P. Clark
11-14-2000
"""
import time, winsound, sys, os, string
def waiter():
print string.center('Welcome! To 6ft Dan(TM) Alarm Clock! Ver. 0.1', 79)
@danielpclark
danielpclark / allmidis.py
Created September 1, 2012 11:08
Play all midi files in the directory.
#!/usr/bin/python
##################################################
# Progran: ALL MIDIS #
# Version: 0.1 #
# Company: 6ft Dan(TM) #
# Author : Daniel P. Clark #
# E-mail : #
# Date : <= 2005 #
# ABOUT : Plays all midi's in current #
# directory #
@danielpclark
danielpclark / allmp3s.py
Created September 1, 2012 11:09
Play all mp3 files in the directory.
#!/usr/bin/env python
##################################################
# Progran: ALL MP3s #
# Version: 0.1 #
# Company: 6ft Dan(TM) #
# Author : Daniel P. Clark #
# Date : <= 2005 #
# E-mail : #
# ABOUT : Plays all mp3s's in current #
# directory #
@danielpclark
danielpclark / allmp3stowav.py
Created September 1, 2012 11:12
Convert all mp3s to wave using mpg123.
#!/usr/bin/python
##################################################
# Progran: ALL MP3s to WAV #
# Version: 0.1 #
# Company: 6ft Dan(TM) #
# Author : Daniel P. Clark #
# Date : <= 2005 #
# E-mail : #
# ABOUT : converts mp3s #
##################################################
@danielpclark
danielpclark / attoff.py
Created September 1, 2012 11:18
Change all attributes to read write and execute for selected files.
#!/usr/bin/env python
# App Name: attoff
# Version: 0.2
#
# Author: Daniel P. Clark
# Date of creation: 06-05-2002
# Last modified: 12-21-2004
#
# E-mail: webmaster@6ftdan.com
@danielpclark
danielpclark / blkmyspc.bat
Created September 1, 2012 13:36
Block myspace from Windows computers via the HOSTS file.
@REM Created 8-03-06 by Daniel P. Clark
@REM Since this is from 2006 it may need additional addresses added
@REM webmaster@6ftdan.com
@echo Removing Read-Only permission from HOSTS
@attrib -R C:\WINDOWS\system32\drivers\etc\HOSTS
@echo Modifying HOSTS file to block myspace.
@echo off
@echo # Begin blocking myspace >> C:\WINDOWS\system32\drivers\etc\HOSTS
@echo 127.0.0.1 216.178.32.200 >> C:\WINDOWS\system32\drivers\etc\HOSTS