Compiling Ruby on FreeBSD is not quite simple.
- make sure to tell it to also find libraries in
- and tell
configure script to find OpenSSL in
/usr because the later version isn’t quite compatible with latest ruby yet
So here’s the configure line
./configure --prefix="/opt/ruby23" --disable-install-doc --with-openssl-dir=/usr \
&& make \
&& make install
This is mostly for my own reminder.
- Google “miura fold”
- Read some articles, watch some videos
- Remember this:
- Long/initial fold must be odd-numbered.
- Short/following fold must have approximately same degree.
- Open up, fold following the short, zigzagged lines.
Not sure if useful.
Took me good few hours to find out why specific combination of task performs incredibly slowly on my server.
For reference, in my case it’s port-forwarded ssh/https connection over openvpn.
[ Client ] --(Internet)--> [ Gateway ] --(OpenVPN)--> [ Server (SSH) ]
Doing anything which takes up bandwidth (displaying log files, etc) will shoot the cpu load (at interrupt) up by a lot. By a lot I mean over 50% of one core.
This guy have the reasoning why it’s happening but I don’t know how much of it is correct. VMware support page also suggesting disabling it if network performance is slow.
In FreeBSD it’s:
echo 'net.inet.tcp.tso=0' >> /etc/sysctl.conf
In Windows it’s this
Windows Registry Editor Version 5.00
It seems to involve a shell script in Linux so I won’t bother writing it off here since it differs by system.
As usual, YMMV.
…and there goes my time 🙁
[ Script link ]
For god knows how long,
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; is one of the line usually included in nginx config snippet for proxying to a unicorn (Rails) backend.
…which is something you should never do unless you have another load balancer in front of the nginx being configured.
That line basically tells nginx to append
$remote_addr to whatever
X-Forwarded-For value currently set. It is only useful when your nginx is behind other load balancer which set up its own (hopefully correctly)
X-Forwarded-For. It should be set explicitly to
$remote_addr for any external-facing proxy. Otherwise fun things will happen.
For working with locked packages (the ones which must be upgraded through compilation because of using custom options)
# filename: pkg-lock-outdated
pkg query -e '%k = 1' %o | while read pkgorig; do
pkg version -ovL => -O "$pkgorig"
The script above is to list locked packages which need upgrading. And to upgrade everything at once (and sit in front of PC waiting for whole process)
pkg-lock-outdated | cut -f 1 -d '<' > "$listfile"
while read <&3 outdated; do
pkg unlock "$outdated"
pkg lock "$outdated"
done 3< "$listfile"
rm -f "$listfile"
There’s another alternative of unlocking all packages at once, run batched portmaster, and lock them all again.
For my own reference, after few hours messing around with shit called mail system.
Connecting to PostgreSQL from command line can be a bit confusing.
For starter, just like MySQL,
psql command defaults to connecting to socket instead of tcp. To make matter confusing, most PostgreSQL installation defaults to
ident (also called
peer)authentication for socket connection: it basically matches current user’s username (ssh login, etc) with PostgreSQL equivalent.
So, instead of using this to login from root to PostgreSQL superuser (usually named postgres or pgsql):
# psql -U postgres
you do this (assuming sudo installed):
# sudo -u postgres psql
The configuration for this is located in
pg_hba.conf of PostgreSQL data (or config in Debian) directory (
/etc/postgresql/$version/main in Debian,
/usr/local/pgsql/data in FreeBSD,
/opt/PostgreSQL/$version/data in EnterpriseDB PostgreSQL).
To switch to password based authentication for all methods just replace
md5 in respective lines and reload/restart the service. Don’t forget to set password for postgres user first before changing this otherwise you won’t be able to connect. You can then connect using
psql to any user using password.
Windows 8, just like Windows 7, has Control Panel interface to disable UAC. There’s difference though: disabling UAC via Control Panel in Windows 8 doesn’t fully disable UAC. You can check it by launching Command Prompt: in Windows 7, you’ll get administrator command prompt (the signs are “Administrator: Command Prompt” window title and default directory at %WINDIR%System32) while in Windows 8, you’ll get normal command prompt.
Also reported here (complete with “fix”).
Fix by editing registry:
Note that there isn’t really much reason anymore to completely disable UAC. Well, in my case, this ancient (but useful) tool
isn’t quite compatible with UAC.
Be careful when using read_multi with dalli: it may return nil-valued key instead of the correct key.
The issue is tracked here and thanks to this I dropped the read_multi usage in moebooru and used the much simpler (and most likely slower) single fetch (per entry) instead. There’s alternative way to use it – do a read_multi and refetch whatever missing/nil-keyed but apparently I’m too lazy to do it.