| Shortcut | Description |
|---|---|
ranger |
Start Ranger |
Q |
Quit Ranger |
R |
Reload current directory |
? |
Ranger Manpages / Shortcuts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Generates the SAPISIDHASH token Google uses in the Authorization header of some API requests | |
| async function getSApiSidHash(SAPISID, origin) { | |
| function sha1(str) { | |
| return window.crypto.subtle.digest("SHA-1", new TextEncoder("utf-8").encode(str)).then(buf => { | |
| return Array.prototype.map.call(new Uint8Array(buf), x=>(('00'+x.toString(16)).slice(-2))).join(''); | |
| }); | |
| } | |
| const TIMESTAMP_MS = Date.now(); | |
| const digest = await sha1(`${TIMESTAMP_MS} ${SAPISID} ${origin}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function! GitCheckoutBranch(branch) | |
| " branch can look like this: "/remotes/origin/master [hash] info" or this: "master [hash] info" | |
| let l:name = split(split(trim(a:branch), "", 1)[0], "/", 1)[-1] | |
| " just show what is happening | |
| echo "checking out ".l:name."\n" | |
| " you can use !git, instead of Git, if you don't have Fugitive | |
| execute "Git checkout ".l:name | |
| endfunction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Trim a single "input.png" image and save to "output.png" | |
| magick input.png -trim +repage output.png | |
| # Trim a single "image.png" image and overwrite the original file (based on @enijar comment) | |
| mogrify -trim +repage image.png | |
| # Trim and overwrite all png images from the working directory (based on @enijar comment) | |
| mogrify -trim +repage *.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "log" | |
| "os/exec" | |
| ) | |
| func main() { | |
| path, err := exec.LookPath("ls") | |
| if err != nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Python implementation of Haskell's | |
| sieve xs = sieve' xs Map.empty | |
| where | |
| sieve' [] table = [] | |
| sieve' (x:xs) table = | |
| case Map.lookup x table of | |
| Nothing -> x : sieve' xs (Map.insert (x*x) [x] table) | |
| Just facts -> sieve' xs (foldl reinsert (Map.delete x table) facts) |