RSS
***
Most visited: Ride Across America | Hodgkin's Disease | Trainster | Pam's Ride Across America Fundraiser
Nov 7
2013
FROM MAELSTROM: Running a Python script with root permissions

Previously, I wrote a script that automatically escalated to root permissions if needed.

This works fine for shell scripts, but recently I needed a way to do this for Python scripts. The trouble is that the shebang #! syntax only allows limited command-line argument passing.

This following recipe is not pretty, but it seems to work!

#!/usr/bin/env bash

if (( UID != 0 )); then
    echo re-running as root
    exec sudo -E "$0" "$@"
fi

python2 -u <(cat <<"EOF"
print "hello, world!"
EOF
) "$@"

permalink | comments | technorati
Aug 9
2013

Oishinbo: Vol. 2, Sake **** : Another great installment of the Oishinbo series. This one focuses on wine and sake as they interact with Japanese cuisine.


tags: book-reviews japan food manga
permalink | comments | technorati
Jul 9
2013

Oishinbo: Vol.1 Japanese Cuisine **** : I love this Japanese foodie series.


tags: book-reviews japan food manga
permalink | comments | technorati
Jul 9
2013

Hyperion ***** : All four books in this serious are "big" science fiction: society, government, military, time and space travel, religion; it covers it all! (I read these last year but forgot to review them until now.)


tags: book-reviews science-fiction
permalink | comments | technorati
Jul 5
2013

Room **** : Touching and creatively-written story of a mother and son's love for each other in a horrible situation.


tags: book-reviews fiction
permalink | comments | technorati
Apr 23
2013

Oishinbo: Fish, Sushi, & Sashimi ***** : Delightful story of Japanese food culture.


tags: book-reviews manga
permalink | comments | technorati
Nov 6
2012

Player of Games ***** : Culture series, book 2. Even better than the first! About a master player in a game that determines who becomes emperor.


tags: book-reviews science-fiction
permalink | comments | technorati
Aug 18
2012

Consider Phlebas **** : Great space opera with thorough backstory a la David Brin's Uplift series.


tags: book-reviews science-fiction
permalink | comments | technorati
Nov 5
2011

Last month, Microsoft discontinued support for Windows Sidebar Gadgets. They didn't give developers any warning nor did they give users a chance to save copies of their favorite gadgets. It's a pretty short-sighted move in my opinion.

Here is a collection of alternative places to get gadgets. I wish Microsoft had kept a read-only copy of the gadget store online. But they didn't. So this is all we have left:


permalink | comments | technorati
Nov 5
2011
FROM MAELSTROM: Self-elevating a script to root permissions

I don't know why it took me so long to figure this out, but here is a nice little recipe for elevating a script to root permissions from inside the script.

#!/usr/bin/env bash

if (( UID != 0 )); then
    echo Re-running as root
    exec sudo -E "$0" ${1+"$@"}
fi

echo Script is running as root
echo Here are my arguments:
for i in "$@"; do echo arg=[$i]; done
id

If you don't want to export the user's environment variables, replace "sudo -E" with "sudo".


permalink | comments | technorati
Aug 27
2011

Tunnel in the Sky **** : Classic Heinlein space-cowboy, coming-of-age, young-adult fiction.


tags: fiction science-fiction bookshelf-project
permalink | comments | technorati
Aug 17
2011

Manga Guide to Calculus **** : Even if you already know Calculus, this is still very enjoyable. The entire series looks appealing!


tags: book-reviews manga calculus
permalink | comments | technorati
Aug 14
2011

Under the Dome ***** : Stephen King at his best, describing small-town America with a full cast of interesting characters.


tags: book-reviews fiction
permalink | comments | technorati

Read more journal entries.

Sign up to receive e-mail updates from RssFwd whenever new content is available on this site.