How to import CSV into SQLite3
To import a CSV file into SQLite is easy.
sqlite3 my.db
.mode csv
.import path/to/file.csv name_of_table
And done.
Written by Sean Behan on 12/03/2017
How To Create a Dump File in Postgres Compatible with Heroku
When Heroku creates a dump file of your Postgres database it uses the `-Fc` option
It is equivalent to running
pg_dump -Fc -d name_of_db > name_of_db.dump
This command will let you import your database with the `pg_restore` command
pg_rest...
Written by Sean Behan on 03/06/2017
How To Export A MySQL Database to JSON, CSV and XML with Ruby and the ActiveRecord Gem
It's trivial to export data from a mysql database with Ruby and ActiveRecord. All you have to do is establish a connection and define a class that represents the table.
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_con...
Written by Sean Behan on 06/23/2012
Deploying to Dreamhost
Remember to include the host declaration in the database.yml file when you deploy to Dreamhost. Dreamhost does not use "localhost" which is typically the default setting when using the mysql adapter and developing locally or even on a small site.
At lea...
Written by Sean Behan on 06/17/2012
How to Import/Export Your Wordpress Blogroll... er, Your Links
It's not immediately apparent how to import/export the links in your Wordpress blogroll. One would expect that the import/export tool, used to backup/restore Wordpress posts and pages would handle this functionality as well. But the import/export tool has...
Written by Sean Behan on 06/17/2012
Python Zlib Compress DeCompress
import zlib
regular_string = 'this is my string'
compressed_string = zlib.compress(regular_string)
decompressed_string = zlib.decompress(compressed_string)
print compressed_string
print decompressed_string
Written by Sean Behan on 06/17/2012
Non Standard Port Number with SSH and Git
Here is an example using the port 4567 to connect with over ssh and git
ssh remote add origin ssh://sean@seanbehan.com:4567/path/to/git
git push origin master
Written by Sean Behan on 06/17/2012
Change default ssh port number on Ubuntu
Login as the root user or as a user that can execute sudo commands.
#open this file for editing...
vim /etc/ssh/sshd_config
Find the line that reads
Port 22
Change this to an different and an available port number...
Port 8000
Next reload ssh
/etc/...
Written by Sean Behan on 06/17/2012