Skip to content

Instantly share code, notes, and snippets.

View hibellm's full-sized avatar

Marcus hibellm

  • Roche
  • Basel
View GitHub Profile
@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)
@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 / 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 / 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 / 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 / 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 / app.js
Created March 7, 2017 19:22 — forked from clarle/app.js
Short tutorial on how to use Express and node-mysql
// Module dependencies
var express = require('express'),
mysql = require('mysql');
// Application initialization
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
@hibellm
hibellm / VCF.py
Created March 17, 2017 11:11 — forked from slowkow/VCF.py
VCF.py is a simple module for reading VCF files
"""
VCF.py
Kamil Slowikowski
October 30, 2013
Read VCF files. Works with gzip compressed files and pandas.
Note: This module ignores the genotype columns because
I didn't need them at the time of writing.
@hibellm
hibellm / recursive_index.pl
Created April 1, 2017 20:39 — forked from Zverik/recursive_index.pl
Create index.html with a list of all files
#!/usr/bin/perl
# Create index.html with a list of all files.
# Written by Ilya Zverev, licensed WTFPL.
use strict;
use POSIX qw(strftime);
use HTML::Template;
use File::Basename;
use Getopt::Long;
@hibellm
hibellm / appsScript_ListFilesFolders_Mesgarpour.js
Created September 21, 2017 12:30 — forked from mesgarpour/appsScript_ListFilesFolders_ver.2.js
[Google Apps Script] List all files & folders in a Google Drive folder, & write into a speadsheet
/**
* Google Apps Script - List all files & folders in a Google Drive folder, & write into a speadsheet.
* - Main function 1: List all folders
* - Main function 2: List all files & folders
*
* Hint: Set your folder ID first! You may copy the folder ID from the browser's address field.
* The folder ID is everything after the 'folders/' portion of the URL.
*
* @version 1.0
* @see https://github.com/mesgarpour