Skip to content

Instantly share code, notes, and snippets.

Playing with GraphQL

Karthik Sirasanagandla karthiks

Playing with GraphQL
View GitHub Profile
karthiks / nginx
Created Dec 20, 2020
default logrotation for nginx located at /etc/logrotate.d/nginx (per app logrotate is configured this way)
View nginx
/var/log/nginx/*.log {
rotate 14
create 0640 www-data adm

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

View wsl-set-default-user.ps1
# Know the id of the username in the original distro that was exported
wsl -d Ubuntu-20.04 -u kartz -e id -u
# Outputs 1000
# Knowing the id of the username in the distro that was created by importing the tar image
wsl -d Ubuntu-20 -u kartz -e id -u
# Outputs 1000
# I would want to use this distroname and id, to set this user as the default login profile of WSL.
# I set this up in Windows Registry with the line snippet below:
View wsl.conf
karthiks / wsl-cheatsheet.ps1
Last active Mar 28, 2021
WSL 2 CLI Cheat-sheet To Be Run In Powershell
View wsl-cheatsheet.ps1
# To list installed distributions
wsl -l
wsl --list
# To list installed distributions along with its running status and wsl config being 1 or 2
wsl -l --verbose
wsl -l -v
# To run a specific distro
wsl -d distro_name
karthiks / awsamplifyexpo.js
Created Sep 11, 2020 — forked from AndrzejKomarnicki/awsamplifyexpo.js
AWS Amplify and AppSync with Expo (React Native) cheat sheet
View awsamplifyexpo.js
AWS Amplify and AppSync with Expo (React Native) cheat sheet and reference guide
[AWS Amplify]
// 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
# 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)
View migrate-wsl-dist
wsl --export Ubuntu ubuntu.tar
wsl --unregister Ubuntu
wsl --import Ubuntu D:\VMs\WSL\Ubuntu\ ubuntu.tar --version 2
View .wslconfig
karthiks / database.js
Created Sep 5, 2020
The Workaround Configuration to connect to MongoDB Atlas
View database.js
module.exports = ({ env }) => ({
defaultConnection: 'default',
connections: {
default: {
connector: 'mongoose',
settings: {
host: env('DATABASE_HOST', ',,'),
srv: env.bool('DATABASE_SRV', false),
port:'DATABASE_PORT', 27017),
database: env('DATABASE_NAME', 'cmsdb'),