Skip to content

Instantly share code, notes, and snippets.

View kenthua's full-sized avatar

Kent Hua kenthua

View GitHub Profile
@kenthua
kenthua / mpg.py
Last active November 21, 2023 20:10
import ray
import requests
# runtime_env here doesn't seem to do anything as we still miss the tf module
ray.init(address="ray://ray-head-svc:10001")
import numpy as np
import pandas as pd
import pathlib
import tensorflow as tf
#!/usr/bin/env bash
set -CeE
set -o pipefail
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
cat << EOF >&2
WARNING: bash ${BASH_VERSION} does not support several modern safety features.
This script was written with the latest POSIX standard in mind, and was only
tested with modern shell standards. This script may not perform correctly in
this environment.
EOF
@kenthua
kenthua / execute_howto.sh
Last active March 28, 2024 15:04
tinypilot armbian rock64 variation / changes
# https://github.com/mtlynch/tinypilot/blob/master/quick-install
# changes added and noted with pitchdarkice for armbian rock64 support
# geerlingguy.nginx - nginx service restart issues
# mtlynch.tinypilot - service restart issues
# RUNNING HANDLER [mtlynch.tinypilot : restart TinyPilot service] ****************
# fatal: [localhost]: FAILED! => {"changed": false, "msg": "Service is in unknown state", "status": {}}
cat quick-install | bash
# post install checks
sudo apt-get install v4l-utils
@kenthua
kenthua / I2C_LCD_driver.py
Last active May 19, 2024 06:20
16x2 lcd on armbian
# -*- coding: utf-8 -*-
# Original code found at:
# https://gist.github.com/DenisFromHR/cc863375a6e19dce359d
"""
Compiled, mashed and generally mutilated 2014-2015 by Denis Pleic
Made available under GNU GENERAL PUBLIC LICENSE
# Modified Python I2C library for Raspberry Pi
# as found on http://www.recantha.co.uk/blog/?p=4849
#!/usr/bin/python
# coding=utf-8
# "DATASHEET": http://cl.ly/ekot
# https://gist.github.com/kadamski/92653913a53baf9dd1a8
from __future__ import print_function
import serial, struct, sys, time, json
import paho.mqtt.client as paho
def on_connect(client, userdata, flags, rc):
@kenthua
kenthua / data.txt
Created July 1, 2018 20:23
speech api
{
'config': {
'encoding': 'LINEAR16',
'sampleRateHertz': 44100,
'languageCode': 'en-US',
'enableWordTimeOffsets': false,
'enableAutomaticPunctuation': true,
'model': 'video'
},
'audio': {
@kenthua
kenthua / file.sh
Last active June 29, 2018 18:48
print out nodeselectors or jq queries on k8s
#!/bin/bash
for i in $(kubectl get deployments --no-headers=true | awk '{print $1}'); do
echo $i
kubectl get deployment $i -o json | jq .spec.template.spec.nodeSelector
done
@kenthua
kenthua / .tmux.conf
Last active November 15, 2018 01:53
tmux shortcuts
# install tmux TPM
# https://github.com/tmux-plugins/tpm
# RUN:
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# MacOS Copy/Paste
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
# RUN:
# brew install reattach-to-user-namespace
if-shell 'test "$(uname -s)" = Darwin' 'set-option -g default-command "exec reattach-to-user-namespace -l bash"'
sudo apt-get install python-opencv python-picamera python-pil python-dateutil fonts-freefont-ttf
# https://help.ubuntu.com/community/KVM/Managing
lsusb -v
## find ACRUX
create nyko.xml
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x1a34'/>