Skip to content

Instantly share code, notes, and snippets.

View henvic's full-sized avatar

Henrique Vicente henvic

View GitHub Profile
@henvic
henvic / README.md
Last active October 13, 2017 04:41
gitless proposal: easier git stash area

This is a project work for the class I am taking (Advanced Topics in Software Engineering).

Context

legit is a complimentary Command-Line-Interface tool for git that adds some commands which proposes to simplify git interface. See Purposes, Concepts, Misfits, and a Redesign of Git.

Improvement idea: legit stash

git stash is a powerful git command for stashing changes in a dirty working directory.

This is very useful for when you are working on something, but have to stop for a while to do something else.

@henvic
henvic / ttyissue.go
Created July 25, 2017 17:11
ttyissue.go
package main
import (
"bufio"
"fmt"
"os"
"syscall"
"golang.org/x/crypto/ssh/terminal"
)
@henvic
henvic / bash
Last active April 12, 2017 16:52
Weird timezone issue
# 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
@henvic
henvic / prompt.go
Created January 3, 2017 21:41
prompt.go
package prompt
import (
"bufio"
"errors"
"fmt"
"io"
"os"
"strconv"
"strings"
@henvic
henvic / time-afterfunc-vs-sleep.go
Created September 17, 2016 06:51
golang question: time.AfterFunc vs. time.Sleep
// 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() {
@henvic
henvic / release.sh
Created September 7, 2016 23:57
example of release.sh for golang project
#!/bin/bash
# CLI tool publishing script
set -euo pipefail
IFS=$'\n\t'
config=${1-}
if [ -z $config ] || [ $config == "help" ] || [ $config == "--help" ]; then
@henvic
henvic / version_pkg
Created July 8, 2016 16:05
WeDeploy CLI version pkg
8WGbGy94JXa
@henvic
henvic / symbolic.sh
Created June 7, 2016 04:43
symbolic.sh
#!/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
@henvic
henvic / goto_example.go
Created April 2, 2016 03:45
goto example in go
package main
import "fmt"
import "strings"
func main() {
var x = "/home/henvic/foo/bar"
var pos int
walk:
@henvic
henvic / update_channel.json
Created January 29, 2016 19:59
Update channel
[
{
"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"