Took me few weeks to find out that this one-liner does wonder:
echo manual >> /etc/init/mysql.override
(the line above is to disable mysql, obviously. And must be done as root)
The answer is on first hit (as of this post’s writing) of googling “ubuntu disable service” but you need to scroll down a bit and ignore shitload of crappy, outdated explanations to find that small gem.
Unfortunately doesn’t apply to previous LTS. Or does it?
After working on it for several weeks, finally it got to the point where it’s relatively usable. No more Bundler-on-Rails2 evilry and the fact that 3.0 branch is still supported.
The best part is the one above. Yes, Moebooru now runs on Rubinius/Puma. The only foreseeable problem is it uses Process.pid on file uploads which, when several people uploading (or working with) files at same time, the temporary filename will collide.
Though due to me aiming more for workable implementation instead of correct implementation, there are quite a lot legacy stuff still in there:
repeated_auto_complete doesn’t work in Rails 3 without vendoring or updating the gem itself (and I did both since Bundler’s git functionality seems broken in Rubinius).
prototype_legacy_helper must be used since I haven’t had time to upgrade the *_remote functions (and still thinking how to do it).
verification gem since I haven’t upgraded the route and its functionality, which previously built-in in Rails 2.3 has now removed.
Unsightly lib/core_ext. Just look at evilry I have added to make it behave like 2.3-stable.
On the brighter side, now I can start cleaning up the code. Or upgrade all the way to Rails 3.2 ( ¬‿¬)
While digging more into the code called “Moebooru” which was forked from “Danbooru”, I noticed this:
connection.execute("update table_data set row_count = row_count + 1 where name = 'users'")
connection.execute("update table_data set row_count = row_count - 1 where name = 'users'")
Counting takes ages, right. Except it is not. I’ve done this, yes, but on a table with 10+ millions of data (this one has ~400k in mainline danbooru), with multiple data inserted (this one got, uh, one every other week?) and queried every second (see below), and with the required count method not a simple select count(1) on some_table (which is what the example above used for).
The best part? It’s only used once, when user registers:
if User.fast_count == 0
self.level = CONFIG["user_levels"]["Admin"]
self.level = CONFIG["user_levels"]["Unactivated"]
self.level = CONFIG["starting_level"]
self.last_logged_in_at = Time.now
This afternoon I experimented with tag searching. Current implementation doesn’t scale beyond 6 tags due to parsing requirement. You can argue about binding variable all day but in the end it can be abused easily if the limit is lifted.
Since I forgot to branch the original source, the branching looked awesomely crappy. Therefore I decided to rebase entire thing to ease up keeping track with Moebooru “mainline”. All my commits are now in branch “default”. If you didn’t do any change, backout up to revision 9174b6b5b02d and then pull again. And then, don’t ever touch moe branch again anymore.
It’s still quite slow even on my system. I should switch to Chrome again one of these days. I don’t even use Firefox anymore apart of on this specific system. Oh and Flash also crashes every other minutes in this browser.
And more!: I hope you didn’t expect me to do more while there are incomplete items above.
Sure looks good. Need more testing though. There’s also one part which I totally had no idea why should be changed when upgrading to 1.9. Just grep for FIXME to see which it is and hopefully fix it up for me (or explain what it does).
As usual, having completed the work for today, live demo is up and open for everyone to break (…if there’s anyone, that is).
WARNING: using method below will lock yourself out when using emergency console since whatever crypt it’s using surely doesn’t understand bcrypt (as I experienced myself). Additionally, this solution won’t add bcrypt support to other applications using crypt interface like proftpd unless it’s started by preloading libxcrypt.so first (also from my own experience).
As much as Drepper want to pretend bcrypt is wrong solution, it actually gives one benefit: ease of switch to Linux. Some systems use bcrypt by default or configurable to use it. On other case, there might be time where you need system’s (or applications using system’s) crypt to handle bcrypt passwords from external system (usually web applications).
It’s quite difficult to enable bcrypt support in RHEL based distro as there is no libxcrypt and pam_unix2 packages available. Thankfully it’s available in Debian (and derivatives) in package libpam-unix2.
The README.Debian says to modify files in /etc/pam.d but if I remember it correctly, it confused apt PAM handling system or whatever. Fast forward few weeks, I discovered a better way to use it by creating PAM configuration in /usr/share/pam-configs. Since it’s mostly equivalent to normal pam_unix, I just copy and modify the file using this (long-ass) oneliner sed:
Then execute pam-auth-update, select Unix2 authentication and deselect Unix authentication. Don’t forget to update passwords for all other users as well or they won’t be able to login since pam_unix2 doesn’t recognize sha based hashes.
Actually, change all other users password to use md5 first before replacing the PAM with pam_unix2.
Update 2012-04-01: Removed nullok_secure since it isn’t supported.
I’ve enabled Danbooru repository sync to Bitbucket again as I’m planning to work on it again – mainly upgrading to Rails 3 and reducing insanity required for installation. And perhaps import the danbooru-imouto changes back.
Because of one awesome bug inflicts eye-cancer when using Consolas font and deactivated “Bold text is a different colour”, I had to recompile PuTTY by hand (more like, by gcc). I initially tried to compile the PuTTYTray one but apparently they successfully mixed C and C++ code and completely broke the build procedure using mingw. Or I missed something obvious.
Anyway, I went back to vanilla PuTTY. As it turns out, compiling using latest mingw’s gcc isn’t a good idea since it removed -mno-cygwin option and therefore broken unless you do some magic edit. Thanks to that, I stopped bothering trying to compile it under Windows and used mingw-gcc for Linux (which is able to produce Windows binary). Here be the steps from beginning. Tested on Debian 6.
apt-get install mingw32 subversion perl
svn co svn://svn.tartarus.org/sgt/putty putty
make VER="-DSNAPSHOT=$(date '+%Y-%m-%d') -DSVN_REV='$(svnversion)' -DMODIFIED" TOOLPATH=i586-mingw32msvc- -f Makefile.cyg putty.exe
Patch is done before make (duh) and the diff can be found here. If you’re lazy (like me) you can just download the build at my server (link at bottom). Should be virus-free but I guess you can notify me if you encounter one. Built everyday until it breaks.
I kept forgetting them whenever I need one so I’ll put mine here and be happy:
###### Debian Main Repos
deb http://http.debian.net/debian squeeze main contrib non-free
#deb-src http://http.debian.net/debian squeeze main contrib non-free
###### Debian Security Update Repos
deb http://security.debian.org squeeze/updates main contrib non-free
#deb-src http://security.debian.org squeeze/updates main contrib non-free
###### Debian General Update Repos
deb http://http.debian.net/debian/ squeeze-updates main contrib non-free
#deb-src http://http.debian.net/debian/ squeeze-updates main contrib non-free
###### Debian Backports Repos
deb http://http.debian.net/debian-backports squeeze-backports main contrib non-free
#deb-src http://http.debian.net/debian-backports squeeze-backports main contrib non-free
###### Dotdeb Repo
#deb http://packages.dotdeb.org squeeze all
#deb-src http://packages.dotdeb.org squeeze all
It should cover mostly used packages and will keep me sane. Also debian-volatile has been replaced with debian-updates (god knows why it’s called like that) since squeeze (6.0) but in case I need to take care a lenny or earlier (derp) machines, this should also be added:
deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
Oh and Debian/kFreeBSD within a FreeBSD system is quite funny.
Danbooru 1.14.0 has released. I still wonder what “Final tagged version” means. And I think I’ll use tagged ones instead of trunk from now on. Why? Just because. 😛
^– actually, it means less maintenance.
With that, I’ll also stop using -current for animu server o.o
Not before 4.4 released though – which means I’ll have to struggle with -current until November – or until I switch to NetBSD. The reason is simple: Danbooru requires PostgreSQL 8.3 which only available as package on -current (I forced to manually compile before using -current). – Or maybe until I switch to Shimmie (which sucks).
Sil3112 (SiliconImage SATALink RAID PCI Card) is not properly supported by FreeBSD. The installer halted successfully on all my three attempt at installing it. (First one even stopped when formatting – said that it can’t find the hard disk drive LOL).
OTOH, NetBSD and OpenBSD can use that piece of hardware just fine albeit the claim of the card as “crappy” on certain mailing lists.
Tonight, system.genshiken-itb.org got a system upgrade!
[10:42] ~# dmesg | head
OpenBSD 4.3-current (GENERIC) #878: Tue May 27 09:18:05 MDT 2008
I upgraded it. Remotely.
Nothing is more thrilling than reboot with new kernel while praying nothing bad happens O_O (which means, if IT happens, the server won’t be accessible until I got time to go to the location of the server…)
Now I can finally install PostgreSQL from packages – not compiling from source anymore 😀
Here’s a cell phone themes for you: lulz1 (ha creative name 😀 )
Designed specifically for Sony Ericsson W880 (yes, my phone). May or may not work for other SE phones version 4.5 with display resolution of 240×320 (which includes, but not limited to: K790, K800, K810, S500, T650, W580, W830, W850). And might work for other models with display resolution of 240×320.
Use dd –list to see which is the Ubuntu root partition. Easy way: Harddisk# is the same as system partition – usually C: drive. Then for Partition#, use this formula: /dev/[s/h]d[a-z]#. So /dev/sda2 would have partition number 2 (Partition2)
Then do this: dd if=?DeviceHarddisk#Partition# of=c:ubuntu.pbr bs=512 count=1
And edit boot.ini (System Properties -> Advanced -> Startup and Recovery Settings -> Manually edit startup file). Add line like this: C:ubuntu.pbr=”Ubuntu”
Reboot, there’ll be Ubuntu in boot choice list.
There might be another countdown… to remove: go find it yourself 😛