This file contains 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
# changing my timezone on my | |
# macOS Sierra Version 10.12.4 (16E195) | |
# see video on https://cl.ly/0o3V1b0o3p0P/timezone-issue.gif | |
# instead of having timezone = BRT it is showing the current offset to UTC | |
$ uname -a | |
Darwin henvic.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64 | |
henvic at henvic in ~/time | |
$ go run time.go | |
current: Wed Apr 12 09:32:37 PDT 2017 |
This file contains 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 prompt | |
import ( | |
"bufio" | |
"errors" | |
"fmt" | |
"io" | |
"os" | |
"strconv" | |
"strings" |
This file contains 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
// golang question: what code is better? | |
// Scenario: inside a callback you have to take an action - say, send a response - after some time | |
// How would you accomplish it? Why? | |
// What if it is test code? | |
// What if it is production code? | |
// Would you write the code like this? | |
mux.HandleFunc("/url", func(w http.ResponseWriter, r *http.Request) { | |
var e = make(chan struct{}, 1) | |
time.AfterFunc(800*time.Millisecond, func() { |
This file contains 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
#!/bin/bash | |
# CLI tool publishing script | |
set -euo pipefail | |
IFS=$'\n\t' | |
config=${1-} | |
if [ -z $config ] || [ $config == "help" ] || [ $config == "--help" ]; then |
This file contains 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
8WGbGy94JXa |
This file contains 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
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
if [ `find . -maxdepth 1 -type l -ls | wc -l` -gt 0 ]; then | |
>&2 echo "Doing nothing. Symbolic links found on directory." | |
exit 1 | |
fi |
This file contains 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 "fmt" | |
import "strings" | |
func main() { | |
var x = "/home/henvic/foo/bar" | |
var pos int | |
walk: |
This file contains 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
[ | |
{ | |
"platform": "darwin_amd64", | |
"version": "0.0.1", | |
"link": "https://liferay.io/cli/build/launchpad-cli-darwin-v0.0.1" | |
}, | |
{ | |
"platform": "linux_amd64", | |
"version": "0.0.2", | |
"link": "https://liferay.io/cli/build/launchpad-cli-linux-v0.0.2" |
This file contains 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
1000000 iterations. Array is reset after first duplicate value. | |
length: 79775; duplicate: 14631346333771944 | |
length: 45242; duplicate: 16620092559605836 | |
length: 55295; duplicate: 9427159884944558 | |
length: 123993; duplicate: 7038418645970523 | |
length: 15575; duplicate: 8662485890090466 | |
length: 96884; duplicate: 5140431500039995 | |
length: 106546; duplicate: 40411726920865470 | |
length: 54615; duplicate: 9114022604189812 | |
length: 31491; duplicate: 9443272105418146 |
This file contains 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
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | |
. . . . ' - ( - ' . _ . . . . _ ........__ . . . _ . . .. __ | |
. . . . . . . ' - ( - ' . . .' . . . . . . . . '. . .| . \ _ / _ | | |
. . . . . . . . . . ` ' - / . . . . . . . . . . . . \ / . . . . . . \ | |
. . . . . . . . . . . . .|. . . . . . . . . . . . . . ` . . . 6 . 6.|_ | |
. . . . . . . . . . . . .|. . . . . . . . . . . . . . . . . . . . . / .. ..\ | |
. . . . . . . . . . . . . \ . . . . . . .| .. . . . . . . . . . , _\_ _ / | |
. . . . . . . . . . . . . . / . . . . . / . . . . . /.. . _ _ _ .--' | |
. . . . . . . . . . . . . < . . . . - ;`- - - -`. .\ . . \ . \ | |
. . . . . . . . . . . . . . \ . . \ . \ . . . . . . . . \ . . \ . \ |