Skip to content

Instantly share code, notes, and snippets.

@mfridman
mfridman / README.md
Created November 15, 2022 01:56 — forked from reegnz/README.md
CamelCase <--> snake_case conversion in jq

CamelCase <--> snake_case conversion with jq

tl;dr

I provide you with 3 jq lib functions that will help you in converting between snake_case and CamelCase.

The interface

I want to change keys in my json from camelcase to snake_case.

@mfridman
mfridman / ANSI.md
Created May 21, 2022 00:45 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@mfridman
mfridman / postgres_queries_and_commands.sql
Created March 3, 2021 19:03 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@mfridman
mfridman / drone.pr
Created April 1, 2020 23:48 — forked from woky/drone.pr
CI=drone
CI_BUILD_CREATED=1538244194
CI_BUILD_EVENT=pull_request
CI_BUILD_FINISHED=1538244196
CI_BUILD_LINK=https://github.com/rchain-drone/droneci-test/pull/2
CI_BUILD_NUMBER=2
CI_BUILD_STARTED=1538244194
CI_BUILD_STATUS=success
CI_COMMIT_AUTHOR=woky
CI_COMMIT_AUTHOR_AVATAR=https://avatars0.githubusercontent.com/u/620147?v=4
@mfridman
mfridman / rsa_util.go
Created October 23, 2019 04:01 — forked from miguelmota/rsa_util.go
Golang RSA encrypt and decrypt example
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)
@mfridman
mfridman / PostgreSQL_index_naming.rst
Created September 12, 2019 03:58 — forked from popravich/PostgreSQL_index_naming.rst
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
@mfridman
mfridman / client_tls_info.go
Created March 6, 2019 04:58 — forked from husobee/client_tls_info.go
discovery of tls in go, and the handshake process
package main
import (
"crypto/tls"
"encoding/json"
"fmt"
"log"
"net"
"net/http"
)
@mfridman
mfridman / Makefile
Created December 1, 2018 21:01 — forked from kwilczynski/Makefile
Makefile for my Go projects (an example).
SHELL := /bin/bash
REV := $(shell git rev-parse HEAD)
CHANGES := $(shell test -n "$$(git status --porcelain)" && echo '+CHANGES' || true)
TARGET := packer-provisioner-itamae-local
VERSION := $(shell cat VERSION)
OS := darwin freebsd linux openbsd
ARCH := 386 amd64
@mfridman
mfridman / osx-for-hackers.sh
Created July 1, 2017 18:13 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx