2014-06-01から1ヶ月間の記事一覧

関数ポインタを配列に入れる

クラスに関数を格納するみたいな使い方ができる。http://stackoverflow.com/questions/252748/how-can-i-use-an-array-of-function-pointers #include <stdio.h> void silen1(){printf("silen1\n");} void silen2(){printf("silen2\n");} void silen3(){printf("silen</stdio.h>…

Quadcopter

ESC, brushless motor http://www.rctecnic.com/310-motores-brushless-para-multicopteros-rc コントローラボード http://www.hobbyking.com/hobbyking/store/__19534__HobbyKing_Multi_Rotor_Control_Board_V2_1_Atmega168PA_.html

TaipeiのPrusa i3

STLのファイル一覧がここに載ってる http://diy3dprint.blogspot.com/2013/10/prusa-i3-3d-diy.htmlThingiverseのCollectionに追加 http://www.thingiverse.com/shohei/collections/prusa-i3

トートバッグの作り方

http://cuddly.stay-or-go.net/totebag.html http://cuddly.stay-or-go.net/sin.html http://cuddly.stay-or-go.net/sin.html

Arduino用のキーパッドを作る

http://fukumoto.sakura.ne.jp/blog/uta-kata/2009/11/arduinoled-alarm-timer.html配線イメージ

jQueryでセレクトボックスの全てのoptionを取得する

Antrakのタイトル一覧にWing commanderとかNanaとか入ってて面白かったので抜き出してみる。 http://www.antrakair.com/こうする http://stackoverflow.com/questions/590163/how-to-get-all-options-of-a-select-using-jquery $("select#example").children…

外部USBディスクなどを使わずにWindows8をRefreshする

http://www.techfeb.com/reset-refresh-windows-8-pc-without-any-installation-media/ Windows8のインストールISOを入手してMacで解凍してsources/install.wimを WindowsのC:\Win8にコピーする あとは reagentc.exe /setosimage /path C:\Win8 /target c:\W…

EAGLEでPadのドリル穴の表示/非表示を切り替える

http://web.mit.edu/xavid/arch/i386_rhel4/help/67.htm SET DISPLAY_MODE REAL | NODRILL;

fab modulesを自動化するシェルスクリプト

cutoutrml #!/bin/sh if [ $# -ne 1 ]; then echo "usage: cutoutrml <file.png>" exit 1 fi png_path $1 "fab_mod.path" 1.1 0.79 1 0.5 0.5 0.5 -0.6 -1.7 0.6 path_rml "fab_mod.path" "cutout.rml" 4 1 1.0 0 0 rm fab_mod.path millrml #!/bin/sh if [ $# -ne 1 ]</file.png>…

EAGLEで自動的にポリゴンを貼るスクリプト 

poly.ulp string buf; string Result; real xmax; real ymax; string xmax_str; string ymax_str; board(B){ int xarr[]; int yarr[]; int n=0; B.wires(W) { if (W.layer == 20){ xarr[n] = W.x1; xarr[n++] = W.x2; yarr[n] = W.y1; yarr[n++] = W.y2; n++…

EAGLEで自動でdimensionをリサイズするスクリプト

resize.ulp string buf; string Result; real xmax; real ymax; string xmax_str; string ymax_str; board(B){ int xarr[]; int yarr[]; int n=0; B.elements(E){ xarr[n] = E.x; yarr[n] = E.y; n++; } sprintf(buf,"%d",B.grid.unit); Result += "Grid uni…

EAGLEで部品情報を得るスクリプト

getelem.ulp string Results; string buf=""; string xstring; string ystring; board(B){ int xarr[]; int yarr[]; int n=0; B.elements(E){ Results += "----------\n"; Results += "E name: "+E.name + "\n"; Results += "E value: "+E.value + "\n"; spr…

EAGLEでschematicをインポートするulp

template.ulp string currentdir; string fname; string template; string cmd=""; string fileName=""; template = "~/Documents/eagle/AVR_template/template.sch"; if (schematic) schematic(S) { currentdir = filedir(S.name); fname = filename(S.name…

VimでRead onlyのテキストを保存する

以下のようにする。 http://stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-work :w !sudo tee % >/dev/null.vimrcに以下を追加すると、w!!でコマンドが展開される。 " Allow saving of files as sudo when I forgot to start…

OpenSCADをvimで開発する

OpenSCADをvimで開発したい。 ブラウザでレンダリングするにはOpenJsCADが使える。 プロセスとしては、 1. OpenJSCAD(.scadファイル)をvimで作成、保存 2. なんらかのguard的なfile watcher(scssの更新を監視してcssにコンパイルするやつのイメージ)が更新を…

EAGLEのPNG画像生成を自動化するスクリプト

Homebrewでimagemagickをインストールしておく。 $ brew install imagemagick以下を用意する。 makepng.scr #Create folder for output RUN mkdir-desktop #Make top side png image DISPLAY ALL RATSNEST DISPLAY None DISPLAY Top Pads Vias EXPORT IMAGE …

EAGLEで自動でPNGを生成するコマンド

http://www.instructables.com/id/Automating-Eagle-export-and-preparing-for-printing/?lang=ja例: makepng.scr DISPLAY ALL RATSNEST DISPLAY None DISPLAY Bottom Pads Vias EXPORT IMAGE /mnt/slug_common/progs/eagle_export.png MONOCHROME 600; DISP…

EAGLEで.brdファイル編集中に.schに戻るコマンド

.schを編集していて.boardに移るときは boardでいけるんだけど、逆にBoardからSCHに飛べない。 http://www.element14.com/community/thread/20646/l/changing-between-board-and-schematic を読むと edit .schでいけた。なぜ対称にしなかったのか。

EAGLEで全削除するコマンド

http://www.eaglecentral.ca/forums/index.php/mv/msg/35493/122146/ group all; delete (C > 0 0 );delall.scrでscrフォルダに保存 s delallでコマンドとして使えるようになる。

EAGLEのulp/cam/scrのシンタックスハイライト用Vimプラグイン

を作った。 https://github.com/shohei/vim-eagle-ulp https://github.com/shohei/vim-eagle-cam https://github.com/shohei/vim-eagle-scrインストール法 .vimrc NeoBundle 'shohei/vim-eagle-ulp' NeoBundle 'shohei/vim-eagle-cam' NeoBundle 'shohei/vim…

EAGLE CADでYahoo! newsを読む

EAGLE CADで仕事中にYahoo news!を読みたくなることがあると思います。 いちいちブラウザを立ち上げなくてもEAGLEの内部で見れたら便利です。以下をynews.ulpという名前で保存して、EAGLEのアプリケーションフォルダの下にある ulpフォルダに置いてください…

ユーザーをグループに追加する

http://stackoverflow.com/questions/7537197/add-user-to-group-but-not-reflected-when-run-id mattユーザーをstaffグループに追加する $ sudo usermod -a -G staff matt してから再起動。

Ubuntのリカバリーモードで入った時にディスクをマウントする

http://askubuntu.com/questions/120153/how-to-change-read-only-file-at-root-prompt # mount -o remount,rw /

AndroidでHTTP POSTリクエストでrailsのAPIサーバにmultipartで画像を送るときはFileBodyではなくFileInputStreamを使う

表題の通り。 FileBodyで送ると、UTF8を指定してもなぜか画像のデータが文字化けして送られるので railsからInvalid byte sequence in utf8が返ってくる。参考: https://groups.google.com/forum/#!topic/android-sdk-japan/zi-voNmjC6k http://d.hatena.ne…

CurlでPOSTデータを送る

JSON形式で送るとき https://www.google.co.jp/search?q=wget+post+%E3%83%AA%E3%82%AF%E3%82%A8%E3%82%B9%E3%83%88&ie=utf-8&oe=utf-8&aq=t&hl=ja&gws_rd=ssl#hl=ja&q=curl+json+post+ curl -v -H "Accept: application/json" -H "Content-type: applicatio…

Androidのアイコンジェネレータ

超便利だったのでメモ。http://romannurik.github.io/AndroidAssetStudio/icons-launcher.html

さくらVPSのCentos上のGNOMEデスクトップにMacからVNCで接続する

ネットワーク設定 http://blog.inouetakuya.info/entry/20111211/1323605040GNOMEのインストールはここ http://morrey22.hatenablog.com/entry/2013/04/14/212837日本語入力設定 .vnc/xstartupに追加 export GTK_IM_MODULE=scim export QT_IM_MODULE=scim ex…

FreeCADのメモ

FreeCAD - PythonやOpenSCADとの連動 Assemblyが完全じゃない? CAE Linux - エンジニアリングパッケージを組み込んだLinuxディストリビューション Salome6 - シェル解析ソフト?FreeCAD使い方メモ http://blog.livedoor.jp/blackcode/archives/1863422.html…

EAGLE UPのプラグインの修正

なんかうまく環境変数を取得してないので手動で修正した。 $ cd ~/Library/Application\ Support/SketchUp\ 2013/SketchUp/PluginseagleUp_import.rb line 154あたり ... case elements[0] when "settings" #model_path = initial_elements[1] #コメントアウ…

Fab modulesの設定パラメータ

mill trace(1/64)のときに径を0.2、cut out board(1/32)のときに径を0.5にするとうまくいくっぽい。