Skip to content

Instantly share code, notes, and snippets.


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
git for-each-ref --sort=-committerdate refs/heads/
# Or using git branch (since version 2.7.0)
git branch --sort=-committerdate # DESC
git branch --sort=committerdate # ASC
adenosinew /
Last active Oct 3, 2019
[Elasticsearch curl]
curl -X GET http://<SEARCH_NODE_FQDN>:9200/_cluster/health?pretty
adenosinew /
Last active Oct 2, 2019
[AWK intro] #linux #cmd
awk '{a+=$(NF-2)}END{print "Total:", a}' logs.txt
# Output:
# Total: 504
# If you are getting below error
# error: Untracked working tree file '***' would be overwritten by merge.
git reset --hard HEAD
git clean -f -d
git pull
adenosinew / nginx.conf
Created Sep 18, 2019
[Bypass nginx security]
View nginx.conf
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Authorization "Basic a2luZzppc25ha2Vk";
# Logstash Dir Layout
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 / 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 /
Created Aug 19, 2019
[aws s3] #cloud
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 {
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
You can’t perform that action at this time.