Skip to content

Instantly share code, notes, and snippets.

@kaashyapan
kaashyapan / gist:cb99b6f40699519bfb009c86821d62b9
Created July 3, 2025 19:27 — forked from yuezhu/gist:47b15b4b8e944221861ccf7d7f5868f5
Generate self-signed certificate for HAProxy
# Generate a unique private key (KEY)
sudo openssl genrsa -out mydomain.key 2048
# Generating a Certificate Signing Request (CSR)
sudo openssl req -new -key mydomain.key -out mydomain.csr
# Creating a Self-Signed Certificate (CRT)
openssl x509 -req -days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt
# Append KEY and CRT to mydomain.pem
@kaashyapan
kaashyapan / symbol_use.fsx
Created May 12, 2025 00:27 — forked from baronfel/symbol_use.fsx
example of using the F# compiler APIs to get usage of symbols
#r "FSharp.Compiler.Service.dll"
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Text
open FSharp.Compiler.Syntax
module Helpers =
type LetPrivateWalker() =
inherit SyntaxVisitorBase<range>()
@kaashyapan
kaashyapan / generate_ulid.sql
Created March 30, 2025 04:09 — forked from erikhoward/generate_ulid.sql
PostgreSQL function to generate an unique ID of type ULID
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE OR REPLACE FUNCTION generate_ulid() RETURNS uuid
AS $$
SELECT (lpad(to_hex(floor(extract(epoch FROM clock_timestamp()) * 1000)::bigint), 12, '0') || encode(gen_random_bytes(10), 'hex'))::uuid;
$$ LANGUAGE SQL;
@kaashyapan
kaashyapan / DragDropPage.fs
Created October 11, 2024 06:00 — forked from JordanMarr/DragDropPage.fs
Fable bindings for "react-dnd" using HTML5 provider
module DragDropPage
open Feliz
open Fable.React
open Fable.React.Props
open ReactDND
type Language = {
Name: string
}
@kaashyapan
kaashyapan / ConstrainedTypesExamples.fsx
Created November 23, 2021 03:00 — forked from swlaschin/ConstrainedTypesExamples.fsx
Examples of creating constrained types in F#
// General hints on defining types with constraints or invariants
//
// Just as in C#, use a private constructor
// and expose "factory" methods that enforce the constraints
//
// In F#, only classes can have private constructors with public members.
//
// If you want to use the record and DU types, the whole type becomes
// private, which means that you also need to provide:
// * a constructor function ("create").
@kaashyapan
kaashyapan / README.md
Created April 11, 2018 13:02 — forked from alexvictoor/README.md
First steps with Flatbuffers in Javascript

This is a tiny sample to help you get up to speed with flatbuffers, javascript flavor. This gist contains a flatbuffers schema, tick.fbs, and the related generated javascript code, tick_generated.js . The git does not include flatbuffers.js itself, you can download it from flatbuffers github repository.
In index.html you will find a simple code fragment showing how to build a flatbuffer "Tick" buffer and how to read a Tick object out of an array of bytes.

If you want to change the model, hence the schema, you need the 'flatbuffers compiler', available for download on flatbuffers release page Then you can use the following command line:

flatc -s tick.fbs --gen-mutable

#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@kaashyapan
kaashyapan / elixir.spacemacs
Last active August 13, 2017 07:19 — forked from sircharleswatson/.spacemacs
spacemacs dotfile
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory