$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby Scripts To Make Life Easier
Search
Paulo Ancheta
December 06, 2016
Programming
1
140
Ruby Scripts To Make Life Easier
Introduction to subprocesses and how to use them for everyday use.
Paulo Ancheta
December 06, 2016
Tweet
Share
More Decks by Paulo Ancheta
See All by Paulo Ancheta
Demystifying Git
pauloancheta
0
50
A PR Has Been Submitted
pauloancheta
0
56
Other Decks in Programming
See All in Programming
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
330
dotfiles 式年遷宮 令和最新版
masawada
1
710
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
120
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
37
25k
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
250
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
690
エディターってAIで操作できるんだぜ
kis9a
0
690
sbt 2
xuwei_k
0
240
CSC305 Lecture 17
javiergs
PRO
0
340
connect-python: convenient protobuf RPC for Python
anuraaga
0
370
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
570
ローターアクトEクラブ アメリカンナイト:川端 柚菜 氏(Japan O.K. ローターアクトEクラブ 会長):2720 Japan O.K. ロータリーEクラブ2025年12月1日卓話
2720japanoke
0
720
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
A designer walks into a library…
pauljervisheath
210
24k
Six Lessons from altMBA
skipperchong
29
4.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
700
Being A Developer After 40
akosma
91
590k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Thoughts on Productivity
jonyablonski
73
5k
How STYLIGHT went responsive
nonsquared
100
5.9k
Transcript
Ruby Scripts to Make Life Easier #MakeRubyGreatAgain
@PauloAncheta
We make alias-es all the time. We should make something
more useful.
# talk.rb system “echo hello world” $ ruby talk.rb hello
world
# talk* #! bin/env ruby `echo hello world` $ mv
talk.rb talk $ chmod u+x talk $ ./talk hello world
# talk* #! bin/env ruby string = “hello world” `echo
#{string}` $ ./talk hello world
# talk* #! bin/env ruby string = “hello world” `echo
#{string.gsub(/world/, “VanRuby”) } | grep file.txt` $ ./talk | more file.txt hello VanRuby
$ irb irb(main):001:0> files = `ls` => “Applications\nDesktop\nDocuments\nDow nloads\nLibrary\nMovies\nMusic\nPictur es\nPublic\ntalk\n”
irb(main):002:0> files.class => String
irb(main):003:0> system `ls` => true
All of that is great. How can I be productive
doe?
# clean-pg* #! bin/env ruby pg = `ps aux |
grep postgres | grep waiting` pg = pg.split(/\n/) pg.each do |waiting| # ... some process to get the pid `kill #{pid}` end
# split-branch* #! bin/env ruby # commits => 1z2y3 TICKET-number
msg specific_commits = `git log - -pretty - -oneline | grep #{ARGV}` `git checkout master && git pull origin master && git checkout -b test-branch` specific_commits.each do |commit| sha = commit[0..6] # => [123asdf, qwer456, … ] `git cherry-pick #{sha}` end
#MakeRubyGreatAgain