Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Jordan Brock http://www.spintech.com.au

« Newer Snippets
Older Snippets »
3 total  XML / RSS feed 

Sample configuration file for dbssh script

Put this in a text file called ".dbsshrc" in the same directory as your "dbssh script":http://textsnippets.com/posts/show/1254

      server_name:
        server: servername.com.au
        username: user_id
        password: password_cleartext
        remote_port: 3306
        local_port: 3307

Script to setup ssh tunnel to a remote mysql server

#!/usr/bin/env ruby

require 'yaml'
require 'rubygems'
require_gem 'net-ssh'

$stdout.sync = true

def help
  puts <<-USAGE
        This tool allows you to setup an ssh tunnel to a remote mySQL server

  Useage:
    dbssh 
    Please specify configuration in ~/.dbsshrc

  Example:  

    example ~/.dbsshrc:   

      server_name:
        server: servername.com.au
        username: user_id
        password: password_cleartext
        remote_port: 3306
        local_port: 3307
        
  USAGE
  exit
end

app_name = ARGV[0] || help
$config = YAML::load(File.open(File.expand_path("~/.dbsshrc")))[app_name]

puts "connecting to #{$config["server"]}"

exec("ssh -2 -f -c blowfish -N -C #{$config["username"]}@#{$config["server"]} -L #{$config["local_port"]}/127.0.0.1/#{$config["remote_port"]}")

puts ""
puts "success!"

Lighttpd redirect snippet

// having a problem with this redirect not working 100% properly

$HTTP["host"] =~ "^domainname\.com\.au$" { url.redirect = ( "^/(.*)" => "http://www.domainname.com.au/$1" ) 
}
« Newer Snippets
Older Snippets »
3 total  XML / RSS feed