Skip to content

Instantly share code, notes, and snippets.

View avtaniket's full-sized avatar

aniket takarkhede avtaniket

  • India
View GitHub Profile
@avtaniket
avtaniket / Install-Redis-Amazon-Linux-2.md
Last active April 19, 2024 13:42
Install Redis On Amazon Linux 2

Install Redis On Amazon Linux 2

  • Update the system packages:
sudo yum update -y
  • Install the Redis package using the Amazon Linux Extra Packages for Enterprise Linux (EPEL) repository
@avtaniket
avtaniket / DynamoDB-Pagination.js
Created June 4, 2021 09:20
Query (and Scan) DynamoDB Pagination
const getAll = async () => {
let result, accumulated, ExclusiveStartKey;
do {
result = await DynamoDB.query({
TableName: argv.table,
ExclusiveStartKey,
Limit: 100,
KeyConditionExpression: 'id = :hashKey and date > :rangeKey'
ExpressionAttributeValues: {
@avtaniket
avtaniket / DynamoDB-and-Node.js
Last active June 4, 2021 09:15
DynamoDB and Node.js - Complete Cheat Sheet
### Setup
const AWS = require("aws-sdk") // Or use `import` syntax for Typescript and newer ES versions
const dynamoDB = new AWS.DynamoDB({
region: "us-east-1"
})
// Or
@avtaniket
avtaniket / heroku_multiple_remotes_multiple_branches
Created February 22, 2021 06:25 — forked from amratab/heroku_multiple_remotes_multiple_branches
Adding multiple heroku apps to a single repository different branches
Suppose you have two heroku remote apps
myapp-dev & myapp-prod
and two git branches
master(for dev) & production
Now lets setup heroku on the existing git repo in your local machine
Assuming the branches and the apps exist already
git remote add heroku-myapp-dev https://git.heroku.com/myapp-dev.git
git remote add heroku-myapp-prod https://git.heroku.com/myapp-prod.git
@avtaniket
avtaniket / gist:3799c86f225523a182b07d1a25bd78c0
Created August 17, 2020 07:48
AWS centos setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
1. SSH to EC2 server and open/edit below file
vi /etc/environment
2. Add these lines
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
3. Exit terminal and connect again, Done
@avtaniket
avtaniket / aws_policy.json
Created June 29, 2019 14:36
Restricts access to two AWS regions
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Deny",
"Action": "*",
"Resource": "*",
"Condition": {
"StringNotEquals": {
"aws:RequestedRegion": [
"eu-central-1",
@avtaniket
avtaniket / rest-api-response-codes.txt
Created May 31, 2018 04:01
REST API response codes
200 OK: Success
201 Created: Created one or more resource(s).
204 No Content: The server has successfully fulfilled the request.
400 Bad Request: The web-service request was invalid.
401 Unauthorized: Authentication failed! Invalid credentials.
403 Forbidden: Requested a resource to which the server does not allow access.
404 Not Found: Requested resource not found.
415 Unsupported Media Type: The requested payload format is in an unsupported format.
429 Too Many Request: User has sent too many requests in a given amount of time.
500 Internal Server Error: An internal server error occurred while processing the request.
@avtaniket
avtaniket / git.txt
Created January 3, 2018 14:06
git helpful commands
# Replace local branch with remote branch entirely
git reset --hard origin/master
# Remove ignored files - select option as requied
git rm -r -f --cache node_modules
# Rever last commit
git reeset head~1
@avtaniket
avtaniket / gulpfile.js
Created January 3, 2018 06:56
Bundle Minify And Cache Bust With Gulp
/// <binding AfterBuild='default' />
var gulp = require('gulp');
var htmlmin = require('gulp-htmlmin');
var useref = require('gulp-useref');
var gulpRename = require('gulp-rename');
var cacheBuster = require('gulp-cache-bust');
var uglify = require('gulp-uglify');
var cssnano = require('gulp-cssnano');
var lazypipe = require('lazypipe');
var sourcemaps = require('gulp-sourcemaps');
@avtaniket
avtaniket / install_jenkins_ubuntu
Last active December 15, 2017 09:03
Install Jenkins on Ubuntu 16.04
For AWS EC2
create Role : aws-ec2-jenkins-role
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
sudo apt-get update
sudo apt-get install jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins