Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View niku's full-sized avatar
💭
🍖

KITAMURA Daisuke niku

💭
🍖
View GitHub Profile
defmodule Erlcloudsandbox do
# Elixir で使いやすいように Record を利用するための準備
# http://elixir-lang.org/docs/v1.0/elixir/Record.html
# に書いてあるように Record は単に先頭の要素が Atom である Tuple
# 単に Erlang のレコードを使うだけなら,Elixir で Record 宣言する必要はない.
#
# ただ,Elixir で Record を宣言しておくと,
# http://elixir-lang.org/docs/v1.0/elixir/Record.html#defrecord/3
# に書いてあるような Elixir から名前つきアクセスが便利にできるようになる.
require Record
@niku
niku / wcresult.rb
Last active August 29, 2015 14:02 — forked from smokeymonkey/wcresult.rb
#!/usr/bin/ruby
require 'uri'
require 'net/http'
require 'json'
require 'date'
require 'twitter'
begin
CONSUMER_KEY = 'xxxxx'
@niku
niku / fibcalc.exs
Last active August 29, 2015 13:58 — forked from sandinist/fibcalc.exs
defmodule Fibcalc do
def calc_fibs(list) do
# 今回「プロセスを生成して,生成したプロセスの中で計算して,その結果を送ってもらう」という処理をこれから書く.
# 送ってもらう先は自分になるので,自分のpidを覚えておく.
me = self
# ```[1,2,3] |> Enum.map(fn (elem) -> elem + 1 end)```
# は
# ```Enum.map([1,2,3], fn (elem) -> elem + 1 end)```
# と同じ.|>の左側の結果が,|>の右側の式の第一引数になる.
@niku
niku / flickr_exif.rb
Last active December 18, 2015 01:49 — forked from miio/flickr_exif.rb
require 'flickraw'
require 'exifr'
class ConnectionAdapter
def connection
FlickRaw.api_key = ""
FlickRaw.shared_secret = ""
flickr.access_token = ""
flickr.access_secret = ""
flickr
@niku
niku / mount-ram.sh
Created April 29, 2012 16:55 — forked from koshigoe/mount-ram.sh
Like tmpfs in Mac OSX
#!/bin/sh
# This program has two feature.
#
# 1. Create a disk image on RAM.
# 2. Mount that disk image.
#
# Usage:
# $0 <dir> <size> <volume>
#
@niku
niku / anything-git-project.el
Created March 6, 2012 01:19 — forked from yaotti/anything-git-project.el
List up all files under the control of git and do something (open/view/delete/etc) with them
(defun anything-c-sources-git-project-for (pwd)
(loop for elt in
'(("Modified files (%s)" . "--modified")
("Untracked files (%s)" . "--others --exclude-standard")
("All controlled files in this project (%s)" . ""))
collect
`((name . ,(format (car elt) pwd))
(init . (lambda ()
(unless (and ,(string= (cdr elt) "") ;update candidate buffer every time except for that of all project files
(anything-candidate-buffer))