Vookimedlo Posted December 13, 2017 Share Posted December 13, 2017 (edited) Dear Alfred users, This workflow is mainly useful for developers, which needs to evaluate bitwise expressions. I hope you will find it useful. Github: https://github.com/vookimedlo/alfred-bitwise-evaluator alfred-bitwise-evaluator Alfred 3 workflow for evaluating bitwise expressions. Installation Install alfred-bitwise-evaluator workflow. All further updates are handled automatically. Usage In Alfred, type bitwise and enter your bitwise expression which shall be evaluated. Selected result is copied to your clipboard. Expression is being evaluated as you type the expression. If expression cannot be evaluated, either for illegal characters or syntax error, user will be notified about that. Bitwise expression syntax and operators precedence Workflow is based on Perl, therefore it uses its syntax and operators precedence, which is easy to use. The golden rule in programming languages is the following: "If you are unsure about the operator precedence, always use parentheses to be sure what you are doing.". It's not a shame! OPERATOR NAME SYNTAX Bitwise NOT ~a Bitwise AND a & b Bitwise OR a Bitwise XOR a ^ b Bitwise left shift a << b Bitwise right shift a >> b Integer formats The four formats listed below are printed. INTEGER FORMAT SYNTAX EXAMPLE Decimal 1234 Binary 0b1110011 Hexadecimal 0x1234 Octal 01234 Workflow Keyword The default workflow keyword bitwise could be changed in alfred workflow settings. This variable will not be overwritten once the new workflow update is installed. Note Before the expression is evaluated, input data will be checked for illegal characters. If those are found, evaluation will not continue. This is done for making the workflow harmless. If you remove this check, you could evaluate any Perl code, which could be pretty dangerous. Do that only if you know what you are doing!!! Edited October 11, 2018 by Vookimedlo Updated to be in sync with the most recent workflow version. Link to comment
shmulvad Posted October 5, 2018 Share Posted October 5, 2018 I really find this workflow useful and have been using it a lot. Would it be possible to add to it, so that instead of having to press a modifier key to copy different results other than binary and then view them, the result in both decimal, hex, binary and octal is immediately printed to the screen as four separate items in Alfred? And then copying a result is just done by selecting the corresponding item? Link to comment
shmulvad Posted October 7, 2018 Share Posted October 7, 2018 I really wanted the feature I describe above, so I went ahead and modified the code to achieve this behaviour. I don't have any experience with Perl, so I guess the stuff I have rewritten is pretty poorly written code, but for now it works. This is what is now shown when the workflow is called with an expression that can be evaluated: And this is what it looks like when you insert an expression that can't be evaluated: I have forked the original repo and made a pull request. For now, the modified workflow can be downloaded from here, Vookimedlo 1 Link to comment
Vookimedlo Posted October 11, 2018 Author Share Posted October 11, 2018 On 10/8/2018 at 1:24 AM, shmulvad said: I really wanted the feature I describe above, so I went ahead and modified the code to achieve this behaviour. I don't have any experience with Perl, so I guess the stuff I have rewritten is pretty poorly written code, but for now it works. This is what is now shown when the workflow is called with an expression that can be evaluated: And this is what it looks like when you insert an expression that can't be evaluated: I have forked the original repo and made a pull request. For now, the modified workflow can be downloaded from here, Merged back to trunk. New release is available. The original post above was updated with the current readme. Thanks! shmulvad 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now