Skip to content

Instantly share code, notes, and snippets.

View devraj's full-sized avatar
🚀
Building

Dev Mukherjee devraj

🚀
Building
View GitHub Profile
@devraj
devraj / untitled.md
Created February 14, 2026 05:08
Created with FancyGist
Column 1 Column 2 Column 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6

This is a quote that spans multiple lines

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.

/

@devraj
devraj / pydantic_aws.py
Created April 12, 2025 03:00
Pydantic AWS Secrets Manager data source - reference implementation
""" AWS Secrets Manager Source
This is a custom source for pydantic settings that will read from
AWS Secrets Manager. There are some particulars that make the
scenario a little more complex than a simple environment variable.
S3 bucket names have to be unique across a region, to facilitate this
use we a hash appended to the bucket name, this makes it impossible
for us to know the bucket name at build time.
@devraj
devraj / mapkitjs-demo.js
Created November 26, 2024 21:10
Rudimentary MapKitJS demonstration, showing autocomplete and basic marker features
var map = null;
function initMapKit() {
console.log("Initialising MapKit");
}
function showBasicMap() {
const centerCoordinate = new mapkit.Coordinate(37.7749, -122.4194); // San Francisco
const span = new mapkit.CoordinateSpan(0.1, 0.1);
@devraj
devraj / helm_install.tf
Last active July 5, 2023 04:19
HCL clip to install your own apps via terraform
# This demonstrates the deployment of our application via a helm chart
# which is hosted in Github container registry
resource "helm_release" "lab-python-mock-server" {
name = "lab-python-mock-server"
repository = "oci://ghcr.io/anomaly/charts"
chart = "lab-python-mock-server"
namespace = "lab-python-mock-server"
create_namespace = true
@devraj
devraj / rename_sequential.sh
Last active September 12, 2023 02:05
Takes the contents a folder and renames them into filenames with sequential file names e.g 001.jpg, 002,jpg
let counter=1;\
for filename in *; do\
new_filename=$(printf "%03d.png" $counter);\
print "$filename -> $new_filename";\
let counter=counter+1;\
mv "${filename}" $new_filename;\
done
@devraj
devraj / celery.py
Last active February 25, 2025 18:41
SQLAlchemy asyncio calls from within a Celery task
# We've been trying to figure out how to run async code from
# Celery until it gets support for it
#
# This is an extracted example which should fit into
# https://github.com/anomaly/lab-python-server
import asyncio
from uuid import UUID
from sqlalchemy.ext.asyncio import AsyncSession
from ...celery import app
@devraj
devraj / Seo.js
Created July 27, 2021 04:55
SEO component for Gatsby with Twitter card
import React from "react"
import PropTypes from "prop-types"
import { Helmet } from "react-helmet"
import { useStaticQuery, graphql } from "gatsby"
function Seo({ description, lang, meta, image: metaImage, title, pathname }) {
const { site } = useStaticQuery(
graphql`
query {
site {
siteMetadata {
@devraj
devraj / migrate_python_project.sh
Last active June 6, 2020 01:45
Changes directory names and package reference of a Docker + Python project
# Created for internal project automation, might not be releveant for others
# except as a learning exercise for bash tricks
# Portions require revision to make it more efficient - produciton like :)
# Please use a template for your own work.
# Change names of directories
FROM="proj1"; TO="proj2"; for FROM_DIR in `find . -name $FROM`; do if [ -d $FROM_DIR ]; then TARGET_DIR=`echo $FROM_DIR | sed "s/$FROM/$TO/g"`; echo $FROM_DIR ">" $TARGET_DIR; mv $FROM_DIR $TARGET_DIR; fi ; done
# Replace references to package names
@devraj
devraj / UIButton+alignTextUnderImage
Last active March 28, 2019 00:55
UIButton with Text Positioned under an image
import UIKit
// https://stackoverflow.com/questions/37915212/storyboard-positioning-text-below-image-inside-a-button/37915362
public extension UIButton
{
func alignTextUnderImage(spacing: CGFloat = 6.0)
{
if let image = self.imageView?.image
{
@devraj
devraj / gist:48c8e2f7aba627ab6449b8c14d3a910b
Created September 7, 2018 05:21
Google Maps places link
https://www.google.com.au/maps/place/Upstairs+Startup+Hub/@-33.4193161,149.5785152,17z/data=!3m1!4b1!4m5!3m4!1s0x6b11e43377353da3:0x82364adf2642ade1!8m2!3d-33.4193161!4d149.5807039