Skip to content

Instantly share code, notes, and snippets.

adenosinew

Block or report user

Report or block adenosinew

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adenosinew
adenosinew / PrintQuoted.go
Last active Aug 25, 2019
[Go string] Work with strings #go
View PrintQuoted.go
// The %q (quoted) verb will escape any non-printable byte sequences in a string so the output is unambiguous.
fmt.Printf("%q\n", sample)
@adenosinew
adenosinew / createSession.go
Created Aug 24, 2019
[AWS Go] Use aws go sdk
View createSession.go
sess, err := session.NewSession(&aws.Config{
Region: aws.String("us-west-2"),
Credentials: credentials.NewStaticCredentials(conf.AWS_ACCESS_KEY_ID, conf.AWS_SECRET_ACCESS_KEY, ""),
})
@adenosinew
adenosinew / s3Sync.sh
Created Aug 19, 2019
[aws s3] #cloud
View s3Sync.sh
aws s3 sync backup s3://tgsbucket
aws s3 sync s3://tgsbucket/backup /tmp/backup
aws s3 sync s3://tgsbucket s3://backup-bucket
View readFileLine.go
file, err := os.Open("file.txt")
if err != nil {
log.Fatal(err)
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
fmt.Println(scanner.Text())
}
@adenosinew
adenosinew / goCommands.sh
Created Aug 13, 2019
[Go Commands] Useful Go commands
View goCommands.sh
# Check the gopath and goroot
go env
@adenosinew
adenosinew / cpuUtilization
Created Jul 3, 2019
[Grafana Querys] #devops
View cpuUtilization
100 - (avg by (instance) (irate(node_cpu_seconds_total{job="node",mode="idle"}[5m])) * 100)
View curlQueryParam.sh
curl -X POST -k -H 'Content-Type: application/json' -H 'APIKEY: XXX' -H 'APISECRET: YYY' "https://APIENDPOINT?host=smtp.gmail.com&subject=breaking news..."
@adenosinew
adenosinew / GetNumericalPermission.sh
Created May 3, 2019
[Linux Permission] Work with Linux permission #linux #management
View GetNumericalPermission.sh
# For macOS
stat -f "%OLp" <file>
# For Linux
stat --format '%a' <file>
@adenosinew
adenosinew / changeShell.sh
Created Apr 3, 2019
[Linux user management] Manage the user profiles in the Linux system #Linux #management
View changeShell.sh
# List All available shells
cat /etc/shells
# Check the detail of user
less /etc/passwd
# e.g. Change the default shell of ubuntu
## 1. usermod
usermod --shell /bin/tcsh ubuntu
You can’t perform that action at this time.