git archive --format=tar.gz -o /tmp/my-repo.tar.gz --prefix=my-repo/ master
More detailed version: https://til.simonwillison.net/git/git-archive
| // This example shows how interfaces could be used without | |
| // pushing inner data to heap. | |
| // | |
| // Note that it was checked with Go 1.8.3 and may become unuseful | |
| // in the future releases of Go. | |
| package main | |
| import ( | |
| "encoding/binary" | |
| "testing" |
git archive --format=tar.gz -o /tmp/my-repo.tar.gz --prefix=my-repo/ master
More detailed version: https://til.simonwillison.net/git/git-archive
| #[feature(macro_rules)]; | |
| struct ScopeCall<'cls> { | |
| c: 'cls || | |
| } | |
| #[unsafe_destructor] | |
| impl<'cls> Drop for ScopeCall<'cls> { | |
| fn drop(&mut self) { | |
| (self.c)(); | |
| } |
Press minus + shift + s and return to chop/fold long lines!
| tim@touchsmart:~/Code$ nvm use v0.11.2-generators | |
| Now using node v0.11.2-generators | |
| tim@touchsmart:~/Code$ node --harmony testgen.js | |
| <Buffer 76 61 72 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 3b 0a 66 75 6e 63 74 69 6f 6e 20 72 65 61 64 46 69 6c 65 28 70 61 74 68 2c 20 65 6e 63 ...> | |
| Sleeping for 2000ms... | |
| Done |
This is pretty specific to my setup but the idea can be adapted to work with pretty much anything.
Go has a flag package which makes parsing command line arguments really easy.
package main| package systemd | |
| import ( | |
| "os" | |
| "strconv" | |
| "syscall" | |
| ) | |
| const ( | |
| listenFdsStart = 3 |
| package main | |
| import ( | |
| "container/heap" | |
| "fmt" | |
| "math/rand" | |
| "time" | |
| ) | |
| const nRequester = 100 |
| <?php | |
| function hide_cursor($stream = STDOUT) { | |
| fprintf($stream, "\033[?25l"); // hide cursor | |
| register_shutdown_function(function() use($stream) { | |
| fprintf($stream, "\033[?25h"); //show cursor | |
| }); | |
| } |