Skip to content

Instantly share code, notes, and snippets.

@vasansr
vasansr / csv2sql.pl
Created December 31, 2016 07:26
Create SQL commands based on a CSV file (perl)
#!/usr/bin/perl
#
use Text::CSV_XS;
use IO::Handle;
use Getopt::Long;
sub usage {
print "Usage: csv2sql.pl [OPTIONS] <csvfile>\n";
print "Dump sql statements based on input csv\n";
@vasansr
vasansr / log2query.py
Created December 31, 2016 07:31
Create queries from PG Logs
#!/usr/bin/python
#
# Convert a log snippet to an actual executable query, by replacing
# all $1 $2 etc. with the parameters in the following line.
# TODO: handle statements spanning multiple lines (\n in the query itself).
#
import io
import sys
@vasansr
vasansr / vim_tricks.txt
Created December 31, 2016 07:33
Useful vim Tricks
_Convert tabs to spaces_
:set expandtab
:%retab
_indent region_
(select region, use v or V)
=
_indent region (alt)_
(mark using m')
@vasansr
vasansr / aws_create_users_ubuntu.sh
Last active November 8, 2024 14:25
AWS User Data Script to create users when launching an Ubuntu server EC2 instance
#!/bin/bash
#
# Initial script to create users when launching an Ubuntu server EC2 instance
#
declare -A USERKEY
#
# Create one entry for every user who needs access. Be sure to change the key to their
@vasansr
vasansr / docs.mk
Last active March 30, 2023 04:38
Python script to generate markdown format documentation from Thunder Client collections.
GENERATED=api-docs/.generated
THUNDER_FILES=thunder-tests/thunderclient.json
$(GENERATED): $(THUNDER_FILES)
python gen-api-docs.py
touch $(GENERATED)
@vasansr
vasansr / docs.mk
Created March 30, 2023 04:36
Makefile to detect changes and generate api docs for Thunder Client
GENERATED=api-docs/.generated
THUNDER_FILES=thunder-tests/thunderclient.json
$(GENERATED): $(THUNDER_FILES)
python gen-api-docs.py
touch $(GENERATED)