Skip to content

Instantly share code, notes, and snippets.

@espio999
espio999 / container_any.kt
Created October 3, 2022 00:56
defining container with Any type, it sometime requires type cast.
//any型
//どのような型でも受け取るコンテナ
class Container(var value: Any)
//どのような型でも受取、コンテナに詰める
fun packer(value: Any): Container{
return Container(value)
}
//コンテナの中身を確認する
@espio999
espio999 / Roto.kt
Last active October 2, 2022 15:35
Abstract class and Interface, inheritance and override in Kotlin
abstract class BasicRole(name:String){
var name = name
fun attack(){
println("${name}は攻撃した")
}
open fun guard(){
println("${name}は身を守っている")
}
@espio999
espio999 / 42sv2017d01e09.sh
Last active April 30, 2022 01:28
42 SILICON VALLEY Piscine 2017 Day01 Exercise 09
echo $FT_NBR1 + $FT_NBR2 | sed "s/'/0/g" | tr '\\"?!' 1234 | tr mrdoc 01234 | xargs echo 'obase=13; ibase=5;' | bc | tr 0123456789ABC 'gtaio luSnemf'
@espio999
espio999 / 42sv2017d01e07.sh
Last active April 30, 2022 00:15
42 SILICON VALLEY Piscine 2017 Day01 Exercise 07
cat /etc/passwd | cut -d ":" -f 1,2,3,4,6,7 | sed -n 2~2p | cut -d":" -f 1 | rev | sort -r | tr [:cntrl:] "," | sed 's/,/, /g' | rev | cut -c 3- | sed 's/^/./' | rev | tr -d [:cntrl:]
@espio999
espio999 / 42sv2017d01e06.sh
Created April 29, 2022 14:07
42 SILICON VALLEY Piscine 2017 Day01 Exercise 06
ls -l | sed -n 1~2p
@espio999
espio999 / 42sv2017d01e05.sh
Created April 29, 2022 14:03
42 SILICON VALLEY Piscine 2017 Day01 Exercise 05
str1='"\?$*'
str2="'KwaMe'"
str3='*$?\"'
echo '42' > $stt1$str2$str3
@espio999
espio999 / 42sv2017d01e04.sh
Created April 29, 2022 13:53
42 SILICON VALLEY Piscine 2017 Day01 Exercise 04
ifconfig -a | grep 'ether' | cut -n 14-31
@espio999
espio999 / 42sv2017d01e03.sh
Created April 29, 2022 13:48
42 SILICON VALLEY Piscine 2017 Day01 Exercise 03
find . -type f -o -type d | wc -l
@espio999
espio999 / 42sv2017d01e02.sh
Created April 29, 2022 13:41
42 SILICON VALLEY Piscine 2017 Day01 Exercise 02
find . -name "*.sh" | sed 's/.sh//'
@espio999
espio999 / 42sv2017d01e01.sh
Created April 29, 2022 13:35
42 SILICON VALLEY Piscine 2017 Day01 Exercise 01
groups $FT_USER | tr [:blank:] "," | tr -d [:cntrl:]