Jump to content

Bhishan

Member
  • Content Count

    132
  • Joined

  • Last visited


Reputation Activity

  1. Like
    Bhishan reacted to vitor in ProcessControl — Deal with misbehaving processes   
    Call top for an auto-updating list of processes, ordered by CPU usage. Type to filter by process name.


     
    On each process:
    ⌘↵ quits. ⌥↵ forcibly kills. ⌃↵ limits CPU usage. fn↵ lowers priority (increases niceness). ⇧↵ freezes.
    ↵ gives more granularity over the options.


     
    Download | Source
  2. Thanks
    Bhishan reacted to vitor in [SOLVED] Alfred Workflow to copy file contents having space separated folder   
    Try this version. It works for me.
  3. Thanks
    Bhishan reacted to deanishe in [SOLVED] Alfred Workflow to copy file contents having space separated folder   
    https://forum.latenightsw.com/t/how-do-i-copy-image-file-to-clipboard-and-retain-format/590/27
  4. Thanks
    Bhishan reacted to vitor in [SOLVED] Alfred Workflow to copy file contents having space separated folder   
    Why are you grabbing the file location via AppleScript invoked by a Keyword, instead of using a File Action Trigger? That’s the best tool for the job. You can even prevent the Workflow from messing up by having the File Action Trigger only work on the +public.text type.

    On another note, cat "$1" | pbcopy is a useless use of cat. Do pbcopy < "${1}".
  5. Thanks
    Bhishan reacted to deanishe in Workflow to go one step up in jupyter notebook   
    Your workflow doesn't generate that URL, though. It removes all the slashes from the URL, so it isn't valid.
     
    Here is a version with fixed URL-manipulating logic.
  6. Like
    Bhishan reacted to deanishe in [SOLVED] Workflow to split a list and insert list elements followed by some keystrokes   
    This workflow should kinda do what you want.
     
    Note, you also have to sleep in the Python code because calling an External Trigger returns immediately. It doesn't wait for the trigger to finish.
  7. Thanks
    Bhishan reacted to deanishe in Fakeum — Generate fake test datasets in Alfred   
    Absolutely. The workflow's open source, so you can change it any way you want.
  8. Thanks
    Bhishan reacted to vitor in AlfredBookmarklet — Use a browser bookmarklet via Alfred   
    That will be more complex.
     
     
    By learning about JavaScript and the DOM. Those aren’t pre-built commands, you need to learn what they mean to build something custom. Unfortunately, that falls way out of scope. Stack Overflow is the appropriate place for this kind of question, but don’t mention Alfred or this Workflow, as that will only breed confusion. Ask of it like building a browser bookmarklet (“How to make browser bookmarklet to edit file in Github”).
  9. Like
    Bhishan reacted to vitor in AlfredBookmarklet — Use a browser bookmarklet via Alfred   
    Run browser bookmarklets from Alfred, without needing to having them installed in the browser itself.
     
    Note that you may need to Allow JavaScript from Apple Events in your Browser.
     
    1

    For the first step, get this template workflow itself. Though this is not strictly necessary (you can build it yourself) it serves as a starting point with most of the work already done. Proceed to open the workflow in Alfred.

    Next, get a browser bookmarklet to convert by copying its link address.


     
    2

    Run :cleanbookmarkletcode to clean the code in your clipboard. It performs substitutions necessary to avoid problems when pasting the code in the next step.


     
    3
     
    Open the Arg and Vars node and paste the code.



    Extra

    If you’re not new to Alfred, you likely won’t need these steps as you’ll know what to do.
     
    4

    The template includes both a Keyword and a Hotkey nodes to run the code. You can delete either one by clicking on it and pressing ⌫.


     
    5

    If you choose to use the workflow via Keyword, do not forget to set it up.



    6

    Lastly, edit the workflow’s details and its icon. For completeness it’s pre-filled with my details. Feel free to edit them.


     
    Download | Source
  10. Thanks
    Bhishan reacted to deanishe in Help with copying file from Downloads to PWD   
    It doesn't because it's not the same command. Check your input more carefully (this is what the Debug utility is for).
     
    echo "$DOWNLOADS/$RECENT" adds a trailing newline, which is what's causing the problem. It should be echo -n "$DOWNLOADS/$RECENT"
  11. Like
    Bhishan reacted to xilopaint in Smart calculations with Numi   
    Have you seen the post immediately above yours?
  12. Like
    Bhishan got a reaction from deanishe in euler's identity is calculated incorrectly   
    To get the value of "e" you may want to type   =exp(1)
     
    The imaginary number "i" is not supported in Alfred 4.
    You can visit the calculator settings here: https://www.alfredapp.com/help/features/calculator/
     
    If you want to use the math libraries of python (math, numpy) you can use this workflow:
    http://www.packal.org/workflow/python-interpreter
     
    Then,
     
    pt    e**(1j*pi)            Gives:   (-1+1.2246467991473532e-16j)
    pt real(e**(1j*pi))     Gives -1. 
     
     NOTE: 
    1. In python 1j is imaginary number 1i. 
    2. In python power operation is **
  13. Like
    Bhishan got a reaction from deanishe in Help with Clipboard Quickview workflow   
    Thanks for the idea of converting markdown to bbcode
  14. Like
    Bhishan reacted to Benzi in Battery - view summary stats about your laptop battery   
    Hi there, if possible could you run the following command in Terminal and PM me the output?
    ioreg -l -n AppleSmartBattery -r
  15. Thanks
    Bhishan reacted to vitor in [SOLVED] Deleting Selected Snippets in the Clipboard History   
    Welcome @yashodhankhare,
     
    Do fn⌫.
  16. Thanks
    Bhishan reacted to deanishe in Help with Clipboard Quickview workflow   
    Well have a look on Google then to see if there is a fixed version or an alternative.
     
     
    Vítor and I use his MarkdownTransform workflow to convert Markdown to BBCode.
  17. Like
    Bhishan reacted to Jasondm007 in Find & Replace Text from Clipboard using the Replace Utility (or any other)?   
    @Bhishan I've implemented this in a much larger workflow, so I'd recommend downloading @Andrew's posted above (July 18, 2018) - which fixes the original workflow:
     
     
    I just checked, and his Dropbox upload still works.
  18. Thanks
    Bhishan reacted to CJK in [SOLVED] Problem with copying screenshot to current directory   
    Sorry, I see now that your original script returns the basename.  I mistook it originally for returning the full path, so engineered my version of the script to do the same.  It's one small modification in the way I declared the variable fp, and concatenated it with $name from the outset.  Instead, we'll just keep them as two separate variables, so $fp will contain the file path to the containing folder, and $name will contain the basename that you're after:
    fp=$(osascript -e \ "tell app \"Finder\" to get insertion location as alias return the result's POSIX path") screencapture -i -x "$fp$name.png" # copy final path to clipboard printf '%s' "$name.png" | pbcopy  
     
  19. Thanks
    Bhishan reacted to CJK in [SOLVED] Problem with copying screenshot to current directory   
    Having had a brief look at the workflow and the bash scripts, my guess is that when you substitute in "Google Drive", you're not using quotes to enclose the full file path, e.g. where you have, in one script:
    /bin/mv $a ${HOME}/Dropbox/KeepMe/KeepScreenshot/${name}.png would be better if it were:
    /bin/mv "$a" "${HOME}/Dropbox/KeepMe/KeepScreenshot/${name}.png"  
    My other suggestion, though unrelated to your present dilemma, is that you combine your four Run Script actions into a single action.  It doesn't make much sense to have them separate, and it'll make debugging easier too.
  20. Thanks
    Bhishan reacted to CJK in [SOLVED] Problem with copying screenshot to current directory   
    In fact, this is your combined script just as a straight copy-n-paste (it obviously won't function yet because of the naked AppleScript code):
    screencapture -i -x ${HOME}/Dropbox/KeepMe/KeepScreenshot/$(date +%Y-%m-%d-%H-%M-%S).png # rename sleep 5 a=${HOME}/Dropbox/KeepMe/KeepScreenshot/*.png /bin/mv $a ${HOME}/Dropbox/KeepMe/KeepScreenshot/${name}.png tell application "Finder" if exists Finder window 1 then set currentDir to target of Finder window 1 as alias else set currentDir to desktop as alias end if end tell return POSIX path of currentDir # cd to cwd cd $1 # move png to cwd /bin/mv ${HOME}/Dropbox/KeepMe/KeepScreenshot/${name}.png ${name}.png # copy final path to clipboard pbcopy < ${name}.png There's a lot of renaming/moving and so forth going on, and I'm wondering whether it would have been easier just to set the destination path straight away when taking the screen capture.  That way, the entire script above gets reduced to this:
    fp=$(osascript -e \ "tell app \"Finder\" to get insertion location as alias return the result's POSIX path")$name.png screencapture -i -x "$fp" # copy final path to clipboard printf '%s' "$fp" | pbcopy  
  21. Like
    Bhishan reacted to Wangyou Zhang in Simplify fractions   
    I write a workflow for converting a given decimal to a simplified fraction as well as simplifying a given fraction.
    It saves me a lot of time and I hope it is useful for you too.
     
    Download
    You can download the workflow file from my GitHub.

    Examples

    frac .11 ==>  .11 = 11 / 100 frac 4/6 ==>  4/6 = 2 / 3 frac -1.4/2.2 ==>  -1.4/2.2 = -7 / 11 frac 1.2/0 ==>  Error: divided by zero. frac b/3 ==>  Error: Invalid input format  
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    Update
    7 additional math tools are added and the new workflow is renamed to MathTools. 
    1) Simplify fractions
    Examples:

    frac .11 ==>  .11 = 11 / 100 frac 4/6 ==>  4/6 = 2 / 3 frac -1.4/2.2 ==>  -1.4/2.2 = -7 / 11 2) Greatest common divisor
    Examples:

    3) Least common multiple
    Examples:

    4) Simplify surds
    Examples:

    sqrt .0144 ==>  √(.0144) = 3/25 = 0.12 sqrt 4 8/81 ==>  ³√(8/81) = (2/3) ³√(1/3) Note:
    5) Log functions
    Examples:

    log 5 ==>  log₁₀(5) = 0.698970004336 log2 1.0001 ==>  log₂(1.0001) = 0.000144262291095 ln e ==>  ln(e) = 1.0 Note:
    6) Prime factorization
    Examples:

    factor 100 ==>  factor(100) = [1, 2, 2, 5, 5] factor 31 ==>  factor(31) = [1, 31] Note:
    7) Permutations and Combinations
    Examples:

    C( 4 2 ==>  C(4, 2) = 6  c( 1000 3 ==>  C(1000, 3) = 166167000  P( 4 2 ==>  P(4, 2) = 12 p( 1000 3 ==>  P(1000, 3) = 997002000  Note:
  22. Thanks
    Bhishan reacted to deanishe in [SOLVED] Write current Finder path to a text file   
    log POSIX path of currentDir sends the path to STDERR, i.e. Alfred's debugger, not to the next action.

    Use return POSIX path of currentDir to write the path to STDOUT instead, which will be sent to the next action.

    It isn't working in the shell, either. It just looks like it because both STDOUT and STDERR are written to the terminal. If you try to redirect the output to a file with > /path/to/file, you'll see it doesn't work.
  23. Like
    Bhishan reacted to aiyo in Send URL   
    I have finally converted my Send URL extension into a workflow.
     

     
    The workflow selects the URL from the frontmost App or a URL from the Clipboard. Supported Apps are:
    Safari Webkit Google Chrome (Beta/Dev/Canary) Camino Opera (and Opera Next) Omniweb  
    You can then send the URL to a variety of Apps
     
    Safari Webkit Google Chrome (Beta/Dev/Canary) Camino Opera (and Opera Next) Omniweb Firefox (and Aurora) iCab Sleipnir Paparazzi! Mail Sparrow Postbox Gmail VLC Adium (as a chat to an online contact) Droplr downforeveryoneorjustme.com and the clipboard  
    The workflow only list the Apps installed on you mac.
    You can download Send URL here:
    https://github.com/aiyodk/Alfred-Extensions/raw/master/AlfredApp_2.x/Send-URL/Send-URL.alfredworkflow
     
    EDIT:
     
    I have updated Send URL.  
    The update fixes a bug where the workflow would not work if the URL contains a '&' and downforeveryoneorjustme.com is not working correctly.
    I have also included options to copy the URL as a HTML or Markdown link (including the page title)
  24. Thanks
    Bhishan reacted to vitor in [SOLVED] How to Assign Keyboard Shortcut to empty Downloads and Trash Both?   
    @Bhishan You have way too much code. You can do it with
    tell application "Finder" delete every item of folder (path to downloads folder as text) empty trash end tell  
  25. Thanks
    Bhishan reacted to CJK in [SOLVED] How to Assign Keyboard Shortcut to empty Downloads and Trash Both?   
    Yes, I believe so.  You can take the first workflow (`throw`) and append a _System Command_ action, for which you would choose "Empty Trash".  Then prepend to all of this a hotkey that triggers this sequence of events.  No AppleScript ought to be needed.
×
×
  • Create New...