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
Ruby Scripts To Make Life Easier
Search
Paulo Ancheta
December 06, 2016
Programming
150
1
Share
Ruby Scripts To Make Life Easier
Introduction to subprocesses and how to use them for everyday use.
Paulo Ancheta
December 06, 2016
More Decks by Paulo Ancheta
See All by Paulo Ancheta
Demystifying Git
pauloancheta
0
60
A PR Has Been Submitted
pauloancheta
0
60
Other Decks in Programming
See All in Programming
Building on Bluesky's AT Protocol with Ruby
mackuba
0
110
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
160
Kubernetesを使わない環境にもCloud Nativeなデプロイを実現する / Enabling Cloud Native deployments without the complexity of Kubernetes
linyows
3
330
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
330
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
550
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
150
認証統合から始めるフロントエンドの機能単位開発 — マイクロサービス思想の適用
koukimiura
0
100
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
28
19k
Back to the roots of date
jinroq
0
760
エラー処理の温故知新 / history of error handling technic
ryotanakaya
7
1.8k
AI-DLC Deep Dive
yuukiyo
9
5.6k
JAWS-UG横浜 #100 祝・第100回スペシャルAWS は VPC レスの時代へ
maroon1st
0
220
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1370
200k
Evolving SEO for Evolving Search Engines
ryanjones
0
190
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
370
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
140
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.4k
Facilitating Awesome Meetings
lara
57
6.8k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
The Curious Case for Waylosing
cassininazir
0
340
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
190
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