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
def progress(percent) | |
left = 100 - percent | |
STDOUT.write "\r\e[0K" # clear cursor to the end of line | |
STDOUT.write "[#{'#' * percent}#{'.' * left}]\t[ #{percent}/100 ]" | |
STDOUT.flush | |
end | |
1.upto(100) do |i| | |
progress(i) |
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
# Copyright (c) 2012 Chris Parker <mrcsparker@gmail.com> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a | |
# copy of this software and associated documentation files (the "Software"), | |
# to deal in the Software without restriction, including without limitation | |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
# and/or sell copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all |
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
# Evaluates expressions left to right, with presedence | |
# using a PEG | |
require "parslet" | |
class Parser < Parslet::Parser | |
root :expression | |
rule(:expression) { additive | block | number } |
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 'rubygems' | |
require 'jdbc/teradata' | |
require 'java' | |
begin | |
Java::com.teradata.jdbc.TeraDriver | |
userurl = "jdbc:teradata://10.0.1.2/DATABASE=database_name,DBS_PORT=1025,COP=OFF" | |
connSelect = java.sql.DriverManager.get_connection(userurl, "username", "password") | |
stmtSelect = connSelect.create_statement |
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
# You are going to need to use jruby and install the jdbc-teradata gem | |
# Create a file named database.yml and fill it out. It will look something like this: | |
# production: | |
# adapter: jdbc | |
# driver: com.teradata.jdbc.TeraDriver | |
# url: jdbc:teradata://localhost/DATABASE=ods,DBS_PORT=1025,COP=OFF | |
# username: your_username | |
# password: your_password |
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
// Eval data is coming from a secure source. | |
var columns = {}; | |
columns['_A1'] = "this.A2"; | |
columns['_A2'] = "3"; | |
columns['_A3'] = "this.A1 + this.A2"; | |
Object.defineProperty(columns, "A1", { | |
get: function() { |
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
var Sample = (function (Sample) { | |
"use strict"; | |
var SampleColumn = (function () { | |
var SampleColumn = {}; | |
SampleColumn.parseColumns = function () { | |
var columns = [], |
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
import java.io.BufferedWriter; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.sql.*; | |
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.util.Calendar; | |
import java.util.HashMap; | |
class TeradataDump { |
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
# Brewfile | |
# `brew bundle` | |
install openssl | |
install emacs | |
install node | |
install unrar | |
install leiningen | |
install readline | |
install ruby-build |
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 'socket' | |
require 'bencode' | |
require 'securerandom' | |
module Loader | |
class NRepl | |
def self.connect(server, port) | |
new(server, port) | |
end |
OlderNewer