Skip to content

Instantly share code, notes, and snippets.

View tanduong's full-sized avatar

Tan Duong tanduong

View GitHub Profile
@tanduong
tanduong / Middleware.js
Created July 3, 2019 10:55 — forked from darrenscerri/Middleware.js
A very minimal Javascript (ES5 & ES6) Middleware Pattern Implementation
var Middleware = function() {};
Middleware.prototype.use = function(fn) {
var self = this;
this.go = (function(stack) {
return function(next) {
stack.call(self, function() {
fn.call(self, next.bind(self));
});
@tanduong
tanduong / odbc_setup_macos.md
Created September 24, 2019 17:15 — forked from arvsrao/odbc_setup_macos.md
Guide to accessing MS SQL Server in Mac OS X via PyODBC

Since I spent essentially two full days figuring out how to access a corporate MS SQL database pythonicly, I figured I should leave some notes, for future reference and to aid other souls looking to do the same.

These instructions and the commands that follow, were executed on a MAC OS 10.8.3 system. Additionally, I found this blog [post][1] especially helpful during the debugging process.

On mac os, there is a default ODBC manager, iODBC. Other Unix based systems tend to use [unixODBC][2]. Look elsewhere for a discussion about the differences between these driver managers. The only feature we care about is being able to connect to SQL databases through [pyodbc][3], and at the time of this writing [pyodbc][3] requires iODBC as its manager.

Start by installing freeTDS libraries. FreeTDS allows unix programs to talk natively with MS SQL and SyBase databases.

brew intsall freetds
@tanduong
tanduong / odbc_setup_macos.md
Created September 24, 2019 17:15 — forked from arvsrao/odbc_setup_macos.md
Guide to accessing MS SQL Server in Mac OS X via PyODBC

Since I spent essentially two full days figuring out how to access a corporate MS SQL database pythonicly, I figured I should leave some notes, for future reference and to aid other souls looking to do the same.

These instructions and the commands that follow, were executed on a MAC OS 10.8.3 system. Additionally, I found this blog [post][1] especially helpful during the debugging process.

On mac os, there is a default ODBC manager, iODBC. Other Unix based systems tend to use [unixODBC][2]. Look elsewhere for a discussion about the differences between these driver managers. The only feature we care about is being able to connect to SQL databases through [pyodbc][3], and at the time of this writing [pyodbc][3] requires iODBC as its manager.

Start by installing freeTDS libraries. FreeTDS allows unix programs to talk natively with MS SQL and SyBase databases.

brew intsall freetds
DROP TABLE if exists d_date;
CREATE TABLE d_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
day_suffix VARCHAR(4) NOT NULL,
day_name VARCHAR(9) NOT NULL,
day_of_week INT NOT NULL,
@tanduong
tanduong / zshrc
Created December 16, 2019 12:46 — forked from LukeSmithxyz/zshrc
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
#!/usr/bin/env bash
set -e
PROJECT=[provide your gcp project id]
COMPOSER_NAME=[provide your composer environment name]
COMPOSER_LOCATION=[provide the selected composer’s location e.g. us-central]
CLUSTER_ZONE=[provide the selected composer’s zone e.g. us-central1-a]
# Enable autoscaling in node level
GKE_CLUSTER=$(gcloud composer environments describe \
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: airflow-worker
namespace: # use ${AIRFLOW_WORKER_NS} variable defined above
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: airflow-worker
spec:
template:
spec:
containers:
- name: airflow-worker
resources:
requests:
memory: 2Gi
limits:
memory: 2Gi
@tanduong
tanduong / vscode_shortcuts.md
Created April 9, 2021 14:50 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@tanduong
tanduong / gist:41fe5e4f42553d690b10ca68d98d9201
Created May 1, 2021 01:40 — forked from olivierlacan/gist:4062929
Code School Screencasting Framework

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.