Skip to content

Instantly share code, notes, and snippets.


Helin Wang helinwang

  • Bay Area
View GitHub Profile
helinwang /
Last active October 31, 2021 01:27
A survey of TensorFlow feature columns
from tensorflow.keras import layers
import tensorflow as tf
import numpy as np
video_id = tf.feature_column.categorical_column_with_identity(
key="video_id", num_buckets=1000000, default_value=0
features = {
"video_id": tf.sparse.from_dense([[2, 85, 0, 0, 0], [33, 78, 2, 73, 1]]),
helinwang / gist:f9ac4d3b8b927bdcd2a2b87a5ee7bb5e
Created December 3, 2020 18:38
Convert TF saved model to TensorBoard summary - works with unknown custom TF op
View gist:f9ac4d3b8b927bdcd2a2b87a5ee7bb5e
# Copyright 2019 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
helinwang /
Last active July 3, 2020 23:28
TensorFlow decode arbitrary Protobuf using and TFRecordDataset.
import tensorflow as tf
from google.protobuf.descriptor_pb2 import FileDescriptorSet
from google.protobuf.descriptor_pb2 import FileDescriptorProto
import baz_pb2
def decode(x):
proto = FileDescriptorProto()
helinwang / mac_malware_auto_start.txt
Last active April 18, 2019 06:11
Places that mac malware could hide (auto start)
View mac_malware_auto_start.txt
and "system preferences" -> login items
"keychain access": unkown certificates (except the ones in "System Roots")
helinwang / init.el
Last active November 3, 2020 04:31
My Rust emacs configuration
View init.el
;; Make sure to install rust-analyzer binary, otherwise lsp-mode
;; default to using rls instead of rust-analyzer.
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
helinwang / click.js
Created January 4, 2019 00:36
Batch delete Weibo posts
View click.js
setInterval(() => {
}, 500)
helinwang /
Last active December 18, 2018 16:31
Upload large file to dropbox using Python
import sys
import dropbox
path = sys.argv[1]
dbx = dropbox.Dropbox(AUTH_TOKEN, timeout=6000) # set the timeout best for you
with open(path, 'rb') as f:
data =
data, DROPBOX_FOLDER_NAME, dropbox.files.WriteMode.overwrite,
helinwang /
Last active April 23, 2023 05:27
Unraid: mount a unraid share using the unraid mount tag in Ubuntu

Mounting the shared path You can mount the shared folder using

mount -t 9p -o trans=virtio [mount tag] [mount point] -oversion=9p2000.L

mount tag: As specified in Qemu commandline. mount point: Path to mount point. trans: Transport method (here virtio for using 9P over virtio) version: Protocol version. By default it is 9p2000.u . Other options that can be used include:

helinwang / heap.go
Created July 19, 2018 04:57
a heap implementation in Go
View heap.go
package types
// Heap is a max heap
type Heap struct {
buf []int
func (h *Heap) Peak() int {
return h.buf[0]
helinwang / queue.go
Last active July 21, 2018 18:06
Simple queue implementation
View queue.go
package types
// Note: this queue does not shrink the underlying buffer.
type queue struct {
buf [][4]int // change to the element data type that you need
head int
tail int
func (q *queue) extend(need int) {