Skip to content

Instantly share code, notes, and snippets.

View fishkingsin's full-sized avatar
✈️

James Kong fishkingsin

✈️
View GitHub Profile
@fishkingsin
fishkingsin / buildAllRPIExample.sh
Created December 6, 2012 03:58
build All RapsPi openframeworks Examples
#fork from https://gist.github.com/4159230 jvcleave distcc buildscript
#openframework user examples build script
#put the script at $(OF_ROOT)/scripts/linux/debian_armv6l/buildAllExample.sh
cd ../../../examples
for category in $(ls -1d *)
do
if [ $category != "addons" ] && [ $category != "ios" ] && [ $category != "android" ]; then
echo "CHANGED TO CATEGORY >"+$category
cd $category
a=1
folder=$@
target_folder=YOUR_TARGET_FOLDER_TO_PLACE_TIF
mkdir $target_folder/$folder
cd ./$folder
for i in $(ls *.dcm)
do
new=$(printf "%04d.tif" ${a}) #04 pad to length of 4
convert ${i} -auto-level -depth 8 -normalize -resize 50% ${new}
mv ${new} $target_folder/$folder
@fishkingsin
fishkingsin / testApp.cpp
Created December 17, 2012 05:10
matrix cube drawing with openframeworks
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){}
//--------------------------------------------------------------
void testApp::update(){}
//--------------------------------------------------------------
void testApp::draw(){
glPushMatrix();
glTranslated(-8*15,-8*15,-8*15);
for(int i = 0 ; i < 512 ; i++)
@fishkingsin
fishkingsin / replace_spaces.sh
Created December 19, 2012 08:33
replace space in files and folders name of find result
cd ~/
result=$(sudo find ~/ -name *Project)
echo ${result// /\\ }
@fishkingsin
fishkingsin / double_quot_example.sh
Created December 27, 2012 04:36
write find result to temp.txt read each lind with double quot.
#!/bin/bash
target_file="temp.txt"
# process each line
cat "$target_file" |
while read each_line; do
echo "....$each_line"
done
@fishkingsin
fishkingsin / mjpg_streamer.sh
Last active April 1, 2023 17:19
raspberry pi mjpg_streamer startup script
#!/bin/sh
# /etc/init.d/mjpg_streamer.sh
# v0.2 phillips321.co.uk
### BEGIN INIT INFO
# Provides: mjpg_streamer.sh
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mjpg_streamer for webcam
@fishkingsin
fishkingsin / cmdline.txt
Created April 8, 2013 09:22
make raspberry pi boot in silent
sudo nano /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait loglevel=1 logo.nologo
sudo reboot
@fishkingsin
fishkingsin / mjpg_streamer_recorder.sh
Last active December 16, 2015 00:59
recording my home raspberry pi ip cam and convert to mp4 an unix script trap ctrl-c study catch crtl-c and convert by ffmpeg
#!/bin/sh
# zpg - UNCOMPRESS FILE, DISPLAY WITH pg
# Usage: download mjpeg and recording to mp4
PREFIX=$(date +%Y%m%d%H%M%S)
# trap ctrl-c and call ctrl_c()
trap ctrl_c INT
function ctrl_c() {
@fishkingsin
fishkingsin / copy_app.sh
Created April 10, 2013 06:31
coyp raspberry pi files to other
scp -r ./bin/* pi@raspberrypi2.local:~/yucolab/LedWallClient ; scp -r ./bin/* pi@raspberrypi3.local:~/yucolab/LedWallClient
@fishkingsin
fishkingsin / stepper.py
Created April 20, 2013 11:20
raspberry pi stepper motor python script
#-----------------------------------
# Name: Stepper Motor
#
# Author: matt.hawkins
#
# Created: 11/07/2012
# Copyright: (c) matt.hawkins 2012
#-----------------------------------
#!/usr/bin/env python