Skip to content

Instantly share code, notes, and snippets.

View karthiks's full-sized avatar
😄
Playing with GraphQL

Karthik Sirasanagandla karthiks

😄
Playing with GraphQL
View GitHub Profile
@karthiks
karthiks / database.js
Created September 5, 2020 15:31
The Workaround Configuration to connect to MongoDB Atlas
module.exports = ({ env }) => ({
defaultConnection: 'default',
connections: {
default: {
connector: 'mongoose',
settings: {
host: env('DATABASE_HOST', 'cluster0-shard-00-00.hp5fc.mongodb.net:27017,cluster0-shard-00-01.hp5fc.mongodb.net:27017,cluster0-shard-00-02.hp5fc.mongodb.net:27017'),
srv: env.bool('DATABASE_SRV', false),
port: env.int('DATABASE_PORT', 27017),
database: env('DATABASE_NAME', 'cmsdb'),
@karthiks
karthiks / database.js
Created September 5, 2020 15:29
The elegant but unworkable configuration in Strapi
module.exports = ({ env }) => ({
defaultConnection: 'default',
connections: {
default: {
connector: 'mongoose',
settings: {
host: env('DATABASE_HOST', 'cluster0.hp5fc.mongodb.net'), // Your MongoDB Atlas Cluster Service DNS
srv: env.bool('DATABASE_SRV', true),
port: env.int('DATABASE_PORT', 27017),
database: env('DATABASE_NAME', 'cmsdb'),
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: C:\your\custom\path\to\mongodb\data
journal:
enabled: true
@karthiks
karthiks / package.json
Created March 30, 2020 17:41
How ESLint, Husky and Lint-Staged are configured?
{
"name": "my_javascript_project",
"version": "1.0.0",
...
"scripts": {
"lint": "./node_modules/.bin/eslint ./app/**/*.*js* --fix",
...
},
"husky": {
"hooks": {
@karthiks
karthiks / package.json
Created March 30, 2020 17:23
husky-configuration-sample
{
"name": "my_javascript_project",
"version": "1.0.0",
"description": "my company's bread-earning project",
...
"scripts": {
"lint": "./node_modules/.bin/eslint ./app/**/*.*js* --fix",
...
},
"husky": {
@karthiks
karthiks / multiple-files-remove-prefix.md
Created December 29, 2019 04:59
Remove prefix from multiple files in Linux console

Bash

for file in prefix*; do mv "$file" "${file#prefix}"; done;

The for loop iterates over all files with the prefix. The do removes from all those files iterated over the prefix.

Here is an example to remove "bla_" form the following files:

bla_1.txt
bla_2.txt
@karthiks
karthiks / example.html
Last active May 17, 2020 14:38 — forked from andrewlimaza/example.html
Print certain div / elements using window.print()
<script>
function printDiv(divID){
var printContents = document.getElementById(divID).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
# To enable mouse scroll in tmux pane
set -g mouse on
# Tmux to support colors
set -g default-terminal "screen-256color"
# Change the default prefix from C-b to C-z
set -g prefix C-z
unbind C-b
@karthiks
karthiks / install_minikube_ubuntu1810.sh
Last active January 28, 2019 11:57
Steps to install minikube on ubuntu 18.10
# Note of thanks: This code snippet is created using https://carbon.now.sh. Check it out!
# Update the system
sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get upgrade
# Install KVM or VirtualBox or both
# I prefer KVM
# Installing virtualbox