Skip to content

Instantly share code, notes, and snippets.

View andyfangdz's full-sized avatar

Andy Fang andyfangdz

View GitHub Profile
== Parsed Logical Plan ==
Aggregate [count(1) AS count#720L]
+- Join Inner, (id#409L = id#413L)
:- SubqueryAlias a
: +- Range (0, 100000000, splits=8)
+- SubqueryAlias b
+- Range (0, 100000000, splits=8)
== Analyzed Logical Plan ==
count: bigint
>
val result = tableA.join(tableB, $"a.id" === $"b.id").groupBy().count()
result.explain(true)
== Parsed Logical Plan ==
Aggregate [count(1) AS count#550L]
+- Join Inner, (id#201L = id#205L)
:- SubqueryAlias a
: +- Range (0, 100000000, splits=3)
def record_queryset_action(request, queryset, action):
failures = []
for item in queryset:
try:
action(item, request)
except:
failures.append(item)
return failures
def makeflag():
flag = 1
while True:
yield flag
flag = flag << 1
flag = makeflag()
E_GLASS_RN_STATE_INITIAL = next(flag)
E_GLASS_RN_STATE_WEAKENED = next(flag)
E_GLASS_RN_STATE_SHATTERING = next(flag)
E_GLASS_RN_STATE_ACTIVE_FRAGS = next(flag)
from __future__ import print_function
import cv2
from googleapiclient import discovery
import httplib2
from oauth2client.client import GoogleCredentials
import base64
from PIL import Image
from PIL import ImageDraw
from matplotlib import pyplot as plt
from os import system

Keybase proof

I hereby claim:

  • I am andyfangdz on github.
  • I am andyfang (https://keybase.io/andyfang) on keybase.
  • I have a public key whose fingerprint is 56D7 D05D 65F4 4640 7C59 B9CA 60FC FCB3 7A52 31B4

To claim this, I am signing this object:

@andyfangdz
andyfangdz / Alzheimer.ipynb
Last active January 21, 2016 22:28
Alzheimer.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andyfangdz
andyfangdz / text.md
Created December 2, 2015 23:26
Git as C++ Package Manager

Have you considered Git as a package manager? I've been using git submodules for dependencies and sub-dependencies and combined with free git hosting services, the idea is quite powerful.

Just go into your git project,

git submodule add git://somehosting.com/you/package.git
git submodule init package
git submodule update package
cd package && ./configure --stuff && make && cd ..

To select particular dependency versions,

@andyfangdz
andyfangdz / gulpfile.js
Last active October 28, 2015 18:21
buildmatrix - gulp
var gulp = require('gulp');
var webpackStream = require('webpack-stream');
var named = require('vinyl-named');
var argv = require('yargs').argv;
var glob = require("glob");
var path = require("path");
var plumber = require('gulp-plumber');
var format = require('string-format');
var webpack = require("webpack");
var gutil = require('gulp-util');
@andyfangdz
andyfangdz / delegate.js
Created July 8, 2015 13:49
jQuery Delegate
function __delegate(callTable) {
for (var selector in callTable) {
if (callTable.hasOwnProperty(selector)) {
for (var event in callTable[selector]) {
if (callTable[selector].hasOwnProperty(event)) {
$(selector).on(event, callTable[selector][event]);
}
}
}
}