Skip to content

Instantly share code, notes, and snippets.

View thaibui's full-sized avatar

Thai Bui thaibui

  • Facebook
  • Austin, TX
View GitHub Profile
@PeterAttardo
PeterAttardo / dim_calendar.hql
Last active November 16, 2022 08:14
Create calendar dimension table in hive query language (HQL)
set hivevar:start_date=0000-01-01;
set hivevar:days=1000000;
set hivevar:table_name=[INSERT YOUR TABLE NAME HERE];
-- If you are running a version of HIVE prior to 1.2, comment out all uses of date_format() and uncomment the lines below for equivalent functionality
CREATE TABLE IF NOT EXISTS ${table_name} AS
WITH dates AS (
SELECT date_add("${start_date}", a.pos) as date
@dansimau
dansimau / ldif-to-csv.sh
Created November 12, 2010 15:14
Shell script that reads LDIF data from STDIN and outputs as CSV.
#!/bin/bash
#
# Converts LDIF data to CSV.
# Doesn't handle comments very well. Use -LLL with ldapsearch to remove them.
#
# 2010-03-07
# dsimmons@squiz.co.uk
#
# Show usage if we don't have the right params