2013-01-01から1年間の記事一覧

Autodesk Inventorで溝のついた箱を設計する(レーザーカッター切断用)

http://www.instructables.com/id/Using-Autodesk-Inventor-to-create-a-notched-wood-c/レーザーカッターでは端が削れる分のマージンを持たせてDXFを設計しないといけない。 なんやかんやで以下の図形ができたとする。 これにマージン(Kerfというらしい)…

JavaScriptで登録者数の加算

配列に対して使えるreduceというメソッドがあった https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Example.3A_Sum_up_all_values_within_an_array JavaScriptコンソール var doc = jQuery(".graytable2 tbody…

Androidエミュレータの高速化

http://green-fld.jp/landinggear/?p=146

ターミナルで巨大文字を打つfiglet

http://blog.azumakuniyuki.org/2011/05/figlet.htmlhomebrewでいけた。 $ brew install figlet

PololuステッピングモータドライバDRV8825の電流制限

Current limitの設定をせずに回していたら水蒸気が立って焼けた。 電流制限を超えた時は出力ピンが周期的に振動するのでわかる。Current limitの設定 http://www.pololu.com/product/2133 Current limiting To achieve high step rates, the motor supply is…

PololuステッピングモータドライバDRV8825とA4988の違い

http://www.pololu.com/product/2132・DRV8825はディスコンになった (追記)ディスコンになったのは古いほうだった(md20a) 旧)http://www.pololu.com/product/2133 新)http://www.pololu.com/product/2132・A4988にはFAULTがない ・DRV8825のSLEEPはプ…

OpenCVでGUIを使うhighgui

main.cpp /*! \example example_4-1.cpp スクリーンにマウスで矩形を描画するサンプル \author Satofumi KAMIMURA $Id$ */ #include <highgui.h> #include <cv.h> namespace { const char* window_name = "Box Example"; CvRect box_; bool is_drawing_box_ = false; void dra</cv.h></highgui.h>…

ターミナルで画像サイズの変換

sipsコマンドを使う $ sips -z 300 300 image.jpg

Nite2のインストール

環境はOSX MavericksNiTE-MacOSX-x64-2.2/Samples/SimpleUserTrackerをビルドしてみるMakefileに以下を追加 LIB_DIRS += /usr/local/lib/nite2 #libNite2.dylibがあるフォルダmain.cppを修正してビルド - #include <NiteSampleUtilities.h> + #include "NiteSampleUtilities.h" NiTE</nitesampleutilities.h>…

ターミナルからArduinoに書き込む方法

Upload時に走るコマンドは、ArduinoIDEの出力メッセージを見ると以下のようになっている。 /Applications/Arduino1.0.5.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino1.0.5.app/Contents/Resources/Java/hardware/to…

Arduinoのアップロード時の挙動

avrdude: Version 5.11, compiled on Sep 2 2011 at 18:52:52 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 Joerg Wunsch System wide configuration file is "/Applications/Arduino1.0.5.app/Contents/Resources…

Arduinoのbootloaderの動作について

http://electronics.stackexchange.com/questions/2603/i-dont-get-the-arduino-conceptブートローダはあらかじめ書き込まれているファームウェア。 ArduinoではISP経由ではなく、シリアル(UART)経由でHEXを受け取り AVRのSelf programming機能を使ってブ…

Grblのビルド

avr-gcc -Wall -Os -DF_CPU=16000000 -mmcu=atmega328p -I. -ffunction-sections -c main.c -o main.o avr-gcc -Wall -Os -DF_CPU=16000000 -mmcu=atmega328p -I. -ffunction-sections -c motion_control.c -o motion_control.o avr-gcc -Wall -Os -DF_CPU=1…

OpenNI2のビルド(要OpenCV)

http://qiita.com/mountcedar/items/6d97efc0ea6c68c7674f main.cpp #include <OpenNI.h> #include <opencv2/opencv.hpp> #include <vector> int main() { try { openni::OpenNI::initialize(); openni::Device device; int ret = device.open( openni::ANY_DEVICE ); if ( ret != openni::STATUS_O</vector></opencv2/opencv.hpp></openni.h>…

Marlinのビルド解読

##### C++ ビルド ##### avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -Icores/arduino -Ivariants/mega -IWire -IU8glib -ILiquid…

Arduinoのコンパイルメッセージを解読する

PreferencesでCompile時にVerboseメッセージを出力するように設定してからコンパイル /Applications/Arduino1.0.5.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu…

libusbでUSB通信するプログラム

ホスト側 main.c #include <usb.h> #include <stdio.h> #include <string.h> unsigned short IDVendor = 0x1384; //MUST BE CHANGED unsigned short IDProduct = 0x8888; //MUST BE CHANGED static int usbOpenDevice(usb_dev_handle **device, int idvendor, int idproduct) { struct </string.h></stdio.h></usb.h>…

SSHでリバースポートフォワードのテスト

まだ途中だけどメモ。 http://blog.kteru.net/archives/479リモートの8022をローカルの22番に転送したい。@ローカル $ ssh -N -R 8022:127.0.0.1:22 user@HostIP -p PORT_NUM -i ~/.ssh/SECRET_SSH_KEY /etc/hosts.allowに追加 sshd : all/etc/sshd_config…

Rで日本語をプロットする

~/.Rprofileを作って設定が必要とのことhttp://ameblo.jp/kazu-nakamata/entry-11551319335.htmlhttp://d.hatena.ne.jp/MikuHatsune/20120428/1335544822

mkdirしてそのフォルダに移動する

$_で直前のコマンドの最後の引数を取得できる $ mkdir newdir ; cd $_

awk、sedでワンライナー

こんなかんじで書けて面白い。自分のよく使うコマンド上位10種類 $ history | awk '{print $2}' | sort | uniq -c | sort -n -r | sed '10q' 1274 emacs 1131 cd 811 ls 637 git 368 sudo 305 python 283 mkdir 282 mv 245 rails 239 brew

Centos6.5にPerlbrewをインストールする

http://perlbrew.pl $ curl -L http://install.perlbrew.pl | bash.zshrcに以下のPATHを追記 ~/perl5/perlbrew/bin/ Munin用にperl5.8.8をインストール $ perlbrew install perl-5.8.8ビルドでコケた

Perlでワンライナーを書く

http://blog.livedoor.jp/dankogai/archives/51026593.htmlまずはawkっぽい書き方から覚えていこう $ ps aux | perl -anle 'print $_' $ ps aux | perl -anle 'print $F[1]'a: awkっぽく書ける ($Fが使える?) n: 一行ずつ処理 l: 強制改行 rubyのputs的な…

EmacsでTCP/UDP通信する

open-network-streamでTCP通信を張れるEmacsでiTunesを操作する方法 http://news.gehirn.jp/dev/483/

秘密鍵(id_rsa)から公開鍵(id_rsa.pub)を作る

http://www.tempest.jp/linux/fedora/documents/text201.html

コンストラクタの初期化とメンバ変数の初期化

これどういうルールだったか忘れたロベールのp.647 #include<iostream> using namespace std; class ABase { public: ABase() : m_x(0) {} //このコンマなんだっけ virtual ~ABase() {} void Set(int x){ m_x = x;} protected; int m_x; } ロベール本 pp.351-353 コン</iostream>…

Emacsでメジャーモードを書く

http://www.gentei.org/~yuuji/elisp/elisplec.html#SEC1emacs起動 $ emacsC-x bでデフォルトのバッファであるscratchバッファが起動 (C-x C-bやC-x C-fで開くのもOK) ;; This buffer is for notes you don't want to save, and for Lisp evaluation. ;; If …

EC2にEBSを追加する

https://github.com/mechamogera/MyTips/wiki/EBSをEC2にマウントしてみるEBSを作成し、AWSコンソールからインスタンスにアタッチしてある状態(今回は/dev/sdfにアタッチ) $ sudo mkfs -t ext4 /dev/sdf $ sudo mkdir /ebs $ sudo mount /dev/sdf /ebsで/e…

gtags, htagsの使い方

http://uguisu.skr.jp/Windows/gtags.html $ gtags $ htags -saFでHTML/index.htnlが生成される

Qtの使い方

qtは $ brew install qtでインストール。環境はOSX 10.9 Mavericks, XCode 5.0.2 Qt 4.8.5をインストール。 (昔パッケージインストーラでインストールしたQtは削除しておいた。 /Developer/Appilcations/と/Library/Frameworksに色々と入っていたのを手動で…