Skip to content

Instantly share code, notes, and snippets.

View np422's full-sized avatar

Niklas Paulsson np422

View GitHub Profile
>> s = "Räksmörgås".encode Encoding::ISO8859_1
=> "R\xE4ksm\xF6rg\xE5s"
>> Benchmark.measure { 100000.times { a = s.encoding != Encoding::UTF_8 ? s.encode(Encoding::UTF_8) : s } }
=> 2.590000 0.010000 2.600000 ( 2.585933)
>> s = "Räksmörgås"
=> "Räksmörgås"
>> Benchmark.measure { 100000.times { a = s.encoding != Encoding::UTF_8 ? s.encode(Encoding::UTF_8) : s } }
=> 0.010000 0.000000 0.010000 ( 0.014274)
cat <<EOF >/usr/local/share/config.site
CFLAGS="-march=native -mtune=native -fomit-frame-pointer -O2"
CC="gcc"
CPPFLAGS='-I/usr/local/include'
LDFLAGS='-L/usr/local/lib -R/usr/local/lib'
EOF
# Serial console for both OS and GRUB
echo "sx:2345:respawn:/sbin/agetty 9600 ttyS1 vt100" >> /etc/inittab
cd /boot/grub
mv grub.conf grub.conf.orig
cat <<EOF >grub.conf
serial --unit=1 --speed=9600
terminal --timeout=10 serial console
default=0
timeout=5