Skip to content

Instantly share code, notes, and snippets.

View gauravds's full-sized avatar
🚀
Focusing

Gaurav Sharma gauravds

🚀
Focusing
View GitHub Profile
@gauravds
gauravds / docker-compose.yml
Created February 8, 2024 21:52
docker-compose.yml for mac m1 pro
version: '3.1'
services:
redis:
image: redis:5-alpine
platform: linux/amd64
restart: unless-stopped
container_name: redis
ports:
- '6379:6379'
@gauravds
gauravds / sql_mode_set.sql
Last active February 2, 2024 13:19
sql mode to support ONLY_FULL_GROUP_BY by setting this `NO_ENGINE_SUBSTITUTION`
SELECT @@sql_mode;
SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';
SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION';
-- other commands
SELECT @@sql_mode;
SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));
SET GLOBAL sql_mode = 'ONLY_FULL_GROUP_BY';
@gauravds
gauravds / README.md
Created November 15, 2023 17:55
VSCode debugger for aws lambda (Sam) command for service.

Local AWS lambda service call via sam / aws sam cli, you can also attach debugger to VSCode via configuration settings.json

$ sam local invoke --profile=dev MyServiceName1 -e events/events-MyServiceName1.json -n env/env-MyServiceName1.json
@gauravds
gauravds / timeSlot.js
Last active October 30, 2023 13:34
Next Time Slot
const moment = require('moment')
/**
* Get time for next round off 10 minutes in epoch form.
* @returns { number } epoch time
*
* if time is 17:23:32 => 17:30:00
* if time is 17:53:32 => 18:00:00
* if time is 23 Oct, 2023 23:53:32 => 24 Oct, 2023 00:00:00
*/
function getNextTimeClickFor10Minutes() {
@gauravds
gauravds / fix.sql
Created April 29, 2023 11:01
SELECT list is not in GROUP BY clause and contains nonaggregated column 'db1.tables1.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
SHOW VARIABLES LIKE 'sql_mode';
SET global sql_mode = 'NO_ENGINE_SUBSTITUTION';
@gauravds
gauravds / ProxyController.js
Created April 10, 2023 19:41 — forked from madrussa/ProxyController.js
Using node-http-proxy in AdonisJs as a controller action, allows Adonis to act as a gateway
'use strict'
const httpProxy = require('http-proxy');
const Logger = use('Logger');
class ProxyController {
/**
* Proxy any request to the targeted PROXY_HOST
*
@gauravds
gauravds / gist:7d9a3844182c2e89849a366001989279
Created April 26, 2021 12:29 — forked from 480/gist:3b41f449686a089f34edb45d00672f28
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@gauravds
gauravds / 0 Sign up for AWS C9 IDE!
Created August 31, 2020 23:00 — forked from yshmarov/0 AWS Cloud9
The Complete Ruby on Rails 6 Web Development Course 2020 - notes
## AWS ##
# All AWS C9 envments
https://eu-central-1.console.aws.amazon.com/cloud9/home?region=us-east-1
# Instance management
https://console.aws.amazon.com/ec2/home?region=eu-central-1#Instances:sort=instanceId
# Create AWS C9 environment
https://eu-central-1.console.aws.amazon.com/cloud9/home/create
@gauravds
gauravds / nil_empty_blank_present_ffdierence_in_ruby
Created August 24, 2020 16:08 — forked from pythonicrubyist/nil_empty_blank_present_ffdierence_in_ruby
Difference between nil?, empty?, blank? and present? in Ruby and Ruby on Rasils.
# nil? can be used on any Ruby object. It returns true only if the object is nil.
nil.nil? # => true
[].nil? # => false
{}.nil? # => false
"".nil? # => false
" ".nil? # => false
true.nil? # => false
# empty? can be used on some Ruby objects including Arrays, Hashes and Strings. It returns true only if the object's length is zero.
nil.empty? # NoMethodError: undefined method `empty?' for nil:NilClass
@gauravds
gauravds / main.go
Created February 26, 2020 10:36 — forked from kartiksura/main.go
Querying AWS Athena using Golang SDK
package main
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/athena"
)