git clone https://gist.github.com/ishu3101/6fb35afd237e42ef25f9
mv 6fb35afd237e42ef25f9 ConvertTo-Markdown
cd ConvertTo-Markdown
''' | |
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) |
package main | |
import ( | |
"log" | |
"os/exec" | |
) | |
func main() { | |
path, err := exec.LookPath("ls") | |
if err != nil { |
convert input.png -trim +repage output.png |
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 |
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}`); |