Skip to content

Instantly share code, notes, and snippets.

@rameshvr
rameshvr / clean_code
Created May 10, 2025 15:48
clean_code
Meaningful Names: Name variables and functions to reveal their purpose, not just their value.
One Function, One Responsibility: Functions should do one thing.
Avoid Magic Numbers: Replace hard-code values with named constants to give them meaning.
Use Descriptive Booleans: Boolean names should state a condition, not just its value.
Keep Code DRY: Duplicate code means duplicate bugs. Try and reuse logic where it makes sense.
@rameshvr
rameshvr / gist:faa2d08eeab1a2197a5a611ce354039d
Last active March 19, 2024 14:00
React Native - iOS Reset
yarn cache clean
pod cache clean --all
rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx
annotations:
ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
@rameshvr
rameshvr / convert-postman-to-insomnia.js
Created October 4, 2023 21:35 — forked from wesleyegberto/convert-postman-to-insomnia.js
Script to convert a Postman backupt to Insomnia
/**
* Script to parse a Postman backupt to Insomnia keeping the same structure.
*
* It parses:
* - Folders
* - Requests
* - Environments
*
* Notes: Insomnia doesn't accept vars with dots, if you are using you must replace yours URLs manually (see ENVIRONMENTS_EXPORTS).
*/
#!/bin/sh
sudo yum upgrade
# list kernals (old + current)
rpm -q kernel
# verify current kernal
uname -a
@rameshvr
rameshvr / steps.md
Created June 7, 2023 15:20
Configure Sonarlint Mac Zulu OpenJDK

Configure Sonarlint Mac Zulu OpenJDK

Below steps will help to configure sonarlint to connect to sonarqube.

Configuration

  • OS: Mac
  • Java: Azul Zulu11 OpenJDK
  • VS Code
  • Sonarlint Extension

Troubleshooting

@rameshvr
rameshvr / package.json
Created January 23, 2023 21:25
React Native - Custom device simulator and port
"scripts": {
"android": "npm i && react-native run-android",
"clean": "(cd android && ./gradlew clean) && (cd ios && xcodebuild clean)",
"ios": "npm i && npm run ios:pods && react-native run-ios --port 8098 --simulator='iPhone 14 Pro' ",
"ios:pods": "(cd ios && pod install)",
"ios:pods:update": "(cd ios && pod install --repo-update)",
"reset": "watchman watch-del-all && react-native start --reset-cache",
"start": "react-native start --port 9988 --reset-cache",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@rameshvr
rameshvr / mac firewall controls cli .txt
Last active January 4, 2021 16:26
mac firewall controls cli
To turn the firewall off :
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 0
To turn the firewall on for specific applications/services :
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1
To turn the firewall on for essential services like DHCP and ipsec, block all the rest :
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 2
@rameshvr
rameshvr / list_by_size.sh
Last active January 23, 2023 21:26
list directories and their total sizes and sort based on size
du -sh * | sort -h ----- list directories and their total sizes and sort based on size