Giter Site home page Giter Site logo

bunny's Introduction

bunny

Smart bookmarking tool, running custom commands to open urls from a browser url bar

What?

"Smart bookmarking"? What? I had the same reaction. Imagine it as a very fast, and elegant (if you so wish) way of entering urls into your browser. Instead of writing reddit.com/r/programmerhumor, you could be writing rd r programmerhumor and be redirected to your entertainment of choice a lot easier.

This was inspired by the following article by facebook

How to use

  • cargo install bun (this does require rust nightly for now)
  • Run the installed program bun
  • Create a custom search engine for your browser and point it towards the address the server is running on

The server looks for a file that contains all the bookmarks inside the home directory (~/bookmarks.toml)

Writing bookmarks (bookmarks.toml)

The engine is simple, it's all written in a toml format for readability

  • The bookmarks file is made of books, they can have any name you choose, an alias, and a default url:
[twitter]
alias = "tw"
default = "https://twitter.com"
  • Each book in the file has pages. Each page has a name, a prefix, and a url:
[twitter]
alias = "tw"
default = "https://twitter.com"

[twitter.pages]
search = { prefix = "NONE", url = "https://twitter.com/search?q={encoded}" }
profile = { prefix = "@", url = "https://twitter.com/{raw}" }
  • Each url can contain special keys that handle the data you pass to the command.

Keys

Consider the following command: tw rust lang. Here are the keys and what they do with the given data. The prefix gets stripped away and we are left to handle rust lang

  • {default} - will be replaced with the default url of the book => https://twitter.com
  • {encoded} - will url encode the data => rust%20lang
  • {raw} - will pass in the raw data without encoding it => rust lang
  • {0} - will pass in the first segment of the data => rust
  • {1} - will pass in the second segment of the data => lang
    • There are up to 4 total segments at the moment, because it felt like more were just too many. These can be used to create more customised commands, such as, a reddit command:
    [reddit]
    alias = "rd"
    default = "https://reddit.com"
    
    [reddit.pages]
    whatever = { prefix = "NONE", url = "https://reddit.com/{0}/{1} }
    • The above can be used as rd r programmerhumor to go to a subreddit or as rd u programmerhumor to go to a user

Prefixes

The url prefix can be whatever you want it to be, it is used to differentiate between each command. You could have -s when searching for something, or full on search if shortcuts aren't your thing.

You dont even need spaces between the prefix and command.

-sheyooo will be split into -s heyooo if the prefix is defined as -s.

There's also one special prefix, NONE, which means the command will not expect a prefix, and encode the url with all the given data.

Full examples can be seen in the example file

bunny's People

Contributors

0x20f avatar

Stargazers

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

Watchers

 avatar  avatar

bunny's Issues

can't get it to work

Hi I am ex-facebook and really miss this tool.

I have followed the steps but get the following error:

$ bun
๐Ÿ”ง Configured for production.
=> address: 0.0.0.0
=> port: 8000
=> log: critical
=> workers: 16
=> secret key: generated
=> limits: forms = 32KiB
=> keep-alive: 5s
=> read timeout: 5s
=> write timeout: 5s
=> tls: disabled
Warning: environment is 'production', but no secret_key is configured
๐Ÿš€ Rocket has launched from http://0.0.0.0:8000
Error: No matching routes for GET /?search=rd text/html.
Warning: Responding with 404 Not Found catcher.
Error: No matching routes for GET /?search=rd text/html.
Warning: Responding with 404 Not Found catcher.

Search engine is set to:

how can upload the bookmark.toml file to the root of 0.0.0.0:8000? I tried to ftp to it but it did not accept the request.

This is awesome!

Hey!

I'm the author who write the article.

I found your crate by accident, but I have to say, I'm impressed! Your solution is waaaay more elegant than mine and I love the abstraction. I honestly my migrate from my old solution over to yours because it seems easier to maintain ๐Ÿ˜…

Anyways, thanks so much for making this and putting it out there. You have no idea how happy this makes me!

Cheers!

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.