$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
51
A PR Has Been Submitted
pauloancheta
0
56
Other Decks in Programming
See All in Programming
実はマルチモーダルだった。ブラウザの組み込みAI🧠でWebの未来を感じてみよう #jsfes #gemini
n0bisuke2
2
1.1k
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
140
AWS CDKの推しポイントN選
akihisaikeda
1
240
Cap'n Webについて
yusukebe
0
130
JETLS.jl ─ A New Language Server for Julia
abap34
1
400
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.7k
認証・認可の基本を学ぼう前編
kouyuume
0
200
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
430
AIコーディングエージェント(Manus)
kondai24
0
180
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
150
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
380
Developing static sites with Ruby
okuramasafumi
0
290
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
Writing Fast Ruby
sferik
630
62k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.2k
Building Adaptive Systems
keathley
44
2.9k
For a Future-Friendly Web
brad_frost
180
10k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.2k
Code Reviewing Like a Champion
maltzj
527
40k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.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