This file contains 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
# \u is the username | |
# \h is the current host | |
# \w is the current directory | |
function prompt { | |
local GRAY="\[\033[0;37m\]" | |
local WHITE="\[\033[1;37m\]" | |
local GREEN="\[\033[0;32m\]" | |
local CYAN="\[\033[0;36m\]" |
This file contains 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 'csv' | |
def transform_merge(csv_file) | |
CSV.open(@csv_file).read.each do |line| | |
end | |
end | |
def multiple_merge(inputs) | |
errors = [] |
This file contains 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
OH NO! It turns out that simple one-port SSH Tunnels won't work for FTP since it uses another random port to actually transfer data. No problem! SOCKS Proxy to the rescue! | |
This assumes that you have SSH access to a server that can successfully connect to the FTP server you want access to. | |
On your local execute: | |
ssh -ND 1234 [email protected] | |
You'll need an FTP client that supports SOCKS Proxies. I recommend Filezilla. Enter localhost:1234 as your SOCKS proxy server and connect to the FTP server using its regular internet address (as though you were connecting from your production server). SWEEEET! |
This file contains 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
Say a server is only accessible from your production server. And let's say you have SSH access to the production server. GOOD NEWS. You can connect to that server. | |
Server | |
Address: ftp.something.com | |
Port: 3306 | |
Production server | |
Address: ssh.whatever.com | |
Username: tony |
This file contains 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
SELECT u.id, u.name, COUNT(CASE WHEN `assessment_results`.passed = 1 THEN 1 ELSE NULL END) / COUNT(*) as pass_rate, COUNT(*) as total, COUNT(CASE WHEN `assessment_results`.passed = 1 THEN 1 ELSE NULL END) FROM users u | |
LEFT JOIN assessment_results ON assessment_results.user_id = u.id | |
WHERE u.certification_id = 3 | |
AND (u.certification_status = 'green' OR u.certification_status = 'yellow') | |
AND assessment_results.submitted = true | |
group by u.id | |
ORDER BY pass_rate DESC a |
This file contains 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
function prompt { | |
local GRAY="\[\033[0;37m\]" | |
local WHITE="\[\033[1;37m\]" | |
local GREEN="\[\033[0;32m\]" | |
local CYAN="\[\033[0;36m\]" | |
local MAGENTA="\[\033[0;35m\]" | |
local RED="\[\033[0;31m\]" | |
local BLACK="\[\033[0;30m\]" | |
local YELLOW="\[\033[0;33m\]" | |
local BLUE="\[\033[0;34m\]" |
This file contains 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
# Migration generator shortcuts. | |
# rails generate migration MyNewMigration | |
# rails generate migration add_fieldname_to_tablename fieldname:string | |
# rails generate model Product name:string description:text | |
# The set of available column types [:string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean] | |
# A migration is a subclass of ActiveRecord::Migration. You must implement the "up" and "down" (revert) methods. | |
# These are the handy methods available to a Migration: |
This file contains 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
# Go to directory where you want to create your new project directory. Project is | |
# called 'mysite' | |
django-admin.py startproject mysite | |
# Go into directory and start server. Port 8000 by default. | |
cd mysite | |
python manage.py runserver [port] | |
#change setting.py's DB-ENGINE to 'django.db.backends.sqlite3' and give the | |
# database a "name" |
This file contains 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
$ nohup long-running-process & | |
$ exit |
This file contains 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
ssh [email protected] | |
screen # start new screen session | |
do-your-process | |
# Press CRTL-a, d -- detaches from new screen session | |
exit | |
ssh [email protected] | |
screen -r #resume previous screen session |
NewerOlder