Skip to content

Instantly share code, notes, and snippets.

View ri5h's full-sized avatar
πŸ‘¨β€πŸ’»
Working from home

Rishiraj Purohit ri5h

πŸ‘¨β€πŸ’»
Working from home
View GitHub Profile
@ri5h
ri5h / test.html
Created September 23, 2024 16:18
path
https://docs.google.com/document/d/1W9TBqAzTKzjMKGe4JqveQj1XuR3kyNVGR6RRUpHkozU/edit?usp=sharing
@ri5h
ri5h / terraform-tfvars-map-to-keys-conversion.md
Created May 26, 2023 12:57
Chatgpt convo : Converting a Terraform `.tfvars` Map into a List of Keys

Sure! Here's a markdown document of the question and answer:


Converting a Terraform .tfvars Map into a List of Keys

Question:

I have a map of key-value pairs in a Terraform .tfvars file that is used in variables and is available. How do I convert this into a list of just the keys from the map?

@ri5h
ri5h / find_and_replace.sql
Created May 18, 2023 19:00
find and replace value in a column - Postgres
-- find and replace value in a column
update editors set hourly_rate = replace(hourly_rate, ',', '')
@ri5h
ri5h / find_duplicates.sql
Created May 18, 2023 12:10
Find duplicates in postgres database table
select * from skills u join skills u2
on upper(u.name)=upper(u2.name) where u.id != u2.id
order by u.name;
@ri5h
ri5h / fix.md
Created December 6, 2022 17:09
Cannot find module '@strapi/icons/Puzzle' or its corresponding type declarations.

I was having this problem after:

  1. Generated a typescript plugin for latest strapi v4 generated with quickstart and using typescript.
  2. ran yarn build

fix: I tried many things so not sure which combination of things worked.

  • deleted node_modules
  • updated yarn to yarn 3 (yarn set version stable)
  • ran yarn install
  • installed "@strapi/design-system": "^1.4.0" and "@strapi/icons": "^1.4.0" as per some solutions mentioned online
  • update the actual code to import { Puzzle } from '@strapi/icons'; from import Puzzle from '@strapi/icons/Puzzle';
<head>
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@flickr" />
<meta name="twitter:title" content="Small Island Developing States Photo Submission" />
<meta name="twitter:description" content="View the album on Flickr." />
<meta name="twitter:image" content="https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg" />
<meta property="og:url" content="http://www.nytimes.com/2015/02/19/arts/international/when-great-minds-dont-think-alike.html" />
<meta property="og:type" content="article" />
<meta property="og:title" content="When Great Minds Don't Think Alike" />
@ri5h
ri5h / mksites.py
Created November 20, 2020 18:27
Create a new localhost site with domain in macos, please change the user value and path as required
#!/usr/bin/env python3
import argparse
from pathlib import Path
# Define available arguments
parser = argparse.ArgumentParser(
description="Create a new .loc site for local development. It will create a new folder inside ~/Sites, add a virtualhost and an entry in /etc/hosts")
parser.add_argument('siteName', metavar='Site Name',
help='Name of the site to create')
parser.add_argument('--debug', help='display debug information')
@ri5h
ri5h / versionInfo.py
Created September 28, 2020 22:41
Finding versions with semantic-version library
for package in reqPack:
finalPackageResult = {
'name': package
}
# Find current installed version
try:
cur_ver = semver.Version.coerce(inPack[package])
except ValueError:
if re.search("^v[0-9].*$", inPack[package]):
@ri5h
ri5h / packagistInfo.py
Created September 28, 2020 22:36
Read package info from packagist
# Read the latest version available from packagist
finalRes = []
for package in reqPack:
finalPackageResult = {
'name': package
}
# Try to get info from packagist (works with or w/o repo)
url = 'https://repo.packagist.org/packages/' + package + '.json'
jsonMetaRes = requests.get(url)
@ri5h
ri5h / composerInfo.py
Created September 28, 2020 22:32
Read composer.json and composer.lock
# Which directory have composer.json and composer.lock
parser = argparse.ArgumentParser()
parser.add_argument('--path', help='Relative directory that contains the composer files')
cdir = parser.parse_args().path
# Reads composer.json for constraints
reqPack = {}
with open(cdir +'/composer.json') as json_file:
data = json.loads(json.dumps(json.load(json_file)))
for package in data['require']: