Skip to content

Instantly share code, notes, and snippets.

View surendra-wal's full-sized avatar

Surendra surendra-wal

View GitHub Profile
@surendra-wal
surendra-wal / create-opensearch-domain.sh
Created February 20, 2024 07:21
create opensearch domain in localstack
#!/bin/bash
export AWS_ACCESS_KEY_ID="test"
export AWS_SECRET_ACCESS_KEY="test"
export AWS_DEFAULT_REGION="us-east-2"
ENDPOINT_URL="http://localhost:4566"
echo "Creating OpenSearch Domain"
echo "$(aws opensearch create-domain --endpoint-url=$ENDPOINT_URL --domain-name local-messenger-search --advanced-security-options Enabled=false) created"
@surendra-wal
surendra-wal / pr_title_validation.yml
Last active November 26, 2023 18:15
pr_title_validation.yml
name: Check PR title
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
@surendra-wal
surendra-wal / backmerge_to_release_branch_or_dev.yml
Last active September 23, 2023 20:09
backmerge_to_release_branch_or_dev.yml
name: Backmerge to release branch or dev
on:
workflow_call:
secrets:
TODO_GITHUB_TOKEN:
required: true
jobs:
back-merge-to-release:
uses: ./.github/workflows/backmerge_to_lower_branch.yml
@surendra-wal
surendra-wal / backmerge_to_lower_branch.yml
Created September 23, 2023 19:39
backmerge_to_lower_branch.yml
name: Backmerge to lower branch
on:
workflow_call:
inputs:
BRANCH_TO_UPDATE:
required: true
type: string
secrets:
TODO_GITHUB_TOKEN:
required: true
@surendra-wal
surendra-wal / release.yml
Last active November 26, 2023 18:10
release.yml
name: Release
on:
push:
branches:
- release
- main
jobs:
release:
name: release
runs-on: ubuntu-latest
@surendra-wal
surendra-wal / release-config.js
Last active November 26, 2023 18:15
release config
const config = {
// Define the branches where releases are allowed
branches: ['main', { name: 'release', prerelease: true }],
plugins: [
[
'@semantic-release/commit-analyzer', // Use the commit-analyzer plugin to analyze commit messages.
{
preset: 'conventionalcommits',
releaseRules: [
{ type: 'docs', scope: 'README', release: 'patch' }, // For 'docs' commits with scope 'README', release a patch version.
@surendra-wal
surendra-wal / read-access-pg-user.sql
Last active November 12, 2021 13:39
Create user in postgres with read only access
--
-- Read only
--
-- Create a group
CREATE ROLE cents_rd_group;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO cents_rd_group;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO cents_rd_group;
@surendra-wal
surendra-wal / inventory-changes.md
Last active November 26, 2020 04:00
Inventory item changes for per pay order

Inventoty will be updated right after an newItem/updateItem/deleteItem for pre pay orders

NewItem

inventoryObj() {
    const changeInQuantity = -this.item.count;
    const inventoryItemId = this.item.priceId;
    return { changeInQuantity, inventoryItemId };
}

EditItem

Automate API documentation with specs and CI/CD pipeline
API documentation is very important to any application. This helps Mobile, Frontend developers and other API consumers for easy integration.
There are a couple of ways to maintain the documentation
Maintain separate repo to manage API documentation. So that they don’t commit every change of API docs into the codebase.
Use the same repo having docs or some other folder to manually update when there is a change in the APIs
It is very difficult to manually maintain the API documentation for every change. How can we automate this?
@surendra-wal
surendra-wal / web-servers.md
Created January 18, 2020 18:28 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000