Skip to content

Instantly share code, notes, and snippets.

View darkenergy96's full-sized avatar
๐Ÿ˜„

Sumanth Reddy darkenergy96

๐Ÿ˜„
  • Hyderabad, India
View GitHub Profile
@darkenergy96
darkenergy96 / token-generator.js
Created August 2, 2018 15:09 — forked from ziluvatar/token-generator.js
Example of refreshing tokens with jwt
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
*
* I create this gist just to help those who want to auto-refresh JWTs.
*/
const jwt = require('jsonwebtoken');
@darkenergy96
darkenergy96 / git-commands.md
Last active March 25, 2018 06:08
Git commands
clones a remote repo locally
git clone <remote-url>
To check the status
git status
Stage all files in working repo
@darkenergy96
darkenergy96 / mongodb-s3-backup.sh
Created February 22, 2018 11:38 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@darkenergy96
darkenergy96 / methods.go
Last active January 29, 2018 17:08
methods in golang
package main
import "fmt"
type animal struct {
name string
age int
}
func (a animal) printWithoutMutation() { //receives a copy of animal struct type