Using Caps Key As Second Tab

23 Dec 2009 13:49

As we all know, Caps Lock key is useless and annoying, so some folks change it to behave as third Control key. I prefer using two Controls I already have, so I mapped the Caps Lock key to Tab (which I use very often).

$ xmodmap -
remove Lock = Caps_Lock
keycode 0x42 = Tab
<hit Ctrl-D now>

This works till you logout. If it does work, you can make this persistent by adding those two lines to your empty or missing ~/.Xmodmap file:

remove Lock = Caps_Lock
keycode 0x42 = Tab

If this doesn't work for you, it's possible your window manager doesn't take care of this file, but if you have a way to execute commands at each start of GNOME/KDE/whatever, just add the following command to those run it startup sequence:

xmodmap ~/.Xmodmap

Comments: 2

Nowa Strona -- Nowy Temat

10 Dec 2009 19:09

Stworzyłem dziś nowy temat do Wikidota będący modyfikacją Łukaszowego Orange-Black:

240.jpg

Oto wynik:

240.jpg

Poza tym co widać, zmiany dotyczą użytego fonta, wyglądu komentarzy i forum, uproszczenia okienka nowego komentarza, ustalenia pozycji tła (żeby przewijanie przewijało samą treść, a nie tło) i dodanie lekkiego prześwitywania tła, żeby było bardziej sexy.

Temat jest hostowany pod adresem: http://themes.wikidot.com/orange-black-improved.

A wszystko po to, żeby nadać naszej nowej stronce: http://parapetowa.wikidot.com/ ładnego wyglądu. A na stronce oprócz informacji co można nam kupić z okazji zbliżającej się parapetówy (jeszcze dokładnie nie wiadomo kiedy) uruchomiliśmy też bloga, gdzie pisać będziemy (a przynajmniej ja) o trudzie przystosowania mieszkania do wymagających lokatorów (czyli nas). Link do bloga:

http://parapetowa.wikidot.com/blog

Serdecznie zapraszamy!

Comments: 0

Sobotni Poranek

21 Nov 2009 12:20

Co łączy hazard i cenzurę Internetu?

Przede wszystkim, z rana czytając o ostatnio modnej ustawie anty-hazardowej, zauważyłem, że nie tylko hazard (a i to nie wiem po jaką cholerę) próbuje ona ukrócić. Komentarze pod wpisem na blogu vagla.pl zdają się sugerować, że propozycja ustawy jest niezgodna z Konstytucją, regulacjami Unii Europejskiej i Kartą Praw Człowieka, a wszystko przez to, że nakazuje dostawcom internetu blokować ustalane odgórnie strony internetowe. Centralnym miejscem będzie specjalny Rejestr, do którego będą dopisywane strony o wymienionym w propozycji ustawy charakterze. Dopisywanie ma się odbywać na żądanie kilku organów państwa, a egzekucja tego żądania ma się odbywać natychmiastowo. Dostawcy internetu będą musieli blokować strony z tego rejestru swoim klientom.

Zapraszam do przeczytania komentarzy (zarówno prawników, "techników" jak i nietechnicznych, ale zdrowo myślących ludzi) pod następującym adresem:

http://prawo.vagla.pl/node/8752

Komentarze przedstawiają wątpliwości natury technicznej (techniki blokowania będą albo nieskuteczne albo bardzo drogie) jak i prawnej. Znajdziemy również sugestię, że ten rejestr stanie się pierwszym źródłem informacji wśród szukających w Internecie pornografii dziecięcej.

Pomijając jednak te "drobne" aspekty, sprawę należy postawić zupełnie inaczej. Czy uprawnione jest w ogóle myślenie o tym, żeby blokować dostęp do części internetu ludziom przybywającym na terenie Polski? Czy zamiast dodawać mechanizmy mające niby uchronić Polaków przed naciągaczami i pedofilami, nie powinniśmy poprawić tych mechanizmów, które już istnieją? Moim zdaniem zamiast żądać dodania strony do Rejestru, odpowiedni urząd powinien złożyć doniesienie o popełnieniu przestępstwa i zostawić prokuraturze i sądom szybkie załatwienie tej sprawy (włącznie z żądaniem zdjęcia jej z sieci). Prokuratura i sądy działają za wolno? No właśnie to jest problem, który należy rozwiązać zamiast zajmować się jakimiś głupimi pomysłami blokowania Internetu!

Inny komentator podaje również jako problem wymuszenie stosowania takiego rejestru. O ile rejestry SPAM-u, malware'u i innych nieporządnych stron internetowych (wliczając w to zawierające "nielegalną" pornografię, np. dziecięcą) istnieją, ich używanie jest zupełnie dobrowolne. Jeśli dbam o swoje bezpieczeństwo w sieci, mogę takiego filtra użyć, będąc świadomym, że może mi to ograniczyć dostęp do niektórych serwisów (do których mogę się dostać "omijając" filtr na własne życzenie). Propozycja ustawy jest bezlitosna, dostawcy internetu mają blokować pod rygorem kary pieniężnej.

Chwila rozrywki

Korzystając z chwilowego braku cenzury w Internecie chciałbym podzielić się filmikiem zaczerpniętym ze strony failblog.org, która prezentuje wypadek rowerzysty.

UWAGA: TREŚĆ DRASTYCZNA (chociaż wydaje mi się, że uczestnik wypadku nie odniósł dużych obrażeń)

I jeszcze jedno, a co!

I jeszcze powiększanie biustu po chińsku (trzeba przyznać, że bardzo pomysłowe, od razu przypomniał mi się Abracada Bra Mossa z IT Crowd):

Comments: 0

Home Directory Snapshots

25 Oct 2009 16:12

Your home directory is where the most important data is stored.

But from time to time you just simply rm -Rf ~ and your all precious data is totally out of luck. Backups you say, don't you?

So let's think how do you do backups. cp /home/quake /my/distant/location ? On my 24 GB home directory? It would take hours. cp /home/quake /home/backups/quake/date ? Better, this will take a few minutes, but wait, I have like 120 GB of disk space, which means I can have no more than 5 backups.

What to do with this? There are two posibilities. Either you minimize data to backup to only backup important data (but figuring out what data is important may take some time and be inappropriate) or move to smarter solution, like incremental backups. Or snapshots.

Having brtfs as the filesystem for my home directory, I chose to make a snapshot of it each hour. It takes between 0 and 1 second to complete and uses almost no disk space. Why? Btrfs is copy-on-write filesystems, which means cloning a filesystems is instant as it only makes it available under two locations. And then modifying one of the two makes a real copy of the modified fragment of it and changes that copy.

OK. How to do it.

First create a btrfs filesystem (you'll need a recent kernel and btrfs-utils):

# mkfs.btrfs /dev/sda7

(sda7 is partition for my /home directory)

Then mount it somewhere else than /home, let's use /vol as an example:

# mount /dev/sda7 /vol

Create some volumes on that filesystem: home, quake, snapshots:

# btrfsctl -S home /vol
# btrfsctl -S quake /vol
# btrfsctl -S snapshots /vol

The volumes are accessible as the subdirectories of /vol:

# ls -la /vol
drwx------  1 root  root     36 1970-01-01 01:00 .
drwxr-xr-x 24 root  root   4096 2009-10-25 15:04 ..
drwx------  1 root  root     20 2009-10-25 15:51 home
drwx------  1 root  root  11488 2009-10-25 16:17 quake
drwx------  1 root  root     76 2009-10-25 15:40 snapshots

But you can mount then separately:

# mount /dev/sda7 /home -o subvolume=home
# mkdir /home/quake
# mount /dev/sda7 /home/quake -o subvolume=quake

Fix permissions:

# chown quake:quake /home/quake /vol/quake /vol/snapshots
# chmod 0755 /home/ /home/quake

Now you're ready to do snapshots. Now populate the /home/quake directory:

$ mkdir /home/quake/abcd
$ mkdir /home/quake/dddd
$ mkdir /home/quake/abcd/eeee
$ echo testtest > /home/quake/testfile

Aaaaaand, make snapshots!

$ btrfs -s /vol/snapshots/quake-`date +%Y%m%d-%H%M` /vol/quake

I figured out, that it's quite important to point to /vol/quake and not /home/quake. At first it seams that it's totally the same, but on /home/quake there can be some other filesystems mounted (like .gvfs for GNOME virtual file systems) and /vol/quake contains "pure data". When doing snapshots of /home/quake with filesystems mounted under it, the filesystems freezes for me (btrfs is still experimental, they say). So as noted above, it's better to snapshot pure data directory.

Now, the /vol/snapshots/quake-20091025-1653 (or whatever your date is) and /vol/quake should list the same files and the operation of "cloning" should be just instant no matter how much data you have. But now modifying the contents of /vol/quake should not change anything in /vol/snapshots/quake-20091025-1653 (but of course should in /home/quake).

Also the snapshot doesn't really take any disk space as long as you keep the /vol/quake directory unchanged. Once you change some file from /vol/quake, it needs to really keep two copies of it, so this is when additional space is allocated.

To sum up let's have a table listing possibilities to have the same contents in two directories:

method file copy symbolic link hard link bind-mount btrfs' clone
how cp -a dir1 dir2 ln -s dir1 dir2 ln dir1 dir2 mount -o bind dir1 dir2 btrfs-bcp dir1 dir2
time long instant instant instant instant
takes disk space yes no no no no (only the difference)
points to the same data
(changing file in dir1 changes it in dir2)
no yes yes yes no
notes not on Linux (Mac only?) btrfs-bcp not distributed in Ubuntu's btrfs-tools

More notes on btrfs and snapshotting:

  • What can be done with btrfs-bcp on directories level can be done with snapshots on volumes level (as described in this post)
  • Snapshots in btrfs are not removable yet. You can clear them and reclaim the space taken by saved difference from the starting point. Still a few bytes is taken by having the directory that is not removable. Deleting snapshots is to be implemented in stable version of btrfs.

Comments: 1

page 1 of 15123...1415next »
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License