Coder Social home page Coder Social logo

jakewmeyer / ruby-scripts Goto Github PK

View Code? Open in Web Editor NEW
245.0 245.0 34.0 115 KB

A collection of ruby scripts for those who live in the command line

License: MIT License

Ruby 100.00%
crypto cryptocurrency currency-converter hyperjs movies ruby ruby-script scripting stock-market weather zsh

ruby-scripts's People

Contributors

codacy-badger avatar jakewmeyer avatar sethkrasnianski avatar vitorgalvao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-scripts's Issues

Add smart searching to currency converter

Ex. someone types in "united states", it would return "USD", in case the person doesn't know the currency symbol, but knows the name of the country.

Looking for a solution here

allow command arguments and machine-readable output

I have a suggestion that would help the commands be more useful to those creating scripts. It would also help the commands be used together in interesting ways.

Right now, many of them are interactive. They take an argument but you can't provide it as a command argument, you have to wait until the command runs and then you're prompted. For example, with ip_geo, you're prompted what IP address you want. I noticed the stock and currency commands work this way too.

What I think would work better is if the command also allowed you to specify the argument as you run it, to avoid being prompted, for example. I could run ip_geo like:

ip_geo 123.234.345.456

and get its output.

To go along with this, it would be neat if we could use options for the commands to make them only output pieces of data, so that they could be piped into other commands (perhaps even other Ruby-Scripts commands). For example, I could use an option for only outputting the WAN IP from ip_list and use it this way, with ip_geo (-m for "machine output" etc):

ip_list -m wan | xargs ip_geo -m isp

...and I'd end up with only my ISP name in stdout.

What I envision is a sort of syntax with an option (like my -m option above) to specify which output values you'd want. Perhaps, with ip_list, the option -m wan,lan1 would print just the WAN address followed by the first LAN address, with a default delimiter (maybe a space). If all the commands were built this way, they could be combined in interesting ways.

Code style - puts without arguments and using a class perhaps for shared code

Heya Jake,

I think you can safely omit the arguments to puts, in other words,

puts ''

should be equivalent to:

puts

If you want to you can also use something such as:

alias e puts

To make things even shorter. Anyway, it's great that you published code,
several of the code I have not ever thought about, such as encrypt, but
also the weather API showing more information than temperature (I
had a very simple weather script but only for local use in my country
and only the temperature; I never had the idea to include wind etc...)

By the way, I have noticed that you used the same banner for many
scripts. You can probably write this into a shared code, or into a
class and re-use that class. This may be a bit extra work since your
code is very simple so not really a need to do so, but if you intend
to add more code into your project there, I think it may be easier for
you to keep things more organized, and classes do help a lot here in
ruby. Feel free to close this issue at any moment in time, I just wanted
to give some feedback!

Script that looks at crime data based on location

Writing a script that looks at the publicly available crime records so determine the amount of crime near your current location. Good exercise in interpretation of data, and interacting with a rest-api.

Gem

Hello Jake,

Following my comment on reddit, I would like to suggest to you that you may put these scripts also into a gem. That way others can also do "gem install " easily.

LoadError with all commands

When I try to use any of the commands from this gem, I get an error message mentioning a LoadError:

[mwelke@mdesk-arch ~]$ weather
/home/mwelke/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rest-client (LoadError)
        from /home/mwelke/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/mwelke/.rvm/gems/ruby-2.4.1/gems/jake-scripts-0.2.0/exe/weather:4:in `<top (required)>'
        from /home/mwelke/.rvm/gems/ruby-2.4.1/bin/weather:23:in `load'
        from /home/mwelke/.rvm/gems/ruby-2.4.1/bin/weather:23:in `<main>'
        from /home/mwelke/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
        from /home/mwelke/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'

Setup:

  • Antergos with all system updates as of today.
  • Intel Core i5 CPU

Script that runs a internet speed test in the CLI

Something along the lines of Speedtest-CLI but implemented in a ruby-ish sort of way. Currently looking for an API that would support this type of functionality, but had zero luck thus far. Could possibly look into building the platform myself, but I need to do more research before committing to that implementation.

Typo

weather.rb, lines 46 and 66

visibility, not visability

Will submit a PR if you want, on mobile currently.

WAN SSL Error handling

I get the following error when running netgeo -w

☁  provision [master] ⚡ netgeo -w
/Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rest-client-2.0.2/lib/restclient/request.rb:758:in `rescue in transmit': SSL_connect returned=1 errno=0 state=error: certificate verify failed (RestClient::SSLCertificateNotVerified)
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rest-client-2.0.2/lib/restclient/request.rb:647:in `transmit'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rest-client-2.0.2/lib/restclient/request.rb:145:in `execute'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rest-client-2.0.2/lib/restclient/request.rb:52:in `execute'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rest-client-2.0.2/lib/restclient.rb:67:in `get'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/netgeo-0.1.0/exe/netgeo:25:in `block (2 levels) in netgeo'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/slop-4.3.0/lib/slop/option.rb:60:in `call'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/slop-4.3.0/lib/slop/option.rb:60:in `ensure_call'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/slop-4.3.0/lib/slop/parser.rb:95:in `process'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/slop-4.3.0/lib/slop/parser.rb:102:in `try_process'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/slop-4.3.0/lib/slop/parser.rb:61:in `block in parse'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/slop-4.3.0/lib/slop/parser.rb:46:in `each'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/slop-4.3.0/lib/slop/parser.rb:46:in `parse'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/slop-4.3.0/lib/slop/options.rb:71:in `parse'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/slop-4.3.0/lib/slop.rb:23:in `parse'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/netgeo-0.1.0/exe/netgeo:19:in `netgeo'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/netgeo-0.1.0/exe/netgeo:118:in `<top (required)>'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/bin/netgeo:23:in `load'
	from /Users/ctompkinson/.rbenv/versions/2.2.2/bin/netgeo:23:in `<main>'

I suspect this is due to missing a rescue when performing a get, which could handle and output a human readable error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.