create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
| // Untar takes a destination path and a reader; a tar reader loops over the tarfile | |
| // creating the file structure at 'dst' along the way, and writing any files | |
| func Untar(dst string, r io.Reader) error { | |
| gzr, err := gzip.NewReader(r) | |
| if err != nil { | |
| return err | |
| } | |
| defer gzr.Close() |
| /* MIT License | |
| * | |
| * Copyright (c) 2017 Roland Singer [[email protected]] | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is | |
| * furnished to do so, subject to the following conditions: |
| package main | |
| import ( | |
| "fmt" | |
| "math" | |
| ) | |
| func makeBatches(batchSize int, size int) [][]int { | |
| batches := [][]int{} | |
| nbBatches := int(math.Ceil(float64(size) / float64(batchSize))) |
| // Example of how third-party imports and multiple files can be used in Go playground | |
| package main | |
| import ( | |
| "fmt" | |
| "github.com/common-nighthawk/go-figure" | |
| "your.universe/worlds" | |
| ) |
| def main(args: Array[String]): Unit = { | |
| import javax.script.ScriptEngineManager | |
| import scala.concurrent.duration._ | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| val engine = new ScriptEngineManager().getEngineByMimeType("text/javascript") | |
| // val script = "-1000 * %d" format 3 | |
| val endless = "(function foo() { foo(); })()" | |
| val result = Await.result(Future(engine.eval(endless)), 3.millis) | |
| println(result) |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
| # Set variables in .bashrc file | |
| # don't forget to change your path correctly! | |
| export GOPATH=$HOME/golang | |
| export GOROOT=/usr/local/opt/go/libexec | |
| export PATH=$PATH:$GOPATH/bin | |
| export PATH=$PATH:$GOROOT/bin |
| // By @coderitual | |
| // https://twitter.com/coderitual/status/1112297299307384833 | |
| // Remove any duplicates from an array of primitives. | |
| const unique = [...new Set(arr)] | |
| // Sleep in async functions. Use: await sleep(2000). | |
| const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
| // Type this in your code to break chrome debugger in that line. |
| var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' + | |
| 'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' + | |
| 'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' + | |
| ': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));'; | |
| try { | |
| eval(str); | |
| } catch(e) { | |
| alert('Your browser does not support ES6!') | |
| } |
| package main | |
| import ( | |
| "log" | |
| "math" | |
| ) | |
| func Round(val float64, roundOn float64, places int ) (newVal float64) { | |
| var round float64 | |
| pow := math.Pow(10, float64(places)) |