Skip to content

Instantly share code, notes, and snippets.

View kotatsuyaki's full-sized avatar

Ming-Long Huang kotatsuyaki

View GitHub Profile
@kotatsuyaki
kotatsuyaki / apusys.txt
Created January 3, 2023 18:55
apusysEngine crash
01-04 02:52:03.273 10516 10516 I tflite : Initialized TensorFlow Lite runtime.
01-04 02:52:03.274 10516 10516 E apusys : apusysEngine: ===========================================
01-04 02:52:03.274 10516 10516 E apusys : apusysEngine: | open apusys device node fail, errno(13/Permission denied)|
01-04 02:52:03.274 10516 10516 E apusys : apusysEngine: ===========================================
01-04 02:52:03.274 10516 10516 F libc : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 10516 (TVM_TEST), pid 10516 (TVM_TEST)
01-04 02:52:03.311 10519 10519 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
01-04 02:52:03.312 693 693 I tombstoned: received crash request for pid 10516
01-04 02:52:03.313 10519 10519 I crash_dump64: performing dump of process 10516 (target tid = 10516)
01-04 02:52:03.314 10519 10519 F DEBUG : Process name is ./TVM_TEST, not key_process
01-04 02:52:03.314 10519 10519 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
@kotatsuyaki
kotatsuyaki / README.md
Created October 26, 2022 03:31
Speeding Up Maven Artifact Downloads

Create a settings file at ~/.m2/settings.xml with the following contents to use Google's mirror.

<settings>
  <mirrors>
    <mirror>
      <id>google-maven-central</id>
      <name>Google Maven Central</name>
      <url>https://maven-central.storage.googleapis.com/maven2/</url>
 central
@kotatsuyaki
kotatsuyaki / README.md
Created August 29, 2022 16:19
Mount VMware `vmdk` image on Linux

Tl;dr run this command to mount the second partition on fedora.vmdk to the mountpoint ./mnt.

guestmount -a fedora.vmdk -m /dev/sda2 --ro ./mnt

guestmount is part of libguestfs. In nixpkgs, use libguestfs-with-appliance instead of libguestfs, since the latter produces the following error. See NixOS/nixpkgs#37540 for details.

@kotatsuyaki
kotatsuyaki / main.rs
Created July 15, 2022 14:58
Use lopdf to add bookmarks to PDF file in Rust
use lopdf::{Bookmark, Document, Object};
fn main() {
let mut doc = Document::load("input.pdf").unwrap();
let pages = doc.get_pages();
let page_3_obj = pages.get(&3).unwrap().clone();
let _bm = doc.add_bookmark(
Bookmark::new("Test Bookmark Title".into(), [0., 0., 1.], 0, page_3_obj),
None,
@kotatsuyaki
kotatsuyaki / silk.py
Created June 13, 2022 02:29
Plotting program for ICCAD 2022 problem E (TW)
import sys
from typing import Literal, Union
from matplotlib import axes, pyplot as plt
from matplotlib import collections as mc
import numpy as np
import math
infile = open(sys.argv[1])
outfile = open(sys.argv[2])
@kotatsuyaki
kotatsuyaki / Cargo.toml
Last active May 30, 2022 13:10
Experiments for "How to wrap Sqlx data access types retaining transaction support?"
[package]
name = "sqlx-wrapper-question"
version = "0.1.0"
edition = "2021"
[dependencies]
sqlx = { version = "0.5", features = [ "runtime-tokio-rustls", "sqlite" ] }
async-trait = "0.1"
tokio = { version = "1", features = [ "rt", "macros" ] }
@kotatsuyaki
kotatsuyaki / Makefile
Created May 26, 2022 02:55
Using C++ modules with GCC 12
.POSIX:
CXX = g++
CXXFLAGS = -std=c++20 -fmodules-ts
main: gcm.cache main.cpp
$(CXX) $(CXXFLAGS) main.cpp -o main
gcm.cache:
$(CXX) $(CXXFLAGS) -c -x c++-system-header iostream
@kotatsuyaki
kotatsuyaki / patchelf-package-use.nix
Created April 25, 2022 02:16
Package Ubuntu binary in Nix with autoPatchelfHook
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
@kotatsuyaki
kotatsuyaki / notes.md
Last active April 13, 2022 05:52
LXC environment setup for live migration assignment

Launching host containers

lxc launch image:alpine:3.15 host1
lxc launch image:alpine:3.15 host2

Essential packages in alpine

  • qemu-system-x86_64
@kotatsuyaki
kotatsuyaki / flake.nix
Created March 27, 2022 06:42
Nix flake for devshell with chkservice (https://github.com/linuxenko/chkservice)
{
description = "chkservice devshell";
outputs = { self, nixpkgs }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
chkservice = pkgs.stdenv.mkDerivation {
name = "chkservice";
src = pkgs.fetchFromGitHub {
owner = "linuxenko";