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
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
Transcript
13 slides
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
More Decks by Paulo Ancheta
See All by Paulo Ancheta
Demystifying Git
pauloancheta
0
72
A PR Has Been Submitted
pauloancheta
0
63
Other Decks in Programming
See All in Programming
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
610
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
6
2.3k
Railsバージョンを4倍にした話
optim
0
1k
Spec-driven Development with AI
simas
PRO
0
2.3k
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
370
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.5k
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
260
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
5
850
LLM 101
dalinaum
0
480
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
260
Vapor Mode でアクセシビリティは 壊れないか検証した話
fuqda
1
340
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
310
Featured
See All Featured
Between Models and Reality
mayunak
4
580
Speed Design
sergeychernyshev
33
2.2k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
470
Rebuilding a faster, lazier Slack
samanthasiow
85
9.8k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
400
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Prompt Engineering for Job Search
mfonobong
0
580
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
990
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Building an army of robots
kneath
307
47k
Documentation Writing (for coders)
carmenintech
77
5.6k