Skip to content

Instantly share code, notes, and snippets.

View thaibui's full-sized avatar

Thai Bui thaibui

  • Facebook
  • Austin, TX
View GitHub Profile
@thaibui
thaibui / gist:2eb1c46da984ec83a01e364fe48acb05
Created March 4, 2020 04:30
Vectornator crash 2020/03/03
Process: Vectornator [3384]
Path: /Applications/Vectornator.app/Contents/MacOS/Vectornator
Identifier: maccatalyst.com.linearity.vn
Version: 3.1.14 (361)
App Item ID: 1470168007
App External ID: 834421191
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Vectornator [3384]
User ID: 501
@thaibui
thaibui / gist:38215d9b03e2cb95cfb1701acc4395ff
Created February 18, 2020 21:03
Out of disk space in Docker on OSX
If you run out of disk space in your Docker containers on OSX, this is probably the best thing to run:
```
docker rm $(docker ps -q -f 'status=exited')
docker rmi $(docker images -q -f "dangling=true")
```
@thaibui
thaibui / ambari_grafana_cluster_perf.json
Last active December 17, 2017 01:17
Ambari Grafana - Cluster Performance
{
"id": 45,
"title": "Cluster Performance",
"originalTitle": "Cluster Performance",
"tags": [],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"sharedCrosshair": false,
@thaibui
thaibui / pulsing_circle.html
Created October 18, 2016 03:38
Pulsing Circle
<html>
<head>
</head>
<body>
<canvas id="canvas" width="600px" height="600px"></canvas>
<script>
var c = document.getElementById("canvas");
var deltas = [];
for(var i = 1; i <= 10; i++) {
deltas[i-1] = i;
@thaibui
thaibui / CDHTez.md
Created October 9, 2016 06:43 — forked from epiphani/CDHTez.md
Getting Tez enabled on CDH5.4+

So Hive in CDH is horribly, painfully slow. Cloudera ships Hive 1.1, which is actually moderately modern. It is, however, very badly configured out of the box and patched with custom code from Cloudera. With a bit of effort, we managed to improve hive performance considerably. We really shouldn't have to do this, but Cloudera is actively working against supporting a performant Hive.

First, building Tez was fairly straightforward. Using the instructions at https://github.com/apache/tez/blob/master/docs/src/site/markdown/install.md, the only change was to use the version string "2.6.0" for the build. I believe that was the default. Don't use the CDH string, it won't work.

At the bottom of the installation instructions, there's mention of the fact that to use the local hadoop jars (rather than those packaged with tez) you must unpack the jars in HDFS rather than using the tarball. In this case, unpack the tez-minimal tarball and upload the contents to /apps/tez-0.7.0 (or whatever you prefer). Don't fo

@thaibui
thaibui / useful_spark_optimization_options.json
Created May 10, 2016 20:41
Useful Spark optimization options
"-Dspark.shuffle.blockTransferService": "netty",
"-Dspark.shuffle.io.numConnectionsPerPeer": 10,
"-Dspark.shuffle.consolidateFiles": true,
"-Dspark.shuffle.compress": true,
"-Dspark.shuffle.file.buffer.kb": 256,
"-Dspark.shuffle.manager": "sort",
"-Dspark.sql.shuffle.partitions": 1000,
"-Dspark.io.compression.codec": "snappy",
"-Dspark.io.compression.snappy.blockSize": 2048,
"-Dspark.shuffle.memoryFraction": 0.8
@thaibui
thaibui / max.positive.product.js
Last active April 5, 2016 21:50
A function that compute the max positive product of 3 intergers
/*
Write a function which takes in an array of integers and returns the highest positive product
possible by multiplying 3 distinct numbers. NO SORTING is ALLOWED
example:
[1, 3, 5, 2, 8, 0, -1, 3]
=> 8 * 5 * 3 = 120
@thaibui
thaibui / TodoApp.java
Last active July 1, 2024 17:03
A simple command line application in Java to handle todo list
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
@thaibui
thaibui / sum.js
Created March 24, 2016 01:23
A Javascript function that does recursive sum and has funny syntax (e.g. sum(3)(5)(-1)() // result 7)
/**
* A function that takes an abitrary number of parameters of the form sum(param1)(param2)(param3)...(paramN)()
* and return the total sum = param1 + param2 + .. + paramN.
*
* Note that the last parameter has to be empty. Thus, sum() is zero.
**/
var sum = function(param) {
var total = 0;
var recursiveSum = function(p) {
@thaibui
thaibui / spiral.js
Created March 24, 2016 01:15
Drawing a spiral in a square of size N in Javascript
/**
* Making a spiral of size N x N and output the drawing out to the console.
* For example, when n = 10, this is how the output spiral will look like:
* * * * * * * * *
* *
* * * * * * *
* * * *
* * * * *
* * * * * *