こんな感じでキー軸を加工して,
こんな感じに配線しなおして,
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication4 | |
{ | |
class Fraction | |
{ |
class Loan[T <: {def close()}] private(resources: T) { | |
def map[U](func: T => U): Option[U] = | |
try { | |
Option(func(resources)) | |
} catch { | |
case ex: Throwable => | |
ex.printStackTrace() | |
None | |
} finally { | |
if (resources != null) |
def append2Immutable(noTimes: Long): Unit = { | |
@scala.annotation.tailrec | |
def go(l: List[Int], i: Long = 0): List[Int] = { | |
if (i > noTimes) l | |
else go(l :+ 0, i + 1) | |
} | |
go(List()) | |
} | |
def append2Mutable(noTimes: Long): Unit = { |
#!/bin/bash | |
log=/home/chinachu/chinachu/log/encode | |
echo -----start encoding @$(date +%Y/%m/%d/%H:%M:%S)----- >> $log | |
start=$(date +%s) | |
echo $1 >> $log | |
ffmpeg -i $1 -vcodec libx264 -acodec libfdk_aac -tune animation ${1%.*}.mp4 2>&1 | grep "^[^f]" >> $log |
git filter-branch -f --commit-filter ' | |
if [ "$GIT_AUTHOR_EMAIL" = "{old email}" ]; | |
then | |
GIT_AUTHOR_NAME="{new name}" | |
GIT_AUTHOR_EMAIL="{new email}" | |
GIT_COMMITTER_NAME="{new name}" | |
GIT_COMMITTER_EMAIL="{new email}" | |
git commit-tree "$@" | |
else | |
git commit-tree "$@" |
package com.chatwork.quiz.collection | |
import com.chatwork.quiz.{MySome, MyNone, MyOption} | |
import scala.annotation.tailrec | |
sealed trait MyList[+A] { | |
// Easy |
public class Named : Person, IImplName { } | |
public interface IImplName | |
{ | |
string Name { get; set; } | |
} | |
public class Person | |
{ | |
public string Name { get; set; } | |
} |
#!/bin/zsh | |
# TODO: impl for two or more additional regexs | |
zparseopts -D -A opts -- i: -iters:=i o: -outliers:=o p: -parallel=p a+: -additional-regex:=a | |
niters=5 | |
noutliers=1 | |
regexs=("$3") | |
local -A opts | |
if [[ -n "${opts[(i)-i]}" ]]; then | |
niters=${opts[-i]} |
implicit class RichMutableMap[K, V](val m: scala.collection.mutable.Map[K, V]) extends AnyVal { | |
def upsert(key: K, insertValue: => V, updateValue: => V => V = null): scala.collection.mutable.Map[K, V] = { | |
if (m.contains(key) && updateValue != null) | |
m.update(key, updateValue(m(key))) | |
else | |
m.update(key, insertValue) | |
m | |
} | |
} |