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
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
55
A PR Has Been Submitted
pauloancheta
0
57
Other Decks in Programming
See All in Programming
Python’s True Superpower
hynek
0
200
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
160
「やめとこ」がなくなった — 1月にZennを始めて22本書いた AI共創開発のリアル
atani14
0
360
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
320
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.6k
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
370
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
120
maplibre-gl-layers - 地図に移動体たくさん表示したい
kekyo
PRO
0
210
nuget-server - あなたが必要だったNuGetサーバー
kekyo
PRO
0
200
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
13
7.7k
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
670
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
210
Featured
See All Featured
Claude Code のすすめ
schroneko
67
220k
Unsuck your backbone
ammeep
672
58k
AI: The stuff that nobody shows you
jnunemaker
PRO
3
360
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
320
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
210
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Rails Girls Zürich Keynote
gr2m
96
14k
Utilizing Notion as your number one productivity tool
mfonobong
4
250
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
130
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
190
The Pragmatic Product Professional
lauravandoore
37
7.2k
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