Remove Icon in MoinMoin before links

1. remove element in common.css and msie.css.
  • One way is to comment out / delete the respective lines in the css sheets. If you don't want the earth-icon remove
    a.www:before {content: url(../img/moin-www.png); margin: 0 0.2em;}
  • from common.css and the corresponding similar line from msie.css.
You can see the css when you hover over the icon and right-click, choosing "inspect element". You may need to do this for each of the themes (e.g. modernized, modern, etc).

http://moinmo.in/MoinMoinQuestions/Themes#Avoid_Link-Icons_on_linked_images

Date in Bash Script

To get a nice formatted date in a bash script, use:

    $(date +%F)

There is also 
 
    DATE=`date +%Y-%m-%d`

get year-month-day hour:minute:second from date
    
    DATE=`date +%Y-%m-%d:%H:%M:%S`
 
http://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script


Mirror a Website with WGET

wget -mkEpnp http://example.org

wget --recursive --no-parent --level 3 --execute robots=off -nH  example.com

===================================================

wget --mirror --convert-links --adjust-extension --page-requisites 
--no-parent http://example.org
 
Explanation of the various flags:
  • --mirror – Makes (among other things) the download recursive.
  • --convert-links – convert all the links (also to stuff like CSS stylesheets) to relative, so it will be suitable for offline viewing.
  • --adjust-extension – Adds suitable extensions to filenames (html or css) depending on their content-type.
  • --page-requisites – Download things like CSS style-sheets and images required to properly display the page offline.
  • --no-parent – When recursing do not ascend to the parent directory. It useful for restricting the download to only a portion of the site.
Alternatively, the command above may be shortened:

wget -mkEpnp http://example.org

Note: that the last p is part of np (--no-parent) and hence you see p twice in the flags.

source: http://www.guyrutenberg.com/2014/05/02/make-offline-mirror-of-a-site-using-wget/

also note the -w flag:

wget -mk -w 1 http://www.example.com
  • -mk    will do mirroring
  • -w 1   wait 1 second in between downloads 

Nohup and Screen

One can use nohup to run files that won't exit when the shell closes; also check out screen!
 
 $ nohup ./somescript.sh &
 $ screen -A -m -d -S somename ./somescript.sh &
 
also see: http://en.wikipedia.org/wiki/Nohup, Advanced Bash Scripting Guide 

Capture and Read STDOUT and STDERR

$> command 2>&1 | tee -a some_file

Vim Hints/Tips

Line Numbering
  (Enable)
  :set number
  :set nu
  (Disable)
  :set nonumber
  :set nonu
  :set !nu
  source: http://vim.wikia.com/wiki/Display_line_numbers

PerlBestPractices 
  (.vimrc)

Shiftwidth
Autoindent

Solarized (coloring)

FileFormat
 :set ff=unix    [unix|dos|mac]
     dos     <CR> <NL>
     unix    <NL>
     mac     <CR>

Enabling Options
http://vim.wikia.com/wiki/Managing_set_options

Miscellaneous

test file format using vim (:set ff?)

solarized and coloring terminals

svn and SVN_EDITOR

Apple/Macs use .bash_profile, not .bashrc (so add link)

Make Offline Mirror of a Site Using `wget`

Use  wget to make an offline mirror of a website

wget --mirror --convert-links --adjust-extension --page-requisites 
--no-parent http://example.org
Explanation of the various flags:
  • --mirror – Makes (among other things) the download recursive.
  • --convert-links – convert all the links (also to stuff like CSS stylesheets) to relative, so it will be suitable for offline viewing.
  • --adjust-extension – Adds suitable extensions to filenames (html or css) depending on their content-type.
  • --page-requisites – Download things like CSS style-sheets and images required to properly display the page offline.
  • --no-parent – When recursing do not ascend to the parent directory. It useful for restricting the download to only a portion of the site.
Alternatively, the command above may be shortened:
wget -mkEpnp http://example.org
Note: that the last p is part of np (--no-parent) and hence you see p twice in the flags.

Configuring KDE to Have Desktop Icons Appear

On the desktop, select "Activities" (either on the menu bar at the bottom of the screen, or on the upper right corner box). Select "+ Create Activity" -> "Templates" -> "Desktop Icons". This selects the new activity "Desktop Icons"; this makes a new icon to appear "Desktop Icon"; when selected, will have the desktop icons appear and when "Desktop" activity is selected, the default desktop with a panel showing the Desktop folder appear.

Steam on Fedora 20

RPM packages are available from RPMFusion for all supported Fedora releases. The package works fine on both i686 and x86_64 systems and already contains support for the S3 Texture compression library for open source drivers (radeon, intel and nouveau) along with all the required libraries to start playing with Steam games. To install, after enabling the RPMFusion repositories, simply issue
sudo yum install steam
Note: There is also a staging repository where additional options are added to the package, like Valve's xpad driver and packages for running the SteamOS client in SteamOS mode. These features might not end up in RPMFusion. The repository is available at negativo17.org.
Source: Valve

Install .deb on Fedora 20

To install a debian package, you first need to convert it from a .deb package to a .rpm package (you may need to install alien first via sudo yum install alien which installs a bunch of perl modules...)
 >$ alien -r package.deb 

Then do the standard yum install:
 >$ sudo yum localinstall package.rpm

Moka Themes and Icons on Fedora 20

The Moka themes that are installed by default via fedy are obsolete.  The current Moka project repositories can be found at http://mokaproject.com/ .

First, install the repository:
su -c "yum-config-manager --add-repo http://mokaproject.com/packages/rpm/moka-stable.repo"
Then you can install the individual parts.
  • faba-icon-theme
  • faba-mono-icons
  • (these are supplemental icons)
  • moka-icon-theme
  • moka-gnome-shell-theme
  • orchis-gtk-theme
  • (requires the Murrine, but it is likely installed: yum search gtk-murrine-engine)
  • moka-cinnamon-theme
  • (!) Update! I don't need moka-cinnamon-theme because Fedora 20 uses gnome-shell - cinnamon is a fork of gnome-shell. Don't bother with this one!
    (!) Warning! I got "No package moka-cinnamon-theme available" when I tried to install this. And indeed, when I went and browsed the repo - I didn't see it under (http://mokaproject.com/packages/rpm/). But, one can download a package (.zip) and install it that way; see note below.

Instal an individual component like so:
su -c "yum install moka-icon-theme"

Notes:


  • Faba's purpose is to serve as a base icon theme to others (such as Moka). It comprises only of a system icons –folders, mimetypes, toolbar icons, etc. To fully experience Moka, it is recommended that you also install Faba Icon Theme.
  • The method shown here is Fedora 20 distribution specific. There are agnostic methods for installation.
  • UPDATE! Don't bother with moka-cinnamon-theme!
    For reference though, I've kept my notes below.
    Because the "preferred" method of downloading the archive doesn't work, I've downloaded the package (moka-cinnamon-theme.zip) and then installed it manually. One can run it as a user and have the theme installed in ~/.themes or as root (so all users can have access to the theme) and it will be installed in /usr/local/share/themes.
    Then you may select "Moka" in the Cinnamon theme preferences, or use the following command:
    gsettings set org.cinnamon.theme name "Moka"
    (BTW, it didn't work because I'm not using cinnamon, and it isn't installed! )
  • To enable the Moka Gnome Shell Theme, I believe you first need to use "Gnome Tweak Tool" to enable User Themes", and then the Moka Gnome Shell Theme can be selected. See here.

Fedora 20 - uses GNOME-Shell

FYI - Fedora 20 uses GNOME-Shell, not Cinnamon (as I thought earlier)! Cinnamon is a fork of GNOME-Shell and might be used by Mint Linux?

Windows Desktop Icons - Auto Arrange

Problem: the desktop icons don't move (you can't drag and move the icons).
Solution: right click the desktop,  click “View”, uncheck “Auto arrange icons”. 

Python and Command-Line Arguments

Use sys.argv and getopt . Sources: (here) (here too) (also here)

Ensuring new files in a directory belong to the group

Issue: I want to create a shared directory when a number of users (all belong to a group called mygroup) can create and edit files. I would like all files, including new files created in this directory and subdirectories to belong to the mygroup.

Solution: Set the SetGID sticky bit
$> chmod g+s dir

SSH and Port Forwarding

(I) SSH with X. To simply get X over SSH, do
ssh -X name@machine xterm

(II) No X?   If you installed fedora with minimal package set, you may see:
$ ssh -YC remotebox                                    
[major@remotebox ~]$ xterm                              
xterm: Xt error: Can't open display:                    
xterm: DISPLAY is not set          
                                                       
source
(III) Simple Port Forwarding

Here we forward port 1143 on localhost to 143 (IMAP) on imap.example.com.
    ssh -f -N -q -L 1143:localhost:143 username@imap.example.com
  • -f tells ssh to go into the background (daemonize).
  • -N tells ssh that you don't want to run a remote command. That is, you only want to forward ports.
  • -q tells ssh to be quiet
  • -L specifies the port forwarding
Source: Main, Also

How long did that command take to run?

SIMPLE ANSWER
Simply use the command time to see how long it took to execute

$> time cp -R sourcefolder targetfolder          
real 0m21.093s                                  
user 0m0.008s                                    
sys 0m0.717s                                    
 


real - is the full time it took to run the command (how long you waited).
user - is the CPU time used by the program itself.
sys - is the CPU time used by the system calls

Perhaps also see GNU time as an alternative?

Source

POWER ANSWER
Measure time of program execution and store that inside a variable
usr@srv $ mytime="$(time ( ls ) 2>&1 1>/dev/null )"
usr@srv $ echo "$mytime"

real    0m0.006s
user    0m0.001s
sys     0m0.005s
Perhaps even just use date command, and measure differences from start to finish.

START=$(date +%s.%N)
command
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
# echo $DIFF
Source: unix.stackexchange.com

RCS - Simple Version Control

RCS is a great simple version control. No need to create repositories. Just use it in place!  Create the file, then just check it in (creates initial archived version-controlled file: filename,v). Then just check it out again to do editing.

Check in:      $ ci -u inetd.conf
Check out:    $ co -l services

Common RCS operations:
RCS operationCommand line
Initial check-in of file (leaving file active in filesystem)ci -u filename
Check out with lockco -l filename
Check in and unlock (leaving file active in filesystem)ci -u filename
Display version x.y of a fileco -px.y filename
Undo to version x.y (overwrites file active in filesystem with the specified revision)co -rx.y filename
Diff file active in filesystem and last revisionrcsdiff filename
Diff versions x.y and x.zrcsdiff -rx.y -rx.zfilename
View log of check-insrlog filename
Break an RCS lock held by another person on a filercs -u filename

Source: O'Reilly: The Five-Minute RCS Tutorial - Automating System Administration with Perl
also see: http://www.yolinux.com/TUTORIALS/LinuxTutorialRCSintro.html

BTW: think co -l  as being "locked" from use by other programmers (one edit at a time). It may not be necessary to use -u to unlock the file.

Yum Extender Symbols

From the Yum Extender FAQ  [link]
Q. What does the package colors mean ?
Red = Package is a update to a installed package.
Blue = Package is obsoleting a installed package.
Green = Package is installed.
Black = Available package.
Q. What does the "green plus " / "star on rectangle (document)" means ?
The "green plus " / "star on rectangle" means that a packages is recent.
  • If it is in the update/install view it means that this version of the package has been added to the repository in the last 14 days.
  • If it is in the remove view it means that the package as been installed on the system in the last 14 days.

Fedora 20 Post-Install Customization

After the default install, there are some sysadmin things your Fedora 20 install more usable:

  • First, update the system:  
        • $> yum update
  • To get a nicer/more user-friendly experience with Fedora 20, install easyLife rpm, and use it to
    • replace nouveau video drivers with nVidia drivers (current drivers are fine)
      • btw: the lenovo T510 has nVidia GT218 [NVS 300] Video 
      • btw: check which driver you are using
        • $> lspci | grep VGA
      • btw: check which module is loaded:
        • $> lsmod | grep nouveau
    • install flash
    • install codecs
    • install video players
    • install java
    • install fonts
    • install utils
    • install SetupWindows
  • Install gnome-tweak-tool
  • To install KDE: (link)
        • $> yum install @kde-desktop 
  • To install Xfce: (link)
    • Install switchdesk utility:
        •  $> yum install switchdesk switchdesk-gui
    • Install Xfce: 
        • $> yum install @xfce 
    • Now, make Xfce desktop the default:
        •  $> switchdesk xfce

Key Extensions to Firefox

  • LastPass
  • Xmarks
  • Pocket

yum Commands

List commands (including a list of installed packages, or ones ready to be updated)
        yum list
        yum list installed|less
        yum list updates|less

Install a package
        yum install package

Install a group of packages (don't forget quotation marks)
        yum groupinstall "groupname"

Search for a package
        yum search
        yum search package

Remove a package
        yum remove package

Update via yum (including a list that need to be updated)
        yum update

Notable links:

Take a Screenshot in Fedora 20

Press the [PrtSc] button (just don't keep it pressed down too long!) The screenshots show up under
 ~/Pictures
. The default picture viewer in Fedora 20 is "shotwell".

Logout in Fedora 20

Add a logout button in the menu (under the power button), because there apparently isn't a logout button in Fedora 20. (source)
 $> gsettings set org.gnome.shell always-show-log-out true 

Setup Dropbox on Fedora

RECOMMENDED. Simply download the Dropbox rpm (Dropbox RPMs
You can even install and control via Dropbox via commandline (important for server/non-graphical node situations) (see above)

OR. Compile from source (Dropbox RPMs here too

Get Motherboard Information in Windows

To get information on what motherboard you've got in your computer, you can either crack open your case, or you can run a simple built-in command. Simply start a windows command line session (C:\Windows\system32\cmd.exe). (Source link)
C:\Users\Username> wmic baseboard get product,Manufacturer,version,serialnumber 

Chrome Complains that I Need to Enter Sync Passphrase (But I've Forgotten It)

If you no longer have access to your custom passphrase, you’ll need to reset sync:

  1. If your synced data (bookmarks, apps, etc) is available on your local computer, sign in to your Google Dashboard. (There will often be a link on the box)
  2. In the Chrome Sync section, click Stop sync and delete data from Google. This step will remove the data from Google’s servers. The data on your local computer won’t be affected.
  3. Wait a few minutes before signing in to Chrome and re-enabling sync on your computer.

(link to google product forms)

Making Personalized Cross-References Only in Apps

{Personal note} Right now, you can only make links to other scripture verses only with mobile apps, not the desktop site.

Steam Not Seeing the Internet

Sometimes in order to get Steam to work, you need to have a browser session opened first, then Steam will connect to servers to login. Otherwise, it will complain that you are not connected to the internet, especially when you are trying to login. (This could be an effect of Safe Eyes controlling the networking stack, or the Asus router's NAT, or some other stupid glitch).

Compare Directories

To compare directories:
diff --brief -r dir1/ dir2/ 

Notes on Ways to Capture Bash Session

To capture a bash session, try the following methods:

1. Capture session with script:
#> script -f 

2. Capture stdout, stderr with 
$> bash command 2>&1 | tee output.txt 

3. Capture PuTTY Session

Can also capture screen history in putty by right clicking the top of the putty window and selecting "Copy All to Clipboard" (then save using your text editor of choice)

Posting Formatted Code in Blogger

Formatting Tool: Here

Instructions on how to setup syntax highlighter on blogger:

Tool to convert HTML to escaped HTML: here

syntaxhighlighter list of supported language for <class> attribute.
Example syntax highlighting
print "I like python

Write sqlplus output

Use spool to write output to console:  SPOOL and turn off with  SPOOL OFF

Print to a file with:
SPOOL <output file path>
link 1, 2