Skip to content

Instantly share code, notes, and snippets.

View np422's full-sized avatar

Niklas Paulsson np422

View GitHub Profile
# 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
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
>> 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)
def reencode_session(data)
if data.is_a? Hash
result = {}
data.map do |key,val|
if val.is_a?(Hash) || val.is_a?(Array)
result[key] = reencode_session(val)
else
result[key] = ensure_utf8(val)
end
end
class String
def _dump level
#Strings are sometimes frozen, dup-i-dup before we can encode
begin
self.dup.encode Encoding::ASCII_8BIT
rescue
self.dup.force_encoding Encoding::ASCII_8BIT
end
end
ruby-1.9.2-p0 > require "dalli"
=> true
ruby-1.9.2-p0 > require "memcache"
=> true
ruby-1.9.2-p0 > m = MemCache.new(['192.168.31.206:11212:10', '192.168.31.207:11212:10'] )
=> <MemCache: 2 servers, ns: nil, ro: false>
ruby-1.9.2-p0 > m.get "apa"
=> "bepa"
ruby-1.9.2-p0 > m.set "foo" , "bar"
=> "STORED\r\n"
git diff ccb9ebe0ed59f41a59da84b7c74962886f6cceef..be3d311a71a91dc4142472b3d35e4ee52740f009 -- jquery.tokeninput-v2.js
diff --git a/public/javascripts/autocomplete/jquery.tokeninput-v2.js b/public/javascripts/autocomplete/jquery.tokeninput-v2.js
index fc0a765..85a9aa6 100644
--- a/public/javascripts/autocomplete/jquery.tokeninput-v2.js
+++ b/public/javascripts/autocomplete/jquery.tokeninput-v2.js
@@ -795,9 +795,6 @@
populate_dropdown(query, settings.jsonContainer ? results[settings.jsonContainer] : results);
}
- var queryStringDelimiter = settings.url.indexOf("?") < 0 ? "?" : "&";
<?php
//Konstanter tills vidare, senare från params ....
define('REPORT_URI' , '/reports/samples/AllAccounts');
define('JASPER_SERVER_URL' , 'http://localhost:8080/jasperserver/');
define('JASPER_USER' , 'test');
define('JASPER_PASSWORD' , 'test');
root@niklas-ThinkPad:/mnt# aptitude moo
There are no Easter Eggs in this program.
root@niklas-ThinkPad:/mnt# aptitude -v moo
There really are no Easter Eggs in this program.
root@niklas-ThinkPad:/mnt# aptitude -v -v moo
Didn't I already tell you that there are no Easter Eggs in this program?
root@niklas-ThinkPad:/mnt# aptitude -v -v -v moo
Stop it!
root@niklas-ThinkPad:/mnt# aptitude -v -v -v -v moo
Okay, okay, if I give you an Easter Egg, will you go away?
select
c.relhasrules,
c.relkind,
c.relhasoids,
c.relname,
u.nspname
from
pg_catalog.pg_namespace u,
pg_catalog.pg_class c
where