This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object IncSeq { | |
| def main(args: Array[String]) { | |
| val result = substrLongestIncSeq("333201299823423234") | |
| println(result) // 0129 | |
| } | |
| def substrLongestIncSeq(str: String): String = { | |
| def rec(nums: List[Char], buf: List[Char] = Nil): List[String] = | |
| nums match { | |
| case Nil => Nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def parse_email_from_stdin(): | |
| """標準入力からメールデータを受け取り、解析して | |
| Message オブジェクトにして返す | |
| """ | |
| parser = FeedParser() | |
| for line in sys.stdin: | |
| parser.feed(line) | |
| return parser.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setopt prompt_subst | |
| autoload -Uz vcs_info | |
| zstyle ':vcs_info:*' actionformats \ | |
| '%F{5}[%F{2}%b%F{7}:%F{6}%r%F{3}|%F{1}%a%F{5}]%f' | |
| zstyle ':vcs_info:*' formats \ | |
| '%F{5}[%F{2}%b%F{7}:%F{6}%r%F{5}]%f' | |
| zstyle ':vcs_info:*' enable git | |
| vcs_info_wrapper() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sealed abstract class Gender | |
| case object Male extends Gender | |
| case object Female extends Gender | |
| case class Person(name: String, age: Int, gender: Gender) | |
| object CaseMatchExample extends App { | |
| val people = List( | |
| Person("yuu", 25, Male), | |
| Person("mizuki", 27, Female), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from fabric.api import env, puts, sudo, settings | |
| from fabric.colors import cyan | |
| DOMAIN_LIST = '%s/.ssh/config' % os.environ['HOME'] | |
| env.use_ssh_config = True | |
| env.disable_known_hosts = True | |
| env.password = 'xxxxxx' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # for fig's bug (https://github.com/docker/fig/issues/553#ref-pullrequest-46182758) | |
| export HOME=/root | |
| cd /root && /usr/local/bin/fig start 2>&1 | logger |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ $# -lt 1 ] | |
| then | |
| echo 'Usage: c INSTANCE_NAME [REMOTE_COMMANDS...]' | |
| exit 1 | |
| fi | |
| pdns=`aws ec2 describe-instances --filters "Name=tag:Name,Values=$1" | jq -r '.Reservations[].Instances[].PrivateDnsName'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INFO : service[circusd] running will change from 'false' to 'true' | |
| DEBUG : service[circusd] enabled will not change (current value is 'true') | |
| DEBUG : Executing `service circusd start`... | |
| DEBUG : exited with 0 | |
| DEBUG : stdout | Starting circusd daemon: /usr/lib64/python2.7/dist-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability. | |
| DEBUG : stdout | _warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning) | |
| DEBUG : stdout | [60G[[0;32m OK [0;39m] | |
| DEBUG : This resource is updated. |
OlderNewer