Skip to content

Instantly share code, notes, and snippets.

@chaomai
chaomai / read_bin.cc
Created October 26, 2016 14:17
read file as binary format
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
if (argc != 2) {
printf("%s\n", "wrong number of parameters");
exit(-1);
}

Building lldb on Mac

Create Codesign Certificate

First we need to create a certificate. The llvm provided a way to do that, but I found this way to work slightly better for me. Just substitute lldb_codesign for the certificate name, instead of gdb-cert.

Install swig dependency

class SparseTensorFactory[Shape](sv: ShapeValue[Shape]) {
def *[D <: Dimension](dv: DimValue[D]): SparseTensorFactory[Shape ~ D] =
new SparseTensorFactory[Shape ~ D](sv.append(dv))
def &(sc: SparkContext): SparseTensor[Shape] =
new SparseTensor[Shape](sc, sv)
}
object SparseTensorFactory {
def >[D <: Dimension](dv: DimValue[D]): SparseTensorFactory[RNil ~ D] =
@chaomai
chaomai / check_time_and_mv.sh
Created November 12, 2020 03:05
check google takeout images, set a time for those without timestamp, and move them to destination directory
#!/usr/bin/env bash
function set_ts() {
local f=$1
dto=$($GNUBIN_COREUTILS/date -d "$dir_t" "+%Y:%m:%d 00:00:00")
echo exiftool -datetimeoriginal="$dto" "$f"
exiftool -datetimeoriginal="$dto" "$f"
local dest_path=$dest_dir/$dir_d
#!/usr/bin/env bash
dir=$1
function process() {
local final_dir="/Users/chaomai/Downloads/final_imgs"
local dest_dir="/Users/chaomai/Downloads/dest_imgs"
local f=$1
echo $f