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

haskellでunix-timeの強制インストール

scottyとかのフレームワークがunix-timeに依存してるのでインストールしたい. https://github.com/kazu-yamamoto/unix-time autotoolsでconfig.hを生成できないのでインストールできなかった アレな方法でインストールしたのでその手順1. git clone https:/…

Haskellでhttpリクエスト

html-conduitを使う https://www.fpcomplete.com/school/starting-with-haskell/libraries-and-frameworks/text-manipulation/tagsoup import Network.HTTP.Conduit (simpleHttp) import qualified Data.ByteString.Lazy.Char8 as L url = "http://www.bing.…

Haskellで文字列のSplitその2

Data.Listのwords関数がそれっぽい挙動をしている https://downloads.haskell.org/~ghc/7.4.1/docs/html/libraries/base/src/Data-List.html import Data.Char ( isSpace ) words :: String -> [String] words s = case dropWhile {-partain:Char.-}isSpace …

Haskellで文字列のsplit

isAlphaで判別する方法 import Data.Char main = do print $ filter (all isAlpha) . words $ "one , Two"

HaskellのData.List.SplitのsplitOnの実装

自分でsplitを実装できなかったのでソースを見てみた. もっと簡潔に実装できないのか {-# OPTIONS_HADDOCK prune #-} ----------------------------------------------------------------------------- -- | -- Module : Data.List.Split.Internals -- Copy…

Edisonの使い途

Intel Edisonが良いという話を聞いたPapilio DUO(Or Pro), あるいは安価なCPLDと協調して カメラ画像とネットワークを組み合わせた感じのものが作れそう 落ち着いたらFPGA上での並列計算もやってみたい

MacでGTKのテーマを変更する

http://kazblog.hateblo.jp/entry/2014/02/24/004547

gitでリモートブランチの一覧を表示する

http://gitready.com/intermediate/2009/02/13/list-remote-branches.html git fetch git branch -r git branch -a

haskellのWebフレームワーク

unix-timeがビルドできないおかげで 使えるフレームワークがない試したもの yesod happstack happstack-lite snap simplehttp://stackoverflow.com/questions/5740746/haskell-web-framework ビルドできたのはHappstackだけだった sandbox installだと読めな…

herokuでnode.jsを動かすときのポート指定

http://stackoverflow.com/questions/15693192/heroku-node-js-error-web-process-failed-to-bind-to-port-within-60-seconds-of ポートは動的に割り振られるので決め打ちではなく 以下のようにする .listen(process.env.PORT || 5000)

MacにHaskellをインストール

Haskellのインストールのベストプラクティスがわからない とりあえず $ brew install ghc cabal-install してみた その後 $ cabal install cabal-install $ cabal update やっぱりうまくいかないのでこれを使ってみた http://www.reddit.com/r/haskell/comme…

texの目次にリンクを貼る

http://tex.stackexchange.com/questions/73862/how-can-i-make-a-clickable-table-of-contents \usepackage{color} %May be necessary if you want to color links \usepackage{hyperref} \hypersetup{ colorlinks=true, %set true if you want colored lin…

ムービーの例

会社だと好きなのはGitHub ドキュメンタリーだとMatt あと友達どうしで旅行に行ったやつ 編集が神だった 10分の尺だとフルにBGMを入れるのは緩急がなくてだれそう. 1分の尺だとPopFabは好き 入れたい音楽 ・Blink182 all the small things, 若気な音楽 ・Ga…

JavaScriptのquerySelectorAll()でイテレータを回す

http://ptech.g.hatena.ne.jp/noromanba/20120521/1337639496 querySelectorAllで取れるDOMはobjectなのでArrayのメソッドが効かない Array.prototype.forEach.call(document.querySelectorAll('span'), function(node) { console.log(node); }); とか Array…

Sublime Text2を起動するシェル関数

function subl(){ if [ $# -ne 1 ];then echo "#usage: subl <file or dir>" return fi cmd="/Applications/Sublime\ Text\ 2.app/Contents/MacOS/Sublime\ Text\ 2 "$1" &" eval $cmd }</file>

dockerのコマンド

http://qiita.com/curseoff/items/a9e64ad01d673abb6866

perlでrepl

http://blog.64p.org/entry/20110214/1297649579 tinyreplを使う $ cpanm install Eval::WithLexicals $ tinyrepl

git diffの使い分け

http://stackoverflow.com/questions/1587846/how-do-i-show-the-changes-which-have-been-staged $ git diff $ git diff --staged $ git diff --cached #上と同じ $ git diff HEAD

対応するHTMLタグをハイライトするVIMプラグイン

https://github.com/gregsexton/MatchTag

Pythonでスネークケースに変換する

http://d.hatena.ne.jp/tbpg/20130624/1372079671

GoでSimpleHTTPServer的な静的ホストのサーバを立てる

https://hecticjeff.net/2013/07/17/golang-static-http-file-server/ // httpserver.go package main import ( "flag" "net/http" ) var port = flag.String("port", "8080", "Define what TCP port to bind to") var root = flag.String("root", ".", "Def…

GitLabでアバターが表示されないとき

https://github.com/gitlabhq/gitlabhq/issues/5430 ホームディレクトリに権限を与える gitユーザーのホームディレクトリ確認 sudo cat /etc/passwd | grep git > git:x:503:503::/var/opt/gitlab:/bin/sh/var/opt/gitlabの権限変更 sudo chmod -R o+x /var/…

CentOSにGitLabのインストール

まずはここを参考に rpmで入れる SSHポートの変更も http://qiita.com/yu_0105/items/d41675c75a9916bc1cd6Apacheとnginxを共存させる nginxのlistenは8081番ポートにした 8080番ではunicornが走る http://mojavy.com/blog/2014/03/11/latest-gitlab-setup/…

herokuでslack用のhubotを動かす

https://github.com/slackhq/hubot-slack slackのIntegration SettingsでAPI Tokenを生成する npm install -g hubot coffee-script yo generator-hubot mkdir -p /path/to/hubot cd /path/to/hubot yo hubot npm install hubot-slack --saveProcfile web: bi…

hubotのインストール

http://qiita.com/kmdsbng/items/fdc069048b5f0d07295e npm install -g hubot coffee-script npm install -g yo generator-hubot mkdir -p myhubot yo hubot

git diffでvimdiffを使う

http://sgry.jp/blog/2014/11/24/1811/ git diffでは通常のページャ,git difftoolでvimdiffを使いたい場合 git config --global diff.tool vimdiff git config --global difftool.prompt false git config --global merge.tool vimdiff git config --global…

git logでページャ(less)を起動するもコンソールに出力は残す

logでコミットhash調べても消えるのが問題だった less -F -Xオプションでコンソールに出力が残るらしい git config --global --replace-all core.pager "less -F -X"

PostgreSQLの再起動

http://stackoverflow.com/questions/6950395/postgresql-server-wouldnt-shutdown-on-lion-mac-os-10-7 launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist rm ~/Library/LaunchAgents/org.postgresql.postgres.plist #pg_ctl -D /…

node-webkitのYoジェネレータを使う

https://www.npmjs.org/package/generator-node-webkit npm install -g generator-node-webkit yo node-webkitいちいちバイナリをダウンロードするのは無駄なので省略する. ビルド grunt mac-distで失敗させといて,出来たフォルダに既存のnode-wbkit.appア…

Gruntfile.jsの生成

http://stackoverflow.com/questions/18745278/how-to-initialize-gruntfile-js https://github.com/gruntjs/grunt-init-gruntfile grunt-init npmとgrunt-init-gruntfileテンプレートを使う. npm install -g grunt-init git clone https://github.com/grun…