javascript dark color scheme for Geany

Şubat 4, 2009 - Bir Yanıt

Geany is a clever and lightweight editor. I’ve been using it recently for small projects. I was using the dark color scheme (http://code.google.com/p/geany-dark-scheme/) for my stuff, but I noticed today that javascript support is missing, when I needed to do some js work.

Here is the javascript dark color scheme file. I’ve basically copied the original file from /usr/share/geany/filetypes.javascript to ~/.geany/filedefs/ beside other dark-scheme files, and copied color definitions from C dark-scheme file.

# For complete documentation of this file, please see Geany's main documentation
[styling]
# foreground;background;bold;italic
default=0xffffff;0x1E1E1E;false;false
commentline=0x747474;0x1E1E1E;false;false
comment=0x747474;0x1E1E1E;false;false
commentdoc=0x747474;0x1E1E1E;false;false

number=0x7ECDFF;0x1E1E1E;false;false

word=0xFFCB4F;0x1E1E1E;true;false

word2=0xAAFF57;0x1E1E1E;true;false

string=0xA18651;0x1E1E1E;true;false
character=0xA18651;0x1E1E1E;true;false

uuid=0xffffff;0x1E1E1E;false;false

preprocessor=0xB2A886;0x1E1E1E;true;false

operator=0x98BAC5;0x1E1E1E;true;false
identifier=0xffffff;0x1E1E1E;false;false

stringeol=0xffffff;0xffffff;true;false

verbatim=0xDBB260;0x1E1E1E;false;false

regex=0xAAFF57;0x1E1E1E;false;false

commentlinedoc=0x747474;0x1E1E1E;false;false
commentdockeyword=0xffffff;0x1E1E1E;false;false
commentdockeyworderror=0x747474;0x1E1E1E;false;false

globalclass=0x7EB35B;0x1E1E1E;false;false

[keywords]
# all items must be in one line
primary=abs abstract acos anchor asin atan atan2 big bold boolean break byte case catch ceil char charAt charCodeAt class concat const continue cos Date debugger default delete do double else enum escape eval exp export extends false final finally fixed float floor fontcolor fontsize for fromCharCode function goto if implements import in indexOf Infinity instanceof int interface isFinite isNaN italics join lastIndexOf length link log long Math max MAX_VALUE min MIN_VALUE NaN native NEGATIVE_INFINITY new null Number package parseFloat parseInt pop POSITIVE_INFINITY pow private protected public push random return reverse round shift short sin slice small sort splice split sqrt static strike string String sub substr substring sup super switch synchronized tan this throw throws toLowerCase toString toUpperCase transient true try typeof undefined unescape unshift valueOf var void volatile while with

[settings]
# default extension used when saving files
extension=js

# the following characters are these which a "word" can contains, see documentation
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

# if only single comment char is supported like # in this file, leave comment_close blank
comment_open=//
comment_close=

# set to false if a comment character/string should start at column 0 of a line, true uses any
# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
#command_example();
# setting to false would generate this
#    command_example();
# This setting works only for single line comments
comment_use_indent=true

# context action command (please see Geany's main documentation for details)
context_action_cmd=

[build_settings]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
compiler=
run=

building a living room pc: remote audio with mpd + gmpc

Şubat 3, 2009 - Leave a Response

I built a headless living room pc a few weeks ago. Chose a Q6600 2.4 quad-core with 4gb ram, an HTPC case, microatx motherboard, and on board video 🙂 My main reasoning was to use it for music, some virtual machines, and playing around, although I couldn’t spend much time it until now..

At first I moved most of my music archive on my laptop to it, and set up NFS for my laptop, configured autofs on my laptop and managed it to try mounting only when I’m on my home LAN, so I can continue to use rhythmbox. Today I found the time to configure an audio server on the quadcore, and have it remotely controlled from my laptop.

The solution’s name is mpd; music player daemon [http://www.musicpd.org]

MPD runs as a daemon on the server, with local access to all music files. You can control it remotely with various clients (also there are PHP clients that can be installed on the same server with MPD and allow HTTP access).

As for clients, first I tried an ncurses client ncmpc, which I found to be useful at first. Then I tried various GNOME clients, one is Ario, the other is Sonata. When I gave up my hope on both of them and just let it go with using one of them; I discovered gmpc on a blog post.

Well, mpd + gmpc is what you need if you want to have a remote music server on your home LAN.

Note that mpd is not a streaming solution, files exist on mpd server, and client just controls the server on what to play next. But don’t think the daemon is dumb; daemon holds playlist and everything you need, you can just open a client, configure what you want to listen, and close it, and you’ll have the music playing.

my little sphinx

Kasım 25, 2008 - Leave a Response

Don’t be fooled by his size, he’s only 6 months old. Mother is a chinchilla, father is a persian cat that looks just like him. Well, he’s cute 🙂

paspas1

paspas2

user mode linux + nested x server + gdm

Kasım 25, 2008 - Leave a Response

I’ve been thrilled with the idea of User Mode Linux, aka UML lately. I’ve been carrying my laptop around lately, home, office, friends’, department’s labs. When I discovered UML, I noticed that I can use it as a user mode virtualization platform, I can just create a USB ubuntu distro, and run it on any machine without being root.

There are two main advantages compared to other virtualization solutions

  1. no need to be superuser and install kernel modules (including tun/tap driver for networking)
  2. and performance gain over other non-root solutions like qemu

A performance overview can be found at Alberto Garcia’s weblog, UML+skas3 and QEMU + KQEMU both requires loading kernel modules, so they’re irrelevant for me. But comparing UML+skas0 and QEMU, I would definitely choose UML.

UML skas0 : 14m 30s

QEMU : 2h 13m 04s

I had already seen a linux usb thumb drive belonging to a friend. He bought it online, apparently, it has QEMU on it, an X display with XFCE, it can run on windows / linux. My plan is not to have just a small usb drive, but move most of my daily usage to the usb stick — having a ubuntu on top of it, with mostly everything except my music archive. So UML is the way to go.

First I started off with stock UML kernel in ubuntu, and tried bootstrapping an ubuntu. After a painful process of a few days, I finally managed to do it (and hey, it is easy when you know what to do). There is a user space SLIP program, slirp, that can provide networking of IP packets. It also has other useful features I’ll visit later.

After getting ubuntu installed, I saw that I cannot get X running. I can access the virtual consoles fine (as xterms). After some struggling (for 2 full days), I finally got an Xnest getting run by gnome-display-manager on the guest. Well, this required,

  • examining openssh codes to see how it does X forwarding (did you know about the .Xauthority file? and that you need to transfer the keys from there to the other end so X server will accept the connection?),
  • learning how to make slirp forward a TCP port from guest to host (but requires opening TCP port on server, which I don’t want to do, neither as a TCP->Unix Socket proxy, or as a X server configuration which will require root access — so it’s not useful for me as it’ll comprimise security of host)
  • learning how to make slirp run a program on host machine by telnetting to one of its special IPs from guest
  • creating an X windows socket forwarder: a bridge between stdin/stdout and local X socket (unix socket)
  • learning how GDM is configured for which X server to use (I mean the X server program, not a hostname / ip thing)
  • learning that GDM awaits a SIGUSR1 from the X server it forks as a “I’m ready to accept connections” message (well, I went crazy until I learned this)
  • learning that I can trap signals in bash scripts and forward them to GDM (I had to write a wrapper shell script for Xnest, see DISPLAY and XAUTHORITY below 🙂 )
  • learning Xnest does not send the signal, so I have to emulate it with a fixed sleep timer 🙂
  • learning the exact meanings of DISPLAY and XAUTHORITY environment variables for x applications (including Xnest server which is a client of another X server)
  • and how to get the Xauthority keys from host using xauth and create them on guest using the same program

After struggling for nearly 2 days, examining sources of openssh and learning most of the internals of GDM and X servers, I finally got it working. Well, almost. It doesn’t work automatically for now, I have to go and copy keys, set up slirp for tcp->stdin forwarding, setting up network by ifconfig, etc. But the good news is, it works, and it’s pretty easy to automate.

When completed I’ll have a hostfs filesystem in guest that contains the xauthority keys for the host (which will be only root-readable), a gdm configuration change that runs a custom shell script as an x server, an installed Xnest (or Xephyr, I heard it’s newer and better). On the host side, I’ll have slirp, a small stdin/stdout <-> unix socket bridge application [I’m thinking of extending the right side to TCP also, so I won’t have to have a local X server, but the X server might be somewhere else (like ssh X forwarding)], and a starting shell script that prepares the hostfs’s host side, and then executes the user mode linux kernel.

There is also a message by Jeff Dike, creator of UML, related to this topic

My solution will solve the authorization keys of the problem, and then the connection forwarding part may be implemented as part of the UML, removing the dependency on slirp and a host-application to forward the data.

Well, a long post, but no scripts attached yet. I’m planning to get these scripts live by this weekend, we’ll see how it goes:)

PS: slirp limits the connection between host and guest at 10 kB/s, but I learned it’s a compile time option that can be disabled. I have to recompile that too:) a long way to go, after all is working, I’ll make a static compile of UML kernel, not to have any runtime dependencies…

uml-xnest-first

günün yemek tarifi – unlu munlu tavuk (fırında kızartma)

Kasım 23, 2008 - Leave a Response

malzemeler:

  • 3-4 kemikli tavuk kalça
  • 1-2 yumurta
  • az biraz süt (tek yumurta ile yapılıyorsa)
  • 2 çorba kaşığı un
  • 1 çorba kaşığı zeytinyağı
  • Kekik, tuz, karabiber, tatlı kırmızı biber

alet edavat:

  • 1 derin kap/tabak
  • 1 yayvan tabak
  • tost makinesinin fırın aparatı, ya da fırının kendisi (tost makinesinde ızgara olarak da olur)

nasıl yapılır:

Yumurta + sütü derin kapta çırpın. Baharat ve tuzu da ekleyin. Unu yayvan kaba yayın. Her bir tavuk kalçasını kıvrılmış içte kalan kısımları dahil önce yumurtaya bandırın iyice (ama iyice), sonra da iyice una bulayın.

Kızdırdığınız fırın tepsisine yağı koyun, üstüne tavukları dizin. Üst tarafın pişmeye yaklaşınca ters çevirin üst kısmı da kızarsın.

Evdeki malzemeyle uydurduğum bir şey, ama gayet lezzetli oluyor. Afiyet olsun 🙂

gerçek hello world! tanesi

Kasım 23, 2008 - Leave a Response

evet uzuncadır düşündüğüm bloguma kavuştum.

aslında yazar mıyım yazmaz mıyım da belli değil de, deneyelim bakalım. ara sıra geliyor olsa da şu an yazsam şunu diye, ama bakıyorum yok, ben de yazmıyorum haliyle.

biraz geyik, biraz teknik, biraz xkcd paylaşmayı umuyorum burada. bazen türkçe bazen ingilizce. bazen de susar dururum büyük ihtimalle. hadi bakalım, merhaba wordpress