Skip to content

Instantly share code, notes, and snippets.

@zhongdai
zhongdai / gob-ddb-attributevalue.go
Last active August 9, 2024 01:47
ser/de ddb attributevalue
package main
import (
"bytes"
"context"
"encoding/gob"
"fmt"
"log"
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
@zhongdai
zhongdai / how-to-build-tensorflow-go-on-m1.md
Last active April 30, 2024 09:41
How to install tensorflow go binding on M1

Background

This is the follow up of how to install tensorflow C api on M1. Since I have installed the C API, I need to install the tensorflow Go to run the graph in my Go code. However, I found this document, however, it does not work on a M1 macbook.

The goal of this document is to compile and run the following Go program

package main
@zhongdai
zhongdai / how-to-build-tensorflow-c-api-on-a-m1-macbook.md
Last active April 29, 2024 11:51
How to build tensorflow C API on a M1 (ARM) Macbook

Background

I tried to install the tensorflow C API on my Macbook Pro 2021 (M1) machine, by following this document. It seems all of the pre-built libraris are for x86, but not for the ARM chips. I got the same error as this post. It seems the linker complaints, and here is the error message.

ld: warning: ignoring file /usr/local/lib/libtensorflow.2.7.0.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_TF_Version", referenced from:
      _main in hello_tf-6f1778.o
ld: symbol(s) not found for architecture arm64
@zhongdai
zhongdai / recursive_sql_example.md
Created April 15, 2019 04:09
RECURSIVE SQL Example

Schema (PostgreSQL v10.0)

create table employee 
(
  name varchar(10),
  _id int,
  manager_id int
);

insert into employee values ('apple',1,null);

{
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"simple": {
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
}
},
"handlers": {
@zhongdai
zhongdai / find_longest_continues_period.sql
Last active November 16, 2017 23:55
Find the longest continues period
/*
Problem Definition
- The data
- There are multiple months for each account
- No duplicated months per account
- Active_Flag only can be 1 or 0 (1 for Activated Status)
- Month_Key is not continues calendar months, could miss certain months
- The question