Skip to content

Instantly share code, notes, and snippets.

View natserract's full-sized avatar

Alfin S. natserract

View GitHub Profile
@jsugarman
jsugarman / gist:87092900735b34f4b368074e62a86dc3
Last active March 12, 2025 22:35
install postgis on mac (M1 chip) OSX (sonoma) with postgresql@16
# Need to remove existing postgis and must not have postgresql@14 present
[brew remove postgis]
[brew remove postgresql@14]
# reinstall json-c once above are removed
brew uninstall json-c
brew install json-c
brew link json-c
# install postgresql@16 if not already installed - check version specific path
@theaog
theaog / update-golang.sh
Last active August 12, 2025 07:43
update-golang.sh
#!/usr/bin/env bash
set -e
tmp=$(mktemp -d)
pushd "$tmp" || exit 1
function cleanup {
popd || exit 1
rm -rf "$tmp"
}
@wiseman
wiseman / agent.py
Last active April 21, 2025 17:37
Langchain example: self-debugging
from io import StringIO
import sys
from typing import Dict, Optional
from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.agents.tools import Tool
from langchain.llms import OpenAI
@zempo
zempo / Custom React Hooks
Last active October 26, 2022 14:06
My collection of custom React Hooks
My ongoing collection of custom react hooks.
I always reference this snippet whenever starting a new react project.
@khushal87
khushal87 / blog3.md
Last active July 21, 2025 07:23
Linking a custom domain from Google domains to Vercel app

Linking a custom domain to a deployed application is confusing and at times you don't get a route on how to link the domain with the website. 😫

In this article, I will be explaining how to link a Custom domain brought in Google Domains service to an application hosted on Vercel.

Perks of using vercel is that it allows adding domain without any verification unlike Heroku/Netlify, which means you don't have to add your billing details to add a domain to your application. Moreover, it is fast, efficient, and easy to use.😁

What is Vercel?

​Vercel is a deployment and collaboration platform for frontend developers. ​Vercel enables developers to host websites and web services that deploy instantly and scale automatically – all without any configuration. Source - Official Docs

@Sqvall
Sqvall / file-upload.tsx
Last active February 17, 2025 17:43
File Upload with Chakra UI and react-hook-form
import { ReactNode, useRef } from 'react'
import { Button, FormControl, FormErrorMessage, FormLabel, Icon, InputGroup } from '@chakra-ui/react'
import { useForm, UseFormRegisterReturn } from 'react-hook-form'
import { FiFile } from 'react-icons/fi'
type FileUploadProps = {
register: UseFormRegisterReturn
accept?: string
multiple?: boolean
children?: ReactNode
@zgunz42
zgunz42 / bulkdns.js
Created December 12, 2020 05:53
bulk delete dns record cloudflare
const axios = require('axios').default;
const _ = require('lodash');
const email = '<email>';
const key = '<global_key>';
const zone = '<zone>'
const url = `https://api.cloudflare.com/client/v4/zones/${zone}/dns_records`
function deleteRec(dns) {
@EQuimper
EQuimper / useScrollRestoration.ts
Created September 20, 2020 01:31
NextJS save scroll position between page for back handler
import React from 'react';
import Router, { NextRouter } from 'next/router';
// Save the scroll position for the given url
function saveScrollPosition(
url: string,
element: HTMLElement,
savePosition: (url: string, pos: number) => void
) {
@mbuhot
mbuhot / opaque_user.ex
Created September 14, 2020 23:38
Enforcing smart constructor in Elixir
defmodule Opaque.User do
@moduledoc """
Demonstrates a ridiculous method for enforcing that a type remains in a valid state using a closure and internal secret
"""
alias __MODULE__
# Ensure that the internal closure can only be called from within this module
@update_key :crypto.strong_rand_bytes(8)
@taliesinb
taliesinb / math-unicode-symbols.txt
Last active January 12, 2025 04:47
List of useful mathematical unicode symbols
ALMOST EQUAL TO ≈
ANGLE ∠
ASTERISK OPERATOR ∗
ASYMPTOTICALLY EQUAL TO ≃
BALLOT X ✗
BLACK RIGHTWARDS ARROWHEAD ➤
BLACK SQUARE ■
BOTTOM SQUARE BRACKET ⎵
CHECK MARK ✓
CIRCLED PLUS ⊕