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
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
63
A PR Has Been Submitted
pauloancheta
0
62
Other Decks in Programming
See All in Programming
信頼性の目標を誰も求めてない
shubox
0
480
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
350
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
0
170
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
110
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
110
Deep dive into the select statement (GopherCon UK)
jespino
0
170
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
250
FDEとは、何者なのか?
masapyon1212
0
130
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
1
430
「つくるAI」だけではバグは見つからない ~テストに必要な「見つけるAI」を分離させる戦略~
mfunaki
0
230
AIを上手に使っていこうとしたら越境せざるを得なくなった話 〜実践1年で見えた境界を越えなければならない理由と進め方〜 / Crossing borders with AI
tomoyakitaura
2
990
Press start. Python's next generation.
willingc
PRO
3
300
Featured
See All Featured
Everyday Curiosity
cassininazir
0
310
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
490
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
270
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Thoughts on Productivity
jonyablonski
76
5.4k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
460
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.6k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
Practical Orchestrator
shlominoach
191
12k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
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