Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
KScript
Search
oshai
January 13, 2020
Technology
21
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
KScript
oshai
January 13, 2020
More Decks by oshai
See All by oshai
Maintaining an Open Source The Good, Bad & Ugly
oshai
0
37
Klean Code with Kotlin
oshai
0
77
JVM languages shootout - Java, Scala & *Kotlin*
oshai
0
63
Koroutinify ; Lessons learned from applying Coroutines in Kotlin Backend ; Deep dive into Coroutines
oshai
1
130
Klean that Code, Boil those Boilerplates
oshai
2
93
Scala vs. Kotlin; Friend or Foe?
oshai
0
170
No forks, One star. Now what?! — How I published my Kotlin Open-Source lib
oshai
0
81
Scala--pack your Future[T]; Kotlin is coming! (Kotlin TLV)
oshai
0
210
X tips [X==9] for building a Bulletproof Deployment Pipeline with Jenkins
oshai
0
61
Other Decks in Technology
See All in Technology
AWSとGitHub Actionsの責任境界と 組織で安全に使用する取り組み
nealle
1
240
Guerilla InnerSource in enterprises, during the AI hype
onenashev
PRO
0
130
Bet AI Day 2026丨Agentは、「金融」という巨大産業の何を変えられるのか
layerx
PRO
0
510
[RSJ26] Hierarchy-Aware Multimodal Retrieval-Augmented Generation for Embodied Question Answering
keio_smilab
PRO
1
140
hookで自作する Claude Code の「実況ボード」
shinyasaita
2
290
Bet AI Day 2026丨バクラク Autopilot、業務システムの再設計
layerx
PRO
1
780
PdMをやめて、 "プロダクトビルダー"という 働き方に変えました / PdM to Product Builder
shikichee
2
610
少人数データチームのDevin活用実践事例
runandy16
2
140
Introduction to Sansan Meishi Maker Development Engineer
sansan33
PRO
0
470
AIで開発は速くなったのに、なぜ現場は楽にならないのか 〜あなたの組織のボトルネックを突き止めるワークショップ〜
jacopen
1
110
VPCでもFloatingIPを使いたいんだ
y_kotani
1
140
最新技術に積極チャレンジ!EKS共通基盤のこれまでとこれから
daitak
0
290
Featured
See All Featured
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
64k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
400
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
260
The World Runs on Bad Software
bkeepers
PRO
72
12k
Marketing to machines
jonoalderson
1
5.7k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
220
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.3k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
490
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
450
From π to Pie charts
rasagy
0
340
Typedesign – Prime Four
hannesfritz
42
3.2k
Transcript
KScript @OhadShai
My Name is Ohad
And I write scripts in...
Bash
Perl
And you?
Kotlin
fun main() { println("Hello World!") } ››› kotlinc Hello.kt -include-runtime
-d hello.jar ››› java -jar hello.jar Hello World!
println("Hello World!") ››› kotlinc -script helloKotlinScript.kts Hello World!
println(args.joinToString(" ")) ››› kotlinc -script helloKotlinScript.kts Hello World! Hello World!
import java.io.File fun explore(current: File) { println(current.path) if (current.isDirectory) {
current.listFiles().forEach { explore(it) } } } explore(File("../scripts")) ››› kotlinc -script FileExplorer.kts ../scripts ../scripts/requirements.txt ../scripts/pgdump_parser.py ../scripts/pgdump_diff.py ../scripts/update_schema.py ../scripts/.gitignore ../scripts/utils.py ../scripts/README.md
KScript
println("Hello World!") ››› kscript hello.kts Hello World!
println("Hello World!") ››› time kscript hello.kts Hello World! kscript hello.kts
7.33s user 0.78s system 224% cpu 3.608 total ››› time kscript hello.kts Hello World! kscript hello.kts 0.49s user 0.18s system 120% cpu 0.555 total
#!/usr/bin/env kscript println("Hello World!") ››› ./hello.kts zsh: permission denied: ./hello.kts
››› chmod u+x ./hello.kts ››› ./hello.kts Hello World!
Input modes Script > kscript script-file.kts URL > kscript https://git.io/v1cG6
Inline* > kscript 'println("Hi")' REPL > kscript -i test Text Processing > cat some_file | kscript -t 'lines .filter { "^de0[-0]*".toRegex().matches(it) } .map { it + "foo:" } .print() '
kscript Open source created by Holger Brandl for Type Safe
scripts
Major Features Dependencies & Imports @file:MavenRepository("jcenter","http://jcenter.bintray.com" ) @file:DependsOnMaven("net.postgis:postgis-jdbc:2.3.0") @file:DependsOnMaven("com.github.ajalt:clikt:2.3.0")
Major Features Packaging into self executing jar (using Capsule) ›››
kscript --package hello.kts [kscript] Packaging script 'hello' into standalone executable... [kscript] Finished packaging into 'hello'
IDEA bootstrap ➜ ~ kscript ——idea my-script.kts [kscript] Setting up
idea project from my-script.kts
Issues encountered • Dependency resolution did not always work on
my Mac (and errors were sometimes funky) • Auto completion in IDE is not always working as expected.
Questions?
Thanks!