wpadminbar vs godsyn.com
I play around with wordpress nightlies because I like living on the edge, breaking my own site, and fixing buggy code. Recently, in the latest nightly release wordpress decided I need an administration bar along the top of my pages. This only displays when logged in, but destroyed my theme. I do not know the official name of this bar, but it has an ID of "wpadminbar". After seeking plug-ins and settings to no avail and being let down by google, I turned to grep. The resolution is simple. To remove the bar, open wp-settings.php and comment out the following line:
becomes
Note: If you know of an official way to disable "wpadminbar" or make it more theme friendly, please share.
Bash script to show WAN and LAN network IPs.
Following is a bash script I wrote to show my lan and wan IPs.
The script will loop every 10 seconds. Seeing as my ISP has a less than desirable up time, I use this to see when I'm finally reconnected.
# -/oss+:` `-/o/.
# `-omMmy+. +Md/
# -MMMMMNdhMMMyos+:
# .:odmMMMMMMMMMMMMMMo
# .yNMMMMMMMMNyNMMMMMNsoo-
# odo::NMMMMMM/`s-MMMMMMmMMds/
# -. `NMMMMMMMd+- -ooo/-..-oNM- `++ /+`++ //
# +MMMMMMMMMMMMmhyssss- `- .ddh. mdd/yy
# sMm`oMMMMMMMMMMMMMMNmdy+` -M. m+`sMy
# .M/ `+hNMMMMMMMMMMMMMMMMs` `.` .` ..
# /` `.:+oo..-/yMMMMMMMN-
# -+yo:` +MMMMMMMN`
# :yNMN+so -so` :hyMMMMMM/
# /mMMMMMMMNhdMN` ://+hMMMMMNN:
# `hMMMNdhyydMMMMMMdyssdMMMMMMMN`.
# hMmm- /osMMMNosNMMMMMMMMdNM+
#`Ms`/ ..-smMNs.oNNho+/++:` sM/
# h/ `:++/- -my- +s`
# . .s`
echo "Press ctrl-c to exit at any time."
while [ 1 ]; do
WAN_ip_addr=`wget --timeout=10 --tries=2 -qO - http://cfaj.freeshell.org/ipaddr.cgi`
LAN_ip_addr=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
echo $(date)
echo -ne "External IP: "
if [ -z $WAN_ip_addr ]; then
echo -e "Disconnected"
else
echo -e $WAN_ip_addr
fi
echo -ne "Internal IP: "
if [ -z $LAN_ip_addr ]; then
echo -e "Disconnected"
else
echo -e $LAN_ip_addr
fi
if [ -n "$WAN_ip_addr" ]; then
echo "Found external IP"
exit 0
fi
done
exit 0
Cleanup Ubuntu.
A simple cleanup script by David Francos.
Y="\033[1;33m"; R="\033[0;31m"; E="\033[0m"
function cleanapt(){ apt-get clean; }
function emptytrash(){ rm -rf /home/*/.local/share/Trash/*/** &> /dev/null && rm -rf /root/.local/share/Trash/*/** &> /dev/null && rm -rf /home/*/.Trash* && rm -rf /root/.Trash*; }
function removeconffiles(){ dpkg -P `dpkg -l|grep "^rc"|awk '{print $2}'`; }
function removeoldkernels(){ apt-get remove --purge $(dpkg -l|awk '{print $2}'|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v `uname -r|cut -d. -f1,2`-`uname -r |cut -d\- -f3,4`|grep -v `uname -r|cut -d\- -f1,2`); }
if [ $UID != '0' ]; then
echo -e $R"Error: must be root, cleaning user's trash"$E
rm -rf $HOME/.Trash* $HOME/.local/share/Trash/*/**
exit 1
else
echo -ne $Y"Cleaning apt cache ..."$E && cleanapt 2>/dev/null ; echo -ne $R" Done\n"$E
echo -ne $Y"Removing old config files ..."$E && removeconffiles 2>/dev/null ; echo -ne $R" Done\n"$E
echo -ne $Y"Emptying trashes ..."$E && emptytrash 2>/dev/null ; echo -ne $R" Done\n"$E
echo -ne $Y"Removing old kernels ..."$E && cleanapt 2>/dev/null ; echo -ne $R" Done\n"$E
fi
sysinfo.sh

# ORIGINAL INFO (credit where deserved)
# simple script to give a summary of system information
# Author: http://www.pixelbeat.org/
# Changes:
# V0.1, 16 Nov 2005, Initial release
# V0.s, 22 Oct 2007, Tweak to ensure cdrom info shown.
# Comment out partition info as a bit noisy.
# V0.syn1, 19 Jan 2009, Added free space info and colors.
YELLOW="\033[1;33m"
RED="\033[0;31m"
ENDCOLOR="\033[0m"
function PCINFO(){
if [ $USER != root ]; then
echo -e $RED"Warning:"$YELLOW"Not root. Disk info cannot be shown."$ENDCOLOR
fi
find_sbin_cmd() {
for base in / /usr/ /usr/local; do
if [ -e $base/sbin/$1 ]; then
echo $base/sbin/$1
exit
fi
done
}
FDISK=`which fdisk 2>/dev/null`
LSUSB=`which lsusb 2>/dev/null`
LSPCI=`which lspci 2>/dev/null`
EGREP=`which egrep 2>/dev/null`
DF=`which df 2>/dev/null`
[ -z "$FDISK" ] && FDISK=`find_sbin_cmd fdisk`
[ -z "$LSUSB" ] && LSUSB=`find_sbin_cmd lsusb`
[ -z "$LSPCI" ] && LSPCI=`find_sbin_cmd lspci`
[ -z "$EGREP" ] && EGREP=`find_sbin_cmd egrep`
[ -z "$DF" ] && DF=`find_sbin_cmd df`
echo -e $YELLOW"============= Drives ==========="$ENDCOLOR
(
sed -n 's/.* \([hs]d[a-f]$\)/\1/p' < /proc/partitions
[ -e /dev/cdrom ] && readlink -f /dev/cdrom | cut -d/ -f3
) |
sort | uniq |
while read disk; do
echo -n "/dev/$disk: "
if [ ! -r /dev/$disk ]; then
echo "permission denied" #could parse /proc for all but
else
size=`$FDISK -l /dev/$disk | grep Disk | cut -d' ' -f3-4 | tr -d ,`
rest=`/sbin/hdparm -i /dev/$disk 2>/dev/null | grep Model`
rest=`echo $rest` #strip spaces
echo -n "$rest"
if [ ! -z "$size" ]; then
echo ", Size=$size"
else
echo
fi
fi
done
#if [ `id -u` == "0" ]; then
#echo -e $YELLOW"============= Partitions ========="$ENDCOLOR
#$FDISK -l 2>/dev/null
#fi
echo -e $YELLOW"============= Free Space ======="$ENDCOLOR
$DF -Hl | $EGREP -v "tmpfs|varrun|varlock|udev|tmpfs"
echo -e $YELLOW"============= CPUs ============="$ENDCOLOR
grep "model name" /proc/cpuinfo #show CPU(s) info
echo -e $YELLOW"============= MEM =============="$ENDCOLOR
KiB=`grep MemTotal /proc/meminfo | tr -s ' ' | cut -d' ' -f2`
MiB=`expr $KiB / 1024`
#note various mem not accounted for, so round to appropriate size
#on my 384MiB system over 8MiB was unaccounted for
#on my 1024MiB system over 20MiB was unaccounted for so round to next highest power of 2
round=32
echo "`expr \( \( $MiB / $round \) + 1 \) \* $round` MiB"
echo -e $YELLOW"============= PCI =============="$ENDCOLOR
$LSPCI -tv
echo -e $YELLOW"============= USB =============="$ENDCOLOR
$LSUSB
}
PCINFO | more