May 29th, 2013
To format json data in emacs, its best to use the python module ‘json.tool’. Simply make a function to wrap up the whole buffer and format it.
(defun json-format ()
(interactive)
(save-excursion
(shell-command-on-region (point-min) (point-max) "python -m json.tool" (buffer-name) t)
)
) |
Tags: Emacs, format, json
Posted in Uncategorized | No Comments »
May 27th, 2013
I use Xfce all the time at home and I rdesktop into loads of different computers. Over time I have created many desktop entries for rdesktop connections to many different computers.
E.g.
[Desktop Entry]
Version=1.0
Type=Application
Encoding=UTF-8
Exec=rdesktop -d <domain>; -z -u <username> -g 1670x1025 <hostname> -k de
Icon=chardevice
StartupNotify=false
Categories=Network
Name=RDesktop(hostname)
Comment=RDesktop(hostname) |
Each entry I created needed to be created in the ~/.local/share/applications directory. These are then automatically loaded and added to the Network sub menu. (The list of main categories is listed here)
I started to get problems after adding 12+ desktop entries to the Network menu. With the standard Network entries and my custom rdesktop entries it was getting very tall and messy.
I then started to look into if I could move the rdesktop commands into its own submenu separating them out.
I found that I could make general changes to the menu layout via the menu file. On my distribution its located ~/.config/menus/xfce-applications.menu
Simply create a new submenu
<Menu>
<Name>RDesktop</Name>
<Directory>rdesktop.directory</Directory>
<Include>
<Category>RDesktop</Category>
</Include>
</Menu> |
and include this in the main Layout section
<Layout>
<Filename>exo-terminal-emulator.desktop</Filename>
<Filename>exo-file-manager.desktop</Filename>
<Filename>exo-mail-reader.desktop</Filename>
<Filename>exo-web-browser.desktop</Filename>
<Separator/>
<Menuname>RDesktop</Menuname>
<Separator/>
<Menuname>Settings</Menuname>
<Separator/>
<Merge type="all"/>
<Separator/>
<Filename>xfhelp4.desktop</Filename>
<Filename>xfce4-run.desktop</Filename>
<Filename>xfce4-about.desktop</Filename>
<Filename>xfce4-session-logout.desktop</Filename>
</Layout> |
The rdesktop.directory entry in the submenu points to a file in the .local/share/desktop-directories/rdesktop.directory desktop file. This mainly defines the menu icon and a few other things. It looks like this
[Desktop Entry]
Version=1.0
Type=Application
Encoding=UTF-8
Exec=rdesktop
Icon=chardevice
StartupNotify=false
Categories=X-XFCE;RDesktop
Name=RDesktop
Comment=RDesktop |
I then updated the individual desktop files to use the new group.
I.e Categories=Network;RDesktop
[Desktop Entry]
Version=1.0
Type=Application
Encoding=UTF-8
Exec=rdesktop -d <domain>; -z -u <username> -g 1670x1025 <hostname> -k de
Icon=chardevice
StartupNotify=false
Categories=<b>RDesktop</b>
Name=RDesktop(hostname)
Comment=RDesktop(hostname) |
Dont forget to read http://wiki.xfce.org/howto/customize-menu too.
Posted in Linux | No Comments »
February 16th, 2012
I decided to get Nox from gog.com
cd ~
mkdir .wine-nox
WINEPREFIX=~/.wine-nox/ wine ~/setup_nox.exe
WINEPREFIX=~/.wine-nox/ winecfg |
and configure the wine desktop as exactly 1024×768
Start nox
WINEPREFIX=~/.wine-nox/ wine ~/.wine-nox/drive_c/Program\ Files/GOG.com/NOX/NOX.EXE |
After the intro go in to the settings and change the game screen size to 1024×768.
Now everything is running

Nox Menu

Nox Screenshot
I created a bash script to start nox next time
#!/bin/bash
WINEPREFIX=~/.wine-nox/ wine ~/.wine-nox/drive_c/Program\ Files/GOG.com/NOX/NOX.EXE |
I created the desktop file ~/.local/share/applications/nox.desktop as this
[Desktop Entry]
Version=1.0
Type=Application
Encoding=UTF-8
Exec=/home/username/sbin/nox
Icon=/home/username/.wine-nox/drive_c/Program Files/GOG.com/NOX/NOX.ICO
StartupNotify=false
Categories=Game
Name=Nox
Comment=Nox |
Additional info:
- kernel 3.2.2-1.fc16.i686.PAE
- wine 1.3.37
Tags: fedora, nox, wine
Posted in Linux | 1 Comment »
January 8th, 2012
To install bootchart under fedora simply run
yum install bootchart
Once installed you simply need to enable a grub entry to call it. You just need to add the init=/sbin/bootchartd string to the end of the kernel settings.
I actually copied the existing kernel entry and added it (incase I mistyped something)
title Fedora (3.1.6-1.fc16.i686.PAE) with bootchart
root (hd2,0)
kernel /vmlinuz-3.1.6-1.fc16.i686.PAE ro root=/dev/md126 rd_NO_LUKS rd_NO_LVM rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 \
KEYTABLE=de-latin1-nodeadkeys rhgb \
quiet nouveau.modeset=0 rdblacklist=nouveau \
init=/sbin/bootchartd
initrd /initramfs-3.1.6-1.fc16.i686.PAE.img
Now when I reboot and select this grub entry a bootchart file is written to /var/log/bootchart.tgz
Then run the bootchart command to generate an image of the results.

Tags: bootchart, fedora, Linux
Posted in Linux | No Comments »
January 5th, 2012
Well I started to have some strange crashes from some programs and this morning my PC just turned itself off.
I really expected it to be a memory problem so I needed to enable memtest86+ on my new fedora installation.
I quickly found http://fooninja.net/2011/05/05/loading-memtest-from-grub-fedora/
This is still valid.
Simply append
title Memtest86+ (4.10)
root (hd0,4)
kernel --type=netbsd /elf-memtest86+-4.10
to the end of the /boot/grub/grub.conf and reboot
Voilà errors
now I just need to figure out which memory to take out
Tags: grub, Linux, memtest
Posted in Linux | No Comments »