Guy Rutenberg

Keeping track of what I do

Using Monospaced Font in the TidddlyWiki Editor

without comments

By default, TiddlyWiki uses its default fonts (Arial or Helvetica) for it’s tiddlers editor. While these fonts are more than fine as default font for the text in tiddlers, I found it much less convinient when editing tiddler’s. Furthermore, it’s even a bad choice when one has code snippets in his tiddlers.

The following code snippet solves the problem by resetting the font used in the editor to monospaced font. Just add the following snippet:

/*{{{*/
.editor {
    font-family: DejaVu Sans Mono, Courier New, monospace;
}
/*}}}*/

To your StyleSheet tiddler (or create it if it doesn’t exist yet). Now the next time you’ll edit a tiddler you will do it using a monospaced font.

Written by Guy

June 11th, 2011 at 10:58 am

Posted in Tips

Tagged with

Temporary Disabling Bash History

with 5 comments

Say that you’ve got to pass some password as command line argument to something. It would probably be a bad idea to store it in your ~/.bash_history, but clearing the file isn't desired either. So you need to temporary disable the command history for the current session. You can do it by unsetting the HISTFILE environment variable.

unset HISTFILE

The result is that while the session is active you can access the history as usual, but it won't be saved to the disk. History for other sessions, will behave as usual.

Written by Guy

May 10th, 2011 at 12:21 pm

Posted in Bash,Tips

Tagged with

search_for_updates 0.2

without comments

This is a small update to my search_for_updates script which have been laying around. The script allows to search for updates from portage without resolving dependencies. Thus, it’s much faster than

emerge -pvu world

The new version lists the best version available for each package which can be updated using the --verbose flag. You can download the new version from here: search_for_updates-0.2.

Written by Guy

May 10th, 2011 at 12:02 pm

Posted in Linux

Tagged with

CSS Compactor – Reduces CSS File Size

with 2 comments

This is a script I wrote back 2006 that reduces the file size for CSS files by removing unnecessary whitespace and comments. It’s also capable of taking such compacted CSS file, and re-indent it to make it readable. For example it would take the following CSS:

/* sample css */
* {
    margin: 0px;
    padding: 0px;
}
 
/* define style for the logo */
#header .logo {
    float: left;
    /* another comment */
}

and turn it into:

*{ margin:0px; padding:0px;}#header .logo{ float:left;}

which is an equivalent but much shorter CSS code. It can also reindent it back to:

*{
	 margin: 0px;
	 padding: 0px;
}
#header .logo{
	 float: left;
}

Read the rest of this entry »

Written by Guy

January 16th, 2011 at 9:57 pm

Posted in Projects

Tagged with

iproute2 Cheatsheet

with one comment

The iproute2 package offers the ip utility, which is a modern replacments for tools such as ifconfig, route, arp and more. It allows to configure addresses, links route and arp tables. The only problem is that its documentation can be quite confusing. This post is intended to be a task-oriented guide to this utility, it’s far from complete and I intend to update it from time to time.
Read the rest of this entry »

Written by Guy

December 29th, 2010 at 12:25 am

Posted in Linux,Tips

Tagged with

Security Vulnerabilities in the Imagin Photo Gallery

without comments

Following a friend’s request I’ve did a short security review of the Imagin photo gallery couple of weeks ago. I’ve looked at the newest version, v3 beta5, but the vulnerabilities may also apply to older versions. So here they are, from least to most important in my opinion.
Read the rest of this entry »

Written by Guy

December 13th, 2010 at 9:28 pm

Posted in Uncategorized

Tagged with

WordPress Administration over SSL on Lighttpd

without comments

In this tutorial we’ll walk through the steps of enabling SSL (https) for the WordPress’ admin panel when using Lighttpd as a webserver. The tutorial consists of two stages, the first is enabling SSL at the Lighttpd level and the second is in the WordPress level.


Read the rest of this entry »

Written by Guy

December 3rd, 2010 at 11:46 am

Posted in Tutorials,Wordpress

Tagged with ,

Building CookieJar out of Firefox’s cookies.sqlite

with 2 comments

Firefox 3 started to store it’s cookies in a SQLite database instead of the old plain-text cookie.txt. While Python’s cookielib module could read the old cookie.txt file, it doesn’t handle the new format. The following python snippet takes a CookieJar object and the path to Firefox cookies.sqlite (or a copy of it) and fills the CookieJar with the cookies from cookies.sqlite.

import sqlite3
import cookielib
 
def get_cookies(cj, ff_cookies):
    con = sqlite3.connect(ff_cookies)
    cur = con.cursor()
    cur.execute("SELECT host, path, isSecure, expiry, name, value FROM moz_cookies")
    for item in cur.fetchall():
        c = cookielib.Cookie(0, item[4], item[5],
            None, False,
            item[0], item[0].startswith('.'), item[0].startswith('.'),
            item[1], False,
            item[2],
            item[3], item[3]=="",
            None, None, {})
        print c
        cj.set_cookie(c)

It works well for me, except that apperantly Firefox doesn’t save session cookies to the disk at all.

Written by Guy

November 27th, 2010 at 5:19 pm

Posted in Projects

Tagged with ,

Kernel Configuration and nvidia-drivers

without comments

This is more of a note to myself, as I keep forgetting this. The propriety NVIDIA drivers, provided by the x11-drivers/nvidia-drivers dislikes alternatives. It will refuse to build against a kernel with the rivafb (CONFIG_FB_RIVA) and nvidiafb (CONFIG_FB_NVIDIA) built in or built as modules. Both can be found (and unset) under:

Device Drivers
-> Graphics support
   -> nVidia Framebuffer Support
   -> nVidia Riva support

Written by Guy

November 19th, 2010 at 4:41 pm

Posted in Linux,Tips

Tagged with ,

sudo for X Programs

with 2 comments

By default (at least on my machine), it wasn’t possible to open X applications using sudo. For example sudoing xclock resulted in the following error:

$ sudo xclock
No protocol specified
Error: Can't open display: :0.0

The same error appeared even when I executed xclock after running sudo su.
Read the rest of this entry »

Written by Guy

November 12th, 2010 at 11:15 am

Posted in Linux,Tips

Tagged with ,