Skip to content

Instantly share code, notes, and snippets.

View nakaji-dayo's full-sized avatar
🍺

Daishi Nakajima nakaji-dayo

🍺
View GitHub Profile
FROM debian:stretch-slim
# `curl` and `netbase` are needed to connect to the external network
RUN apt-get update -qq \
&& apt-get install -y libpq5 curl netbase
@nakaji-dayo
nakaji-dayo / web-servers.md
Created October 10, 2015 19:23 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
## 洋食
- パスタ
- ナポリタン
- アンチョビトマト
- 味噌
- ボンゴレビアンコ
- フリッツ
## 中華
- チャーハン

test

  • test
  • ooo
    • pop
  • test
    • 0
    • 9
  • 8
@nakaji-dayo
nakaji-dayo / Dockerfile
Created January 10, 2015 20:24
haskell drone.io
FROM bradrydzewski/base
WORKDIR /home/ubuntu
USER ubuntu
MAINTAINER nakaji-dayo <[email protected]>
RUN cd / && \
sudo wget https://www.haskell.org/platform/download/2014.2.0.0/haskell-platform-2014.2.0.0-unknown-linux-x86_64.tar.gz && \
sudo tar -xzvf haskell-platform-2014.2.0.0-unknown-linux-x86_64.tar.gz && \
[Unit]
Description=Keter
After=local-fs.target network.target SuSEfirewall2.service
[Service]
ExecStart=/usr/bin/keter /etc/keter.yaml
[Install]
WantedBy=multi-user.target
portS <- getEnv "PORT"
let port = read portS
runResourceT $ flip runSqlPool pool $ do
runMigration migrateAll
s <- static "static"
warp port $ App s pool
root: /opt/keter
listeners:
# HTTP
- host: "*4" # Listen on all IPv4 hosts
#port: 80 # Could be used to modify port
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
rr = case decode "[{\"key\":\"yahoo\", \"count\": 5},{\"key\":\"google\"}]" of
Nothing -> fail "decode error"
Just v -> (parse parser v) :: Result String
where parser = parseJSON >=> withArray "array" (.!! 0) >=> withObject "object" (.: "key")
(.!!) :: (FromJSON a) => Array -> Int -> Parser a
arr .!! i
| V.length arr >= i = parseJSON $ arr V.! i
| otherwise = fail "hogeeee"