Skip to content

Instantly share code, notes, and snippets.

View luzhuomi's full-sized avatar

Kenny Lu luzhuomi

View GitHub Profile
@luzhuomi
luzhuomi / pocketchip_debian10.md
Last active April 16, 2024 13:05
A tutorial to upgrade NXT pocket C.H.I.P to Debian Buster

Pocket Chip Debian 10 Upgrade Guide

The purpose of this tutorial is to walk through the required steps to upgrade NXT chip (or pocketchip) from debian jessie to debian buster.

If you would like to start your Chip from scratch, follow the steps in the Preparation section.

Preparation (Optional)

A linux host machine, recommended Ubuntu 18.04. However I managed to do it with 20.10 with some tweak.

@luzhuomi
luzhuomi / cello.md
Last active April 30, 2019 10:16
setup cello in Ubuntu 18.04

Setup Cello

For VirtualBox

Master:

  • eth0: nat
  • eht1: internal 192.168.0.2

Worker:

description: Desktop Computer
product: Default string (Default string)
vendor: Default string
version: Default string
serial: Default string
width: 64 bits
capabilities: smbios-3.0 dmi-3.0 smp vsyscall32
configuration: boot=normal chassis=desktop family=Default string sku=Default string uuid=00020003-0004-0005-0006-000700080009
*-core
description: Motherboard
@luzhuomi
luzhuomi / Dtw.hs
Last active August 29, 2015 14:06
DTW optimization with lazy evaluation
module Dtw where
import Data.Array
-- optmized using lazy evaluation, not using array
dtw :: Eq a => [a] -> [a] -> (a -> a -> Int) -> Maybe Int
dtw [] _ _ = Nothing
dtw _ [] _ = Nothing
dtw a b diff =
let
int[] a = { 1, 3, 4, 5,12, 3, 8 ,10, 10000, 12003 } ;
int result = 1;// 1 is the identify of the integer product
for ( int i = 0; i <= a.length ; i ++ ) {
result = a[i] * result;
}
@luzhuomi
luzhuomi / show_me_your_pi_ip.sh
Created November 1, 2013 05:48
Make Your Pi to read out its ip address
# install espeak
# sudo apt-get install espeak
# include the following command in your /etc/rc.local
/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' | sudo espeak
public class BitOp {
public static byte setBit(byte input, int pos) {
// this sets the bit of the input byte to be 1 at the position pos.
if (pos < 8) {
byte output = (byte)(input | (1 << pos));
return output;
}
else {
return input;