This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat /proc/partitions | |
major minor #blocks name | |
11 0 717120 sr0 | |
8 0 732574584 sda | |
8 1 19679593 sda1 | |
8 2 2931862 sda2 | |
8 3 709960545 sda3 | |
8 32 312571224 sdc | |
8 33 312570183 sdc1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test "swapping products for collections" do | |
c = create(:work) | |
b1 = create(:book, collection: c) | |
b2 = create(:book, collection: c) | |
b3 = create(:book) | |
result = CollectionMethods.swap_product_for_collection([b1,b2,b3]) | |
assert result.length == 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Smallest images: | |
dkam@Nervous-Energy ~/booko (master) $ find public/images/covers/* -type f -print0 | xargs -0 du -s | sort -n | head -10 | cut -f2 | xargs -I{} du -sh {} | awk '{ print $2 }' | xargs identify -verbose | grep Quality | |
Quality: 85 | |
Quality: 85 | |
Quality: 79 | |
Quality: 85 | |
Quality: 77 | |
Quality: 70 | |
Quality: 85 | |
Quality: 85 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
### | |
# Looks for all files in your root media directory with an extension listed in *accepted_formats* array | |
# then passes them to ffmepg to report back resolution. Reports file name, resolution, resolution name | |
# | |
# EG: ./media_size_report.rb /mnt/my_nas/movies | |
# | |
# List media sizes in order of most common: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Numeric | |
def to_human | |
units = %w{B KB MB GB TB} | |
e = (Math.log(self)/Math.log(1024)).floor | |
s = "%.3f" % (to_f / 1024**e) | |
s.sub(/\.?0*$/, units[e]) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dkam@Nervous-Energy ~/booko (rails4_visual) $ ab -n 10 -c 2 https://dev.booko.info/9781595824172/Star-Wars-Thrawn-Trilogy | |
This is ApacheBench, Version 2.3 <$Revision: 1178079 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking dev.booko.info (be patient).....done | |
Server Software: nginx/1.5.8 | |
Server Hostname: dev.booko.info |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dkam@Nervous-Energy ~/booko (rails4_visual) $ ab -n 10 -c 2 http://booko.com.au/9781595824172/Star-Wars-Thrawn-Trilogy | |
This is ApacheBench, Version 2.3 <$Revision: 1178079 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking booko.com.au (be patient).....done | |
Server Software: nginx/1.4.4 | |
Server Hostname: booko.com.au |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sequel' | |
DB = Sequel.connect('postgres://user:pass@localhost/db') | |
DB.listen(:my_channel, loop: true) {|channel, pid, payload| puts "Got payload '#{payload}' on channel '#{channel}'" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sequel.extension(:pg_hstore, :pg_hstore_ops, :pg_array) | |
DB = Sequel.connect('postgres://user:pass@localhost/db') | |
class Messages < Sequel::Model | |
end | |
Messages.first | |
#=> #<Messages @values={:id=>1, :observable_name=>"testo", :observable_content=>{"key1"=>"value1", "key2"=>"value2", "key3"=>"value3"}, :created_at=>2014-03-25 15:37:30 +1100}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin remote | |
name /etc/lircd.conf | |
bits 13 | |
flags RC5|CONST_LENGTH | |
eps 30 | |
aeps 100 | |
one 907 885 | |
zero 907 885 | |
gap 113935 | |
toggle_bit 2 |