Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
KScript
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
oshai
January 13, 2020
Technology
26
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
KScript
oshai
January 13, 2020
Transcript
23 slides
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!
More Decks by oshai
See All by oshai
Maintaining an Open Source The Good, Bad & Ugly
oshai
0
39
Klean Code with Kotlin
oshai
0
84
JVM languages shootout - Java, Scala & *Kotlin*
oshai
0
71
Koroutinify ; Lessons learned from applying Coroutines in Kotlin Backend ; Deep dive into Coroutines
oshai
1
140
Klean that Code, Boil those Boilerplates
oshai
2
100
Scala vs. Kotlin; Friend or Foe?
oshai
0
180
No forks, One star. Now what?! — How I published my Kotlin Open-Source lib
oshai
0
92
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
72
Other Decks in Technology
See All in Technology
Gemma4 Hands-on at Nagoya
tsho
0
100
Steering と Hook (チームの決まりを守らせる) | 目指せ Kiro マスター 06
inariku
PRO
2
120
生成AI時代のIAMのマニアックな話
takuros
6
3.2k
顧客合意を取りながら進めるAWSコスト削減の実践
optim
0
170
E2E Test というハーネス — AI時代の自動テスト民主化
daishukojima
1
690
マネジメントされる側の仕事は「文句」を言うこと
riyaamemiya
6
3.9k
田んぼから始まる挑戦 〜新米農家の1年目〜
miu_crescent
PRO
0
360
うちなーぐちが認識できるなら、秋田弁もいけるはず!? Amazon Transcribe方言チューニング検証
ryouto715
1
180
Context != Context: One window, many lifecycles (AI Native DevCon, Nov 2026)
birgitta410
0
140
AWS Emulator を評価する: 手元で動く AWS の API の仕組み、始め方、確かめ方
inariku
PRO
1
550
AI時代における医療情報システムのセキュリティ / Security of Healthcare IT Systems in the AI Era
henryofficial
0
170
内製アプリとClaudeスキルのセキュリティチェック、 Backlogの課題で回しています。
ayaka_egaaa
0
190
Featured
See All Featured
WCS-LA-2024
lcolladotor
0
1k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
Un-Boring Meetings
codingconduct
0
500
Into the Great Unknown - MozCon
thekraken
41
2.8k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
330
Producing Creativity
orderedlist
PRO
348
41k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Deep Space Network (abreviated)
tonyrice
0
410
Are puppies a ranking factor?
jonoalderson
2
4.2k
The SEO identity crisis: Don't let AI make you average
varn
0
630
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
69k