Category: tools

Your Post Advocates…

Ever since the early days of the ancient web/usenet, there have been arguments and disagreements. Someone is wrong. Laziness being the mother of invention, someone created a funny checklist that starts “Your post advocates a ___ approach to … Your idea will not work.” Some of the items are generic/funny enough to apply to any subject, others are specific to the original subject (if memory serves, it was regarding EMail and spam). Will it prevent Godwin’s 1st Law? Probably not!


Your post advocates a

(x) technical ( ) legislative ( ) market-based ( ) vigilante

approach to fighting copyright violations. Your idea will not work. Here is why it won't work. (One or more of the following may apply to your particular idea, and it may have other flaws which used to vary from state to state before a bad federal law was passed.)

(x) Virus and Malware authors can easily use it to infect more machines
( ) Independent content creators and other legitimate uses would be affected
(x) No one will be able to find the guy or collect the money
(x) It is defenseless against malware
(x) It will stop copyright violation for two weeks and then we'll be stuck with it
(x) Users will not put up with it
(x) Microsoft will not put up with it
( ) The police will not put up with it
(x) Requires too much cooperation from copyright holders
(x) Requires immediate total cooperation from everybody at once
(x) Many users cannot afford to lose access to the web or alienate potential employers
(x) Copyright violators don't care about the one or two machines in their botnets
(x) Anyone could anonymously destroy anyone else's career or business

Specifically, your plan fails to account for

(x) Laws expressly prohibiting it
(x) Lack of centrally controlling authority for PCs
(x) Open relays in foreign countries
( ) Asshats
(x) Jurisdictional problems
( ) Unpopularity of weird new taxes
( ) Public reluctance to accept weird new forms of money
( ) Huge existing software investment in SMTP
( ) Susceptibility of protocols other than SMTP to attack
( ) Willingness of users to install OS patches received by email
(x) Armies of worm riddled broadband-connected Windows boxes
(x) Eternal arms race involved in all filtering approaches
(x) Widespread examples of copyright violation
( ) Joe jobs and/or identity theft
(x) Technically illiterate politicians
( ) Extreme stupidity on the part of people who pay for 0-day camshots of movies
(x) Dishonesty on the part of violators themselves
( ) Bandwidth costs that are unaffected by client filtering
(x) Darknets

and the following philosophical objections may also apply:

(x) Ideas similar to yours are easy to come up with, yet none have ever
been shown practical
( ) Any scheme based on opt-out is unacceptable
( ) TCP headers should not be the subject of legislation
(x) Blacklists suck
( ) Whitelists suck
( ) We should be able to talk about Media without being censored
( ) Countermeasures should not involve wire fraud or credit card fraud
(x) Countermeasures should not involve sabotage of public networks
( ) Countermeasures must work if phased in gradually
( ) Sending random files should be free
( ) Why should we have to trust you and your servers?
( ) Incompatibility with open source or open source licenses
(x) Feel-good measures do nothing to solve the problem
(x) I don't want the government installing software on my computer
( ) Killing them that way is not slow and painful enough

Furthermore, this is what I think about you:

(x) Sorry dude, but I don't think it would work.
(x) This is a stupid idea, and you're a stupid person for suggesting it.
( ) You're more extreme than Big Brother

Other Old Stuff

Obligatory XKCD:

one: Are you coming to bed? two: I can't. This is important. one: What? two: Someone is *wrong* on the internet.
Fighting the never-ending fight

Bulk process RAW image files

Recently I had to convert about 250 RAW image files to PNGs. For neatness, I wanted to convert the upper-case filenames the camera assigned with a lower-case name.

A little bash script-fu is all it took:

clean_pics.sh

#!/bin/bash
# Extract from SD Card
for i in /Volumes/SDCARD/DCIM/100ND40X/DSC_0*; do
 filename=$(basename "$i")
 lower_file="$(echo $filename | tr '[A-Z]' '[a-z]')"
 # verify it doesn't already exist
 newfile="${lower_file%.*}.png"
 echo -e "Processingnt$i tont$newfile"
 if [[ -e $newfile ]]; then
  echo "****SKIPPING"
 else
  convert "$i" "$newfile"
 fi
done

echo -e "Detoxing..."
find . -iname "*.png" -exec detox "{}" ;

echo "Procedure complete."

(“SDCARD”, etc is the path to the source files)

Once the script was up and running, it took about 1/2 hour to process all the files. Meanwhile, I was off doing something else!

Path technique: preventing duplicate directories

Forest PathWhat happens with the Path

The path is set via a myriad of config files. It is very easy to accidentally add the same directory to the path, and there is no built-in mechanism from preventing this situation.

While it has no impact on performance, it does make reading the path more difficult (for example, when trying to see if a particular directory is in the path).

Easy Fix

When you find your path cluttered up with duplicate directories, it is relatively easy to correct this. Simply use pathmunge to add directories instead of the typical

export PATH=/fizz/buzz:$PATH

Procedure

First, edit your /etc/bashrc (or equivalent) and add the following function:

pathmunge () {
  if ! [[ $PATH =~ (^|:)$1($|:) ]] ; then
    if [ "$2" = "after" ] ; then
      PATH=$PATH:$1
    else
      PATH=$1:$PATH
    fi
  fi
}

Now you can call this function in your ~/.bashrc, ~/.bash_profile, or wherever you need to add a directory to the path. There are two ways to do this.

Insert at the beginning of the path

Using

pathmunge /path/to/dir

is the functional equivalent of

export PATH=/path/to/dir:$PATH

Append to the end of the path

pathmunge /path/to/dir after

is the functional equivalent of

export PATH=$PATH:/path/to/dir

In either case, the directory won’t be added if it already is in the path, preventing duplicates.

Technique credit: Sam Halicke and Christopher Cashell at Serverfault.

Enhanced by Zemanta

How to prevent duplicate directories in your path

Forest PathWhat happens with the Path

The path is set via a myriad of config files. It is very easy to accidentally add the same directory to the path, and there is no built-in mechanism from preventing this situation.

While it has no impact on performance, it does make reading the path more difficult (for example, when trying to see if a particular directory is in the path).

Easy Fix

When you find your path cluttered up with duplicate directories, it is relatively easy to correct this. Simply use pathmunge to add directories instead of the typical

export PATH=/fizz/buzz:$PATH

Procedure

First, edit your /etc/bashrc (or equivalent) and add the following function:

pathmunge () {
  if ! [[ $PATH =~ (^|:)$1($|:) ]] ; then
    if [ "$2" = "after" ] ; then
      PATH=$PATH:$1
    else
      PATH=$1:$PATH
    fi
  fi
}

Now you can call this function in your ~/.bashrc, ~/.bash_profile, or wherever you need to add a directory to the path. There are two ways to do this.

Insert at the beginning of the path

Using

pathmunge /path/to/dir

is the functional equivalent of

export PATH=/path/to/dir:$PATH

Append to the end of the path

pathmunge /path/to/dir after

is the functional equivalent of

export PATH=$PATH:/path/to/dir

In either case, the directory won’t be added if it already is in the path, preventing duplicates.

Technique credit: Sam Halicke and Christopher Cashell at Serverfault.

Enhanced by Zemanta

Installing Internet Explorer on Mac

Edit (2014-07-11): Fixed URLs

When you need to develop/design a solution for the majority of corporate users, you will need to test it on Internet Explorer. If you have a Mac, setting this up on your machine is easy.

The original source for this information was OSXDaily. I cleaned it up and added additional information.

Intended Audience

TerminalIf you’re unfamiliar with using the terminal, these instructions will not help you. The point is to allow you to install Internet Explorer on Mac for the purposes of testing and developing web applications and sites. Ideally, you are one of the following:

  • Web Developer
  • Web Designer
  • QA Tester

If you plan on running Internet Explorer for other purposes (such as working with an IE-only site), then this is probably not the best solution for your needs.

Required software

  1. Oracle VirtualBox
  2. curl (from Mac Ports or other)

Procedure

Be aware, this process can take HOURS to do, may crash in the middle and cause you to start over, take up inordinate amounts of disk space, etc.

Install IE7 Only

curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | env IEVMS_VERSIONS="7" bash

Install IE8 Only

curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | env IEVMS_VERSIONS="8" bash

Install IE9 Only

curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | env IEVMS_VERSIONS="9" bash

Install IE7, 8 and 9

curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | bash

Notes

Once you have the virtual machines installed, fire them up, set up the Windows instance (install drivers, etc.), then take a snapshot. This is the one you will always use.

When you get a ‘you must activate’ notice, open a Windows cmd line and run

slmgr –rearm

You can rearm two times before it won’t work anymore. At that point, roll back to your snapshot and you can rearm again when you get the message. Obviously, when you roll back to your snapshot all changes will be discarded (that’s the point), so make sure you save any data on your host’s drive.

FAQ

Q. Where is the command line on my Mac?
A. It is not recommended that you use these instructions; instead try another solution such as Apple Boot Camp.

Q. How do I install/uninstall Oracle Virtual Box?
A. You can try looking for information on the Oracle Virtual Box website or contact the Genius Bar at your local Apple Store for assistance.

Q. Where are the windows snapshots stored?
A. In ~/.ievms/

Q. The download stalls or crashes.
A. If it stalls, check your internet connection; you may have to restart the install. In the event of a crash, examine the error message to determine the cause of the problem.

Q. Can you just install it for me?
A. Sorry, no.


  • Won Word

    To rearm XP, use: rundll32.exe syssetup,SetupOobeBnk