Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
EST working hours

David Xia davidxia

🏠
EST working hours
View GitHub Profile
@davidxia
davidxia / gist:468dadb7ffcb0e1c4a28947bcff0482c
Last active Feb 3, 2022
trying to build tfx-bsl from source on M1 Mac
View gist:468dadb7ffcb0e1c4a28947bcff0482c

following https://github.com/tensorflow/tfx-bsl/#build-from-source

python setup.py bdist_wheel
/Users/dxia/.pyenv/versions/ml-golden-path/lib/python3.8/site-packages/setuptools/dist.py:493: UserWarning: Normalizing '1.7.0.dev' to '1.7.0.dev0'
  warnings.warn(tmpl.format(**locals()))
running bdist_wheel
running build
running bazel_build
Extracting Bazel installation...
@davidxia
davidxia / .vimrc
Created Nov 23, 2021
basic ~/.vimrc
View .vimrc
set number
set nojoinspaces
set textwidth=100
au FileType gitcommit setlocal textwidth=72
" put .swp and backups outside of the directory to avoid triggering file watchers
set directory=$HOME/.vim/swapfiles//
set backupdir=$HOME/.vim/backups//
set undodir=$HOME/.vim/undos//
@davidxia
davidxia / malloc-2.6.4.c
Created Apr 20, 2020
old malloc implementations
View malloc-2.6.4.c
/* Malloc implementation for multiple threads without lock contention.
Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
and Doug Lea <dl@cs.oswego.edu>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
View gist:550fa301258daacd00730f55bf324c65
# total memory usage (Mi mebibytes 1,048,576 bytes) of all pods in a namespace
kubectl -n $namespace top pod | \
tail -n +2 | \
awk '{print $3}' | \
tr -d 'Mi' | \
awk '{s+=$1} END {print s}'
# total CPU usage (millicores) of all pods in a namespace
kubectl -n $namespace top pod | \
tail -n +2 | \
@davidxia
davidxia / gist:1292b0caa96079a7f9c6356c6df38b01
Last active Dec 28, 2021
Get all credentials of all GKE clusters in a project using fish, gcloud, jq, and xargs
View gist:1292b0caa96079a7f9c6356c6df38b01
gcloud --project $project container clusters list --format json \
| jq -r '.[] | "\(.name):\(.location)"' \
| xargs -I @ bash -c \
"name=\$(echo @ | cut -d ':' -f 1) \
&& region=\$(echo @ | cut -d ':' -f 2) \
&& gcloud --project $project container clusters get-credentials \$name --region \$region"
@davidxia
davidxia / gist:b99a1a32754e66b85438e39a262e4d38
Last active Jun 20, 2018
get k8s cluster's namespaces with httpie, jq, yq, gcloud, and fish shell
View gist:b99a1a32754e66b85438e39a262e4d38
http GET \
(yq r ~/.kube/config -j | jq -r ".clusters[] | select(.name == \"$cluster_name\") | .cluster.server")/api/v1/namespaces \
'Authorization: Bearer '(\
gcloud config config-helper --format json | jq -r .credential.access_token
) \
--verify no \
| jq -r .items[].metadata.name
@davidxia
davidxia / gist:44171398798f260c891be817f2afd501
Last active Jun 19, 2018
close all open github PRs in one line with httpie, graphql API, jq, and fish shell
View gist:44171398798f260c891be817f2afd501
http https://ghe.spotify.net/api/graphql "Authorization: Bearer $github_access_token" query='{
user(login: "davidxia") {
pullRequests(first: 100, states: OPEN) {
totalCount
nodes {
number
repository {
name
owner {
login
View keybase.md

Keybase proof

I hereby claim:

  • I am davidxia on github.
  • I am davidxia (https://keybase.io/davidxia) on keybase.
  • I have a public key whose fingerprint is 13B7 FE7F 06B3 7836 0C07 C86A 3446 9DFB DC90 312C

To claim this, I am signing this object:

@davidxia
davidxia / fish_prompt.fish
Last active Aug 29, 2015
davidxia fish theme
View fish_prompt.fish
# name: davidxia
# A Powerline-inspired theme for FISH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
## Set this options in your config.fish (if you want to :])
set -g theme_display_user yes
@davidxia
davidxia / xcodebuild.sh
Created May 15, 2013
build xcode project without opening the damned thing
View xcodebuild.sh
#!/bin/bash
#
# Build and iPhone Simulator Helper Script
# David Xia 2013
#
# WARN: - if your .xcodeproj name is not the same as your .app name,
# this won't work without modifications
# - you must run this script in where your .xcodeproj file is
WORKSPACE=$1