Skip to content

Instantly share code, notes, and snippets.

View machuz's full-sized avatar
💙
foo!

machu machuz

💙
foo!
View GitHub Profile
@machuz
machuz / bulk_ldapadd.sh
Created May 15, 2014 03:26
LDAP登録スクリプト
#!/bin/bash
cn=""
dn=""
ou=""
ldap_password=""
# 一番大きいuidを取得
last_uidnumber=`ldapsearch -x -D cn=$cn -h localhost -w$ldap_password -b ou=$ou | grep uidNumber |awk '{if(m<$2) m=$2} END{print m}'`
@machuz
machuz / 0_fp in scala
Last active December 7, 2015 10:18
fp in scala
-fp in scalaのexercuseの解をUp
@machuz
machuz / a123456.ldif
Last active December 3, 2015 02:05
LDAP環境を簡単にローカルへ構築する ref: http://qiita.com/ma2k8/items/0bba6b62a0ea3deb87cc
dn: uid=a123456,ou=People,dc=hoge,dc=co,dc=jp
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
objectClass: ldapPublicKey
sn: hoge
cn: foo
uid: a123456
uidNumber: 10001
gidNumber: 10001
@machuz
machuz / file0.txt
Last active December 2, 2015 03:11
Mahoutインストール〜Model作成まで ref: http://qiita.com/ma2k8/items/10d44097607525db9893
おはようございます!プログラマーの神様!(T_T)
おはよう プログラマー 代表 神様 t t
@machuz
machuz / file0.txt
Created December 22, 2015 08:36
FP in scala 勉強メモ [PartⅠ 第4章 例外を使わないエラー処理] ref: http://qiita.com/ma2k8/items/64d25b90d83406dfa53d
// Q
リスト4ー4のすべての関数をOptionで実装せよ。
各関数を実装するときに、その関数の意味と、それを使用するであろう状況について考えること。
どの関数をいつ使用するかについては、後ほど考察する。
ヒントは以下のとおり。
- パターンマッチングを使用しても構わないが、
  mapとgetOrElseを除く関数はすべてパターンマッチングに頼らなくても実装できるはずである。
- map,flatMapの実装は、過多シグネチャの情報に基づいて充分に決定できるはずである。
- getOrElseはOptionがNoneのバアアイは、指定されたデフォルト値を返す。
- orElseは、1つ目のOptionが定義されている場合はそれを返し、そうでない場合は2つ目のOptionを返す。
@machuz
machuz / file0.txt
Created January 2, 2016 14:13
FP in scala 勉強メモ [PartⅠ 第2章 Scala関数型プログラミングの準備] ref: http://qiita.com/ma2k8/items/9ecbf03d6a07d79868f4
// Q
n番目のフィボナッチ数を取得する再帰関数を記述せよ。
// answer
def fib(n: Int): Int = {
@annotation.tailrec
def loop(v: (Int,Int), count: Int): Int = {
val (x, y) = v
if (n > count) loop((y,x+y),count+1)
else x
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 8 columns, instead of 1. in line 6.
id,first_name,last_name,email,gender,ip_address,color,company_name
1,Kenneth,Wheeler,kwheeler0@domainmarket.com,Male,54.230.82.29,Khaki,Voonyx
2,Brenda,Young,byoung1@networkadvertising.org,Female,79.121.226.209,Goldenrod,Feedbug
3,Steven,Knight,sknight2@hud.gov,Male,161.79.31.161,Purple,Aimbo
4,Timothy,Daniels,tdaniels3@ovh.net,Male,233.15.252.170,Mauv,Oba
5,Adam,Wright,awright4@cbc.ca,Male,56.247.113.21,Indigo,Kwilith
....
@machuz
machuz / file0.txt
Last active May 29, 2016 14:03
FP in scala 勉強メモ [PartⅠ 第3章 関数型プログラミングのデータ構造] ref: http://qiita.com/ma2k8/items/678b8c3bb698b7ecb244
// Q
以下のマッチ式はどのような結果になるか
scala> val x = List(1,2,3,4,5) match {
| case Cons(x, Cons(2, Cons(4, _))) => x
| case Nil => 42
| case Cons(x, Cons(y, Cons(3, Cons(4,_)))) => x + y
| case Cons(h,t) => h+List.sum(t)
| case _ => 101
| }
## db/_dev.yml.liquid
type: mysql
host: 127.0.0.1
user: user
password: password
database: embulk_test
## query/_query.yml.liquid
query: |
select * from {{ target_table }}
●OS
[ec2-user@ip-172-20-204-91 ~]$ uname -an
Linux ip-172-20-204-91 4.1.7-15.23.amzn1.x86_64 #1 SMP Mon Sep 14 23:20:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
●Embulk
Embulk v0.8.11
●MySQL
5.6.34