Skip to content

Instantly share code, notes, and snippets.

View karthiks's full-sized avatar
🎯
Focusing

Karthik Sirasanagandla karthiks

🎯
Focusing
View GitHub Profile
[user]
default=my_default_user
@karthiks
karthiks / wsl-cheatsheet.ps1
Last active March 25, 2025 14:17
WSL 2 CLI Cheat-sheet To Be Run In Powershell
# wsl Help
wsl --help
# Check WSL status
wsl --status
# Check WSL version
wsl --version
# Update WSL
@karthiks
karthiks / awsamplifyexpo.js
Created September 11, 2020 14:12 — forked from AndrzejKomarnicki/awsamplifyexpo.js
AWS Amplify and AppSync with Expo (React Native) cheat sheet
AWS Amplify and AppSync with Expo (React Native) cheat sheet and reference guide
[AWS Amplify] https://aws-amplify.github.io
[Expo] https://expo.io
// In order to run the Android emulator with Expo you will need Android Studio with Android Virtual Device Manager
// In order to run the iOS simulator with Expo you'll need Xcode
INITIALIZE PROJECT
# Function to change the default user
Function WSL-SetDefaultUser ($distro, $user) { Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\*\ DistributionName | Where-Object -Property DistributionName -eq $distro | Set-ItemProperty -Name DefaultUid -Value ((wsl -d $distro -u $user -e id -u) | Out-String); };
# Usage
# WSL-SetDefaultUser <DistroName> <UserName>
$title = 'WSL Import'
$question = 'The current Ubuntu WSL system will be unregistered, and the new VHD imported. Are you sure you want to proceed?'
$choices = '&Yes', '&No'
$decision = $Host.UI.PromptForChoice($title, $question, $choices, 1)
wsl --export Ubuntu ubuntu.tar
wsl --unregister Ubuntu
wsl --import Ubuntu D:\VMs\WSL\Ubuntu\ ubuntu.tar --version 2
[wsl2]
localhostForwarding=true
@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": {