Skip to content

Instantly share code, notes, and snippets.

@ju1ius
ju1ius / gist:1106957
Created July 26, 2011 15:03
Allow current user to shutdown and reboot without password
#! /bin/bash
PATTERN="$ a\
$(whoami) ALL=\(ALL\) NOPASSWD: /sbin/shutdown, /sbin/reboot
"
# Edit /etc/sudoers to allow current user to shutdown and reboot without password
# Your previous sudoers file will be backed as /etc/sudoers.bak
sed -i.bak -e "$PATTERN" /etc/sudoers
@ju1ius
ju1ius / gist:1106811
Created July 26, 2011 13:51
Allow all physical users to shutdown and reboot without password
#! /bin/bash
USERS=($(cat /etc/passwd | grep /home/ | grep -v /bin/false | cut -d : -f 1))
ALIAS=$(printf ",%s" "${USERS[@]}")
PATTERN="$ a\
${ALIAS:1} ALL=\(ALL\) NOPASSWD: /sbin/shutdown, /sbin/reboot
"
# Edit /etc/sudoers to allow all physical users to shutdown and reboot without password
# Your previous sudoers file will be backed as /etc/sudoers.bak
sudo sed -i.bak -e "$PATTERN" /etc/sudoers
@ju1ius
ju1ius / shutdown-sudoers.sh
Created July 13, 2011 20:24
Allow all users to shutdown and reboot without password
#! /bin/bash
# Edit /etc/sudoers to allow all users to shutdown and reboot without password
# Your previous sudoers file will be backed as /etc/sudoers.bak
sudo sed -i.bak -e '$ a\
ALL ALL=\(ALL\) NOPASSWD: /sbin/shutdown, sbin/reboot
' /etc/sudoers
var abbr = 'ul>li*3>h2+p*2';
try
{
// expands abbreviation and inject results into 'my-element'
$('my-element').expandAbbreviation(abbr);
// returns an Elements object
var elements = ZenCoding.abbrToElements(abbr);
// expands abbreviation to an html string
var my_string = String.expandAbbreviation(abbr);
}