All posts by Bruce

Firefox and related tabs

New version of Firefox (you did upgrade to 3.6 already, right?) now opens new tabs immediately adjacent to the tab you’re in when you right-click a link. To change it back to the “old” way (open a new tab after all the other tabs), go to about:config in the URL bar and toggle browser.tabs.insertRelatedAfterCurrent from “true” to “false”

Fighting tyranny

“Still, if you will not fight for the right when you can easily win without bloodshed; if you will not fight when your victory will be sure and not too costly; you may come to the moment when you will have to fight with all the odds against you and only a precarious chance of survival. There may be a worse case. You may have to fight when there is no hope of victory, because it is better to perish than to live as slaves.” — Winston Churchill

“Miracles do not cluster. Hold on to the Constitution of the United States of America and the Republic for which it stands — what has happened once in six thousand years may never happen again. Hold on to your Constitution, for if the American Constitution shall fail there will be anarchy throughout the world.” — Daniel Webster

Removing Picasa “Favorite Activity”

Some random person on Picasa shared an album with me. I have no idea who they are or why they shared with me. Some random travel pictures of Malaysia or something. But it was irritating to have to see it in “Favorites Activity” every time I went into my own albums.

Google doesn’t provide a direct way from the activity list to remove someone. The process to remove it is to click the shared link and go to the other person’s gallery. Add them as a Favorite using the link on their album.

Then when you go back to your own People/Favorites tab, and click the “List” link in the top right corner, there are checkboxes to stop getting updates from them or to remove them outright.

Keyboard mapping problem in Ubuntu VNC session

New hard drive in my home PC = upgrade to/new install of Ubuntu 9.10 last night.

I set up tightvncserver and all worked fine from home when I tested it last night. Today from my Macbook at work, though, odd keyboard mapping prevented using a VNC session.

A little searching online reveals that tightvncserver is apparently built with an old version of XFree. Removing tightvncserver and using vnc4server instead solved the problem.


“Interest never sleeps nor sickens nor dies; it never goes to the hospital; it works on Sundays and holidays; it never takes a vacation; it never visits nor travels; it takes no pleasure; it is never laid off work nor discharged from employment; it never works on reduced hours; it never has short crops nor droughts; it never pays taxes; it buys no food; it wears no clothes; it is unhoused and without home and so has no repairs, no replacements, no shingling, plumbing, painting, or whitewashing; it has neither wife, children, father, mother, nor kinfolk to watch over and care for; it has no expense of living; it has neither weddings nor births nor deaths; it has no love, no sympathy; it is as hard and soulless as a granite cliff. Once in debt, interest is your companion every minute of the day and night; you cannot shun it or slip away from it; you cannot dismiss it; it yields neither to entreaties, demands, or orders; and whenever you get in its way or cross its course or fail to meet its demands, it crushes you.”  — J. Reuben Clark

The first 100 things to become scarce during an emergency

Found this list online. How is your supply of these?

1. Generators
2. Water filters/purifiers
3. Portable toilets
4. Seasoned firewood
5. Lamp oil, wicks, lamps
6. Coleman fuel
7. Guns, ammunition, pepper spray, knives, clubs, bats, slingshots
8. Hand can openers, hand egg beaters, whisks
9. Honey, syrups, white/brown sugar
10. Rice, beans, wheat
11. Vegetable oil (for cooking)
12. Charcoal, lighter fluid
13. Water containers
14. Mini heater head (propane) (Without this item, propane won't heat a room.)
15. Grain grinder (Non-electric)
16. Propane cylinders
17. Survival guide book
18. Lamp mantles: Aladdin, Coleman, etc. (Without this item, longer-term lighting is difficult.)
19. Baby supplies: Diapers/formula, ointments/aspirin, etc.
20. Washboards, mop bucket w/wringer (for laundry)
21. Cookstoves (propane, Coleman, kerosene)
22. Vitamins
23. Propane cylinder handle holder (Small canister use is dangerous without this item)
24. Feminine hygiene/haircare/skin products
25. Thermal underwear (tops and bottoms)
26. Bow saws, axes and hatchets, wedges (also, honing oil)
27. Aluminum foil -- regular and heavy duty
28. Gasoline containers (plastic and metal)
29. Garbage bags
30. Toilet Paper, Kleenex, Paper Towels
31. Milk (powdered, condensed: shake every 3 to 4 months)
32. Garden seeds (non-hybrid)
33. Clothes pins/line/hangers
34. Coleman's pump repair kit
35. Tuna fish (in oil)
36. Fire extinguishers
37. First aid kits
38. Batteries
39. Garlic, spices, vinegar, baking supplies
40. Big dogs (and plenty of dog food)
41. Flour, yeast, salt
42. Matches
43. Writing paper/pads/pencils, solar calculators
44. Insulated ice chests
45. Workboots, belts, Levis, durable shirts
46. Flashlights, lightsticks, torches, "No. 76 Dietz" lanterns
47. Journals, diaries, scrapbooks
48. Garbage cans (great for storage, water, transporting - if with wheels)
49. Men's hygiene: Shampoo, Toothbrush/paste, Mouthwash/floss, nail clippers, etc
50. Cast iron cookware
51. Fishing supplies/tools
52. Mosquito coils/repellent, sprays/creams
53. Duct tape
54. Tarps/stakes/twine/nails/rope/spikes
55. Candles
56. Laundry Detergent (liquid)
57. Backpacks, duffel bags
58. Garden tools and supplies
59. Scissors, fabrics, sewing supplies
60. Canned Fruits, Veggies, Soups, stews, etc.
61. Bleach (plain, NOT scented: 4 to 6% sodium hypochlorite)
62. Canning supplies, jars/lids/wax
63. Knives, sharpening tools: files, stones, steel
64. Bicycles, tires/tubes/pumps/chains, etc
65. Sleeping bags, blankets/pillows/mats
66. Carbon monoxide alarm (battery powered)
67. Board games, cards, dice
68. D-con rat poison, MOUSE PRUFE II, roach killer
69. Mousetraps, ant traps, cockroach magnets
70. Paper plates/cups/utensils
71. Baby wipes, waterless and antibacterial soaps
72. Rain gear, rubberized boots, etc.
73. Shaving supplies (razors, creams, talc, after shave)
74. Hand pumps, siphons (for water and for fuels)
75. Soy sauce, vinegar, boullion/gravy/soup base
76. Reading glasses
77. Chocolate/Cocoa/Tang/Punch (water enhancers)
78. "Survival-in-a-Can"
79. Woolen clothing, scarves/earmuffs/mittens
80. Boy Scout Handbook, Leaders Catalog
81. Roll-on window insulation kit (MANCO)
82. Graham crackers, saltines, pretzels, trail mix,  jerky
83. Popcorn, peanut butter, nuts
84. Socks, underwear, T-shirts, etc. (extras)
85. Lumber (all types)
86. Wagons and carts (for transport to and from)
87. Cots, inflatable mattresses
88. Gloves: Work/warming/gardening, etc.
89. Lantern hangers
90. Screen patches
91. Tea
92. Coffee
93. Cigarettes
94. Wine/Liquors (for bribes, medicinal, etc,)
95. Paraffin wax
96. Glue, nails, nuts, bolts, screws, etc.
97. Chewing gum/candies
98. Atomizers (for cooling/bathing)
99. Hats, cotton neckerchiefs
100. Goats/chickens

Removing Mailman list members with invalid addresses

If you have a list member with an invalid address (I ended up with one that had 2 concatenated addresses, yielding 2 @ characters which the default parser apparently does not like), the regular bin/remove_members script won’t work. You can use this trick though:

cd /path/to/mailman
bin/withlist -l listname
>>> m.removeMember('')
>>> m.Save()
>>> ^D

See the Mailman wiki for more details and other things to try if even this step doesn’t work.

Deleting sendmail file pairs based on content

This one-liner will identify files containing a string, and then use some bash string manipulation to generate a wildcard for the pair of files sendmail creates for each message (dfn for message content, and Qfn for headers). This assumes you’re running it in the mail queue directory (/var/spool/mqueue for example).

for f in `grep -l -i viagra *`; do t=${f:10:6}; rm -f *${t}; done

The ${f:10:6} extracts the last 6 characters of the filename, then the rm command prepends that with the wildcard.

Some sample output:

[root@mail mqueue]# grep -l -i cialis *

But there are actually six files:

[root@mail mqueue]# ls -l | egrep "020530|015512|031687"
-rw------- 1 root smmsp 2062 Aug 30 01:27 dfn7U8Rc3X020530
-rw------- 1 root smmsp 2232 Aug 30 06:07 dfn7UD7BUh015512
-rw------- 1 root smmsp 2069 Aug 31 07:21 dfn7VELCbV031687
-rw------- 1 root smmsp 825 Aug 30 01:27 Qfn7U8Rc3X020530
-rw------- 1 root smmsp 837 Aug 30 06:07 Qfn7UD7BUh015512
-rw------- 1 root smmsp 810 Aug 31 07:21 Qfn7VELCbV031687

So we run the command, using cialis:

for f in `grep -l -i cialis *`; do t=${f:10:6}; rm -f *${t}; done

Then there are no more files 🙂

[root@mail mqueue]# for f in `grep -l -i cialis *`; do t=${f:10:6}; rm -f *${t}; done
[root@mail mqueue]# grep -l -i cialis *
[root@mail mqueue]#

One-liner to count current IP connections

A quick one-liner to show the IP addresses with an established connection to your server, sorted in order:

netstat -ant | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr

If you care only about a certain TCP port, say 80 for web traffic, the command becomes:

netstat -ant | grep :80 | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr

Output would look like:


Continue reading One-liner to count current IP connections