Skip to main content

Posts

Showing posts from 2012

Straight to Voicemail, If Unknown - A simple free method for blocking scam calls and robocalls

Problem: How do I block scam calls and robo calls? Premise:  If the call is important, the caller will leave a voicemail. Solution: We put every number we know into our caller ID systems. If a number we do not recognize, or a number that blocks caller ID calls, we always let the call go to voicemail. Callers that really want or need to talk with us will leave a voicemail. If we are not interested, we delete the message. This process initially upset some of our parents, but we have not had to deal with a robo or scam call in some time, since the calling computers almost never leave a voicemail. Our parents are now used it and leave messages. Sometimes, we pick up as soon as they start talking. Our friends mostly communicate via Facebook, internet chat tools, and email these days, so they are used to asynchronous communication and don't mind leaving a message. The political parties and charities we support do leave messages. We call them back to donate or express our s

A script to split a file tree into separate trees - one per file extension present in the original tree

Purpose Have you ever had a tree of files from which you only needed certain types of file? For example, I had an iTunes library with some Apple files from another iTunes account combined with a large number of MP3s. I wanted to pull out the tree of MP3s only. You can make such a tree by passing a combination of flags to rsync that make it do an exclusive include. How? Pass the following flags to rsync to make it do an exclusive include for files fitting a certain globbing pattern. Fill in for the variables of course, if you want to use this line alone. In particular, this rsync line: rsync -av --include '*/' --include "*.${extension}" --exclude '*' ${source_directory}/ ${top_directory_of_results}/${extension}/ The script: ========================================================== This tool reads a directory of files that have extensions and then copies each type of file to its own tree. The location of each file in the subtree matches that file

How do I clean up old large files on Linux?

Many people who have run Linux file servers and ftp servers have at some point wanted to free up some space. One good algorithm to do this efficiently is to remove old data starting with the largest files first. So how to generate such a list? One method is to use a " find -exec du " command: find /path/to/full/file/system -type f -mtime +10 -exec du -sk {} \; | sort -n > /var/tmp/list_of_files_older_than_10_days_sorted_by_size Once you have that list, you can selectively delete files from the bottom of it. Note that the list will likely be exponentially sorted. That is, the bottom 10% of the list will take up a huge chunk of the used storage space.

How the find the Active Directory Domain Controllers listed in DNS on Linux...

Assumptions: You have the "host" utility from BIND. You can do a zone transfer from the local DNS server Your Active Directory admins have properly configured DNS for Active Directory If you have the above, use the following command: host -t srv -l your.active.directory.dns.domain | grep _kerberos._tcp.*._sites.dc._msdcs.your.active.directory.dns.domain Replace your.active.directory.dns.domain with your actual AD DNS domain.

On Linux, how do I set the PATH for non-interactive, non-login shells? e.g. for the case of rksh?

Non-interactive, non-login, shells inherit the PATH from the ssh process, so we must set the PATH with ssh. Some shells, like Korn Shell (ksh, rksh, pksh), only parse user environment files in login shells, so there's no way to change the inherited environment in non-interactive, non-login shells. To set the path globally, build a custom ssh with the needed default path. To set the path for a particular user, first configure ssh to use custom environments by enabling "PermitUserEnvironment" in /etc/ssh/sshd_config: PermitUserEnvironment yes Restart sshd Then set the path in that user's authorized_keys file or using ~/.ssh/environment. Note that you need to set all of the important shell variables. The existence of ~/.ssh/environment seems to preclude the setting of default environmental variable values. So, for example, given a location for binaries for rksh (restricted korn shell), /usr/restricted/bin, place the following in ~/.ssh/environment: HOME=/home/u

Opinion: Should I use Linux, Mac, or Windows?

"A craftswoman never blames her tools." For most, whether or not you can get your work done well on a certain platform is all that matters. To me, the three major operating platforms are tools that all have strengths and weaknesses. In the same way that I wouldn't use my nice chisels to loosen a laptop screw, I wouldn't use a MacBook for writing code for our Linux infrastructure. I am more efficient doing that work on Linux itself. At the same time, I shoot photos and video, and do some writing to take a break from IT. I've tried doing that work using the included tools on all three platforms. I find the Mac platform the most efficient and trouble-free for that work. I can do the work on Linux as well, but Linux has frustrating workflow gaps - especially regarding video. At work, even though we have a heterogenous server environment, we communicate using Microsoft Office, SharePoint, and Lync. My opinion of those tools does not matter. We chose th

"cmore": Colorized text paging using vim...

Sometimes, I want colorized syntax and nice navigation for paging. We can use vim to provide this service. This assumes your terminal client supports the terminal type "xterm-color". If you need another color terminal type, customize accordingly. Install all of the standard vim packages Add  alias cmore="TERM=xterm-color vim -R -" to your ~/.profile Add the following [1] to your ~/.vimrc syntax on hi Comment ctermfg=Blue guifg=Blue hi String ctermfg=LightRed guifg=LightRed Reload your profile: source ~/.profile Usage: cat some.script.sh | cmore    It's vim in read-only mode, so use :q to quit. [1] I found the default colors to be too dark.