Skip to content

Instantly share code, notes, and snippets.

View zzl0's full-sized avatar

zzl zzl0

View GitHub Profile
@zzl0
zzl0 / SparkSQL.md
Last active October 18, 2016 06:15

一、总结

1.1 总体过程

1.2 SQLContext 里面包含了 parser、analyzer、optimer。其中 analyzer 和 optimzer 都是包含了一些规则,用来对查询计划树进行转换,实现上主要是利用 pattern matching 做转换。其中这些规则按照作用的次数(Once 或者 FixedPoint)进行了分组,详细情况见第 1.4 条。

@zzl0
zzl0 / browser_history.md
Created December 28, 2017 04:29 — forked from dropmeaword/browser_history.md
Playing around with Chrome's history

Browser histories

Unless you are using Safari on OSX, most browsers will have some kind of free plugin that you can use to export the browser's history. So that's probably the easiest way. The harder way, which seems to be what Safari wants is a bit more hacky but it will also work for other browsers. Turns out that most of them, including Safari, have their history saved in some kind of sqlite database file somewhere in your home directory.

The OSX Finder cheats a little bit and doesn't show us all the files that actually exist on our drive. It tries to protect us from ourselves by hiding some system and application-specific files. You can work around this by either using the terminal (my preferred method) or by using the Cmd+Shft+G in Finder.

Finder

Once you locate the file containing the browser's history, copy it to make a backup just in case we screw up.

@zzl0
zzl0 / iterm2-solarized.md
Created March 2, 2018 18:52 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@zzl0
zzl0 / athena_cheatsheet.md
Created April 6, 2018 18:16 — forked from steveodom/athena_cheatsheet.md
AWS Athena / Hive / Presto Cheatsheet

Useful Links / Sources

Housekeeping

change column type

ALTER TABLE logs.trades CHANGE recentprice price int;
@zzl0
zzl0 / steps.md
Last active September 14, 2018 23:37
  • For instance, if you can run SELECT, UPDATE, CREATE statements that's a good MVP (minimum viable product).
  • Next, see if you get the completion working for the tables that you create during that session. This validates that the completion refresher is working.
  • Next, check if you can do alias completion. Eg: SELECT * FROM table_name AS t WHERE t. should list you all the columns in that table. This validates that you can penetrate through the aliasing and provide the completion.
  • Next, is to tackle the JOIN statements. See if you can alias both the tables in a JOIN statement and the completions can identify the right table and suggest the columns appropriately.
  • Then I'd tackle the special commands.We might not be able to support all of them, but getting a good chunk of it done will make it attractive to hardcore sqlite users.
  • If you've gone through them all, I'd recommend going through the config file and see if you can toggle the various config values and check if that works
@zzl0
zzl0 / README.md
Created January 8, 2019 04:11 — forked from joyrexus/README.md
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@zzl0
zzl0 / Python201.md
Last active February 6, 2019 17:05

Python 201

In this document, we are going to be talking about some Python idioms.

  • high level design principles
  • design patterns
  • idioms
  • code style

Disclaimer

@zzl0
zzl0 / tictactoe.py
Last active March 11, 2019 13:41
An implementation of tic-tac-toe game with a few play strategies (e.g. human, random, minimax, alpha-beta pruning)
import copy
import random
# constants
EMPTY, X, O = '.XO'
ROWS = [[(i, j) for j in range(3)] for i in range(3)]
COLS = [[(j, i) for j in range(3)] for i in range(3)]
DIAGONALS = [
[(0, 0), (1, 1), (2, 2)],