Skip to content

Instantly share code, notes, and snippets.

View chatchavan's full-sized avatar

Chat Wacharamanotham chatchavan

View GitHub Profile
@chatchavan
chatchavan / SDImage.sh
Last active April 18, 2024 07:11
Create a disk image from an SD card and write the disk image to another SD card (Mac OS X)
#!/bin/bash
### NOTE
# Ideally, you should create an image from small partition (e.g., 4 GB) instead of the whole SD card (e.g., 32 GB).
# For example, an image for Raspbian image should be created by the following procdure:
# (1) Install the official Raspbian image (3.5 GB for Jessie) on an SD card
# (2) Manually expand the partition to a modest size to accommodate your base software (e.g., 4 GB)
# (3) Perform apt-get update and upgrade, install software and configuration that you want.
# (4) Create an image from that (4 GB) partition
#
@chatchavan
chatchavan / OpenCV_OpenNI_Pi.md
Last active February 17, 2021 12:47
Setup OpenCV 2 + OpenNI 1 on Raspberry Pi Wheezy

Requirements

  • Raspberry Pi
  • Raspbian wheezy
  • Access to shell, e.g., via SSH

Initialze Raspbian and utilities for easy access

Note the MANUAL operations below

sudo raspi-config   # MANUAL: expand disk, set password, set locale to US, change the network name
@chatchavan
chatchavan / OpenVNAVI_setup.sh
Last active August 29, 2015 14:28
Additional code required for OpenVNAVI SD card
# These script are specific for OpenVNAVI project
sudo pip install flask
# MANUAL: Setup I2C: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c
# MANUAL: setup Wifi (edimax): http://www.savagehomeautomation.com/projects/raspberry-pi-installing-the-edimax-ew-7811un-usb-wifi-adapte.html
# setup autorun when restart
sudo crontab -e
@chatchavan
chatchavan / CMakeCache.txt
Last active July 29, 2021 02:41
Installing PCL on Raspberry Pi
# This is the CMakeCache file.
# For build in directory: /home/pi/pcl-pcl-1.7.2/build
# It was generated by CMake: /usr/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.
@chatchavan
chatchavan / PCLManualSettings.sh
Last active August 27, 2015 14:55
PCL manual settings on Raspberry Pi
# These settings are obtained from
# pkg-config --print-variables pcl_common-1.7
# pkg-config --variable=libdir pcl_common-1.7
PCL_INCLUDE_DIRS=/usr/include/pcl-1.7
PCL_LIBRARY_DIRS=/usr/lib/arm-linux-gnueabihf
@chatchavan
chatchavan / Chat's email etiquette.md
Last active November 17, 2021 10:25
Thoughts on email communcation

Sending email to Chat

  • Send short emails. (If things are complicated, ask me to get back to you face-to-face or Skype)
  • One topic per email. (If you have some requests about teaching and others about research, send two emails.)
  • Highlight important keywords in bold.
  • If you want Chat to do something:
    • Group all action items together in bullet points at the end of the email.
  • If you want to make an appointment:
    • Propose 3 slots that you are convenient in the email.
  • Attach iCal calendar items
@chatchavan
chatchavan / PDFFirstPages.py
Created November 14, 2015 21:03
Extract the first page of PDF files in the current directory and combine them into a single PDF.
# requires: pip install pyPDF2
from PyPDF2 import PdfFileReader, PdfFileWriter
import os
# prepare output writer
pdfWriter = PdfFileWriter()
# loop reading the first page of each files
for aFileName in [fname for fname in os.listdir(".") if ".pdf" in fname]:
pdfReader = PdfFileReader(open(aFileName, "rb"))
@chatchavan
chatchavan / Image processing test.ipynb
Last active January 8, 2016 23:36
OpenVNAVI Image processing testbed
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chatchavan
chatchavan / README.md
Last active April 27, 2024 20:33
Setup Wifi on Raspberry Pi

Setup Wireless LAN for Raspberry Pi

The following guide describes how to setup Raspberry Pi to connect to Wifi. It was tested on the following environment:

  • Raspberry Pi Model B
  • Edimax EW-7811Un USB Wifi dongle
  • OS: Raspbian Jessie

Here are the overview of the steps:

@chatchavan
chatchavan / RankMatch.rmd
Created November 14, 2016 16:47
Matching pairs of participants based on rank questions.
---
title: "Rank-order matching"
output: html_notebook
---
```{r, include=FALSE}
# Package installation
if (!require("pacman")) install.packages("pacman", repos='https://stat.ethz.ch/CRAN/'); library(pacman)
p_load(combinat)