Skip to content

Instantly share code, notes, and snippets.

View hibellm's full-sized avatar

Marcus hibellm

  • Roche
  • Basel
View GitHub Profile
@hibellm
hibellm / convertExcel2Sheets
Created December 16, 2016 22:13 — forked from azadisaryev/convertExcel2Sheets
Google Apps Script for converting Excel (.xls or .xlsx) file to Google Spreadsheet. Drive API must be enabled in your script's Advanced Google Services and in Developers Console for the script to work (see https://developers.google.com/apps-script/guides/services/advanced#enabling_advanced_services for details).
/**
* Convert Excel file to Sheets
* @param {Blob} excelFile The Excel file blob data; Required
* @param {String} filename File name on uploading drive; Required
* @param {Array} arrParents Array of folder ids to put converted file in; Optional, will default to Drive root folder
* @return {Spreadsheet} Converted Google Spreadsheet instance
**/
function convertExcel2Sheets(excelFile, filename, arrParents) {
var parents = arrParents || []; // check if optional arrParents argument was provided, default to empty array if not
@hibellm
hibellm / first-row-each-group.sql
Created October 16, 2016 16:34 — forked from erichnascimento/first-row-each-group.sql
Select first row in each GROUP BYgroup
/*
On Oracle 8i+, SQL Server 2005+, PostgreSQL 8.4+, DB2, Firebird 2.1+, Teradata, Sybase, Vertica:
*/
WITH summary AS (
SELECT p.id,
p.customer,
p.total,
ROW_NUMBER() OVER(PARTITION BY p.customer
ORDER BY p.total DESC) AS rk
FROM PURCHASES p)
@hibellm
hibellm / teradata_stats.rb
Created October 16, 2016 16:30 — forked from mrcsparker/teradata_stats.rb
Code to automatically generate Teradata stats
# 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
@hibellm
hibellm / TDCH Notes.md
Created October 16, 2016 16:28 — forked from cjmatta/TDCH Notes.md
Teradata Notes

##Teradata TDCH and Parallel Transporter with MapR

##Environment Running on Peep.local: 192.168.1.26

###Tasks

  • Load sample data into Teradata database
  • Run queries to ensure it's in there
  • Move data using TDCH
  • Move data using TD Parallel transporter
@hibellm
hibellm / columns_accessed_recently.sql
Created October 15, 2016 13:53 — forked from emaillenin/columns_accessed_recently.sql
Finds the columns that has been recently accessed in Teradata
select ObjectColumnName from dbc.dbqlobjtbl a
join dbc.dbqlogtbl b on a.ProcID = b.ProcID
and a.QueryID = b.QueryID
where ObjectDatabaseName = 'database_name' and ObjectTableName = 'table_name' and statementtype = 'Select' and ObjectType = 'Col'
@hibellm
hibellm / gitcreate.sh
Created October 15, 2016 12:32 — forked from robwierzbowski/gitcreate.sh
A simple litte script. Create and push to a new github repo from the command line.
#!/bin/bash
# https://gist.github.com/robwierzbowski/5430952/
# Create and push to a new github repo from the command line.
# Grabs sensible defaults from the containing folder and `.gitconfig`.
# Refinements welcome.
# Gather constant vars
CURRENTDIR=${PWD##*/}
GITHUBUSER=$(git config github.user)