Skip to content

Instantly share code, notes, and snippets.

@pop3xrj
pop3xrj / UBUNTU-SEARCH LARGE FILES
Created September 11, 2009 00:17
find large file under linux (ubuntu)
find . -type f -size +20000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
@pop3xrj
pop3xrj / gist:184976
Created September 11, 2009 00:56
postgresql db backup and pump into bz2
pg_dump -Unrcrm -h 192.168.x.x --exclude-table=public.foo --exclude-table=public.bar dbname | bzip2 -c > ~/file.bz2
bzip2 -d db.sql.bz2 |psql test test
SELECT relname, reltuples, relpages * 8 / 1024 AS "MB" FROM pg_class ORDER BY relpages DESC;
@pop3xrj
pop3xrj / calculate psql table size
Created September 11, 2009 01:43
display table szie for ppostgresql
SELECT relname, reltuples, relpages * 8 / 1024 AS "MB" FROM pg_class ORDER BY relpages DESC;
It is possible to create files of arbitrary size on a linux machine using the dd command. Here is an example:
$ cd /tmp
$ dd if=/dev/zero of=bigfile bs=1024 count=1048576
This will create a file of size 1024 * 1048576 bytes (or 1 GB). In this command
* if - input file
* of - output file or the file to be created
* bs - block size in bytes
ssh -L 9090:localhost:9090 root@12.34.56.78 -N
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
#!/bin/bash
# Install Guide:
# 1. Use http://www.virtualbox.org if you use Windows or OS X
# 2. Download http://www.ubuntu.com 9.04 Desktop Edition and install into VM.
# 3. In your ubuntu console:
# $ wget http://gist.github.com/raw/180820/333b288a1b5df8df09842bfcfa248fa252f0cf3b/rails_install_script_on_ubuntu
# $ chmod 555 rails_install_script_on_ubuntu
# $ ./rails_install_script_on_ubuntu
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1 library is not used
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
establish_connection(
:adapter=> "postgresql",
:host => "localhost",
:database=> "test",
:schema_search_path=> "my",
:username=>'test',
:password=>'test')
Add this in .htaccess
php_value allow_call_time_pass_reference 1