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 / shpod.sh
Created November 27, 2020 15:49
Use by jpetazzo/shpod
#!/bin/sh
# For more information about shpod, check it out on GitHub:
# https://github.com/jpetazzo/shpod
if [ -f shpod.yaml ]; then
YAML=shpod.yaml
else
YAML=https://raw.githubusercontent.com/jpetazzo/shpod/main/shpod.yaml
fi
if [ "$(kubectl get pod --namespace=shpod shpod --ignore-not-found -o jsonpath={.status.phase})" = "Running" ]; then
echo "Shpod is already running. Starting a new shell with 'kubectl exec'."
@mfridman
mfridman / keybase.md
Created April 10, 2020 21:51
keybase verification

Keybase proof

I hereby claim:

  • I am mfridman on github.
  • I am mfridman (https://keybase.io/mfridman) on keybase.
  • I have a public key ASD8IctnpjfkN7GaqWz3CbyzFw7G41jmed9Up4IMoP45fAo

To claim this, I am signing this object:

@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 / top-50.md
Last active November 26, 2019 01:45
top 50 project (by stars) using goreleaser
@mfridman
mfridman / five.md
Created November 24, 2019 23:33
top 5 most common .goreleaser files

10666361bf2ddb7070c9ea6756b1e8ce327a9edb

8 found

builds:
  # List of builds
  - # First Build
    env:
    - CGO_ENABLED=0
@mfridman
mfridman / large_go_files.md
Created November 10, 2019 21:54
large go files
file_path autogen line_count
CiscoDevNet/ydk-go/ydk/models/cisco_ios_xe/native/native.go f 1372946
Xmader/gse-wasm/src/dict/jp_full.go f 885305
src-d/go-git-fixtures/data.go f 807978
knqyf263/go-cpe/testing/dictionary_test.go f 643279
Xmader/gse-wasm/src/dict/dictionary.go f 589040
CiscoDevNet/ydk-go/ydk/models/cisco_ios_xr/ipv4_bgp_oper/ipv4_bgp_oper.go f 577265
deroproject/derosuite/checkpoints/mainnet_checksums.go f 570973
reusee/go-qt/smoke_info/info.go f 559236
@mfridman
mfridman / find-top.sql
Created November 8, 2019 04:40
finding top comments
WITH votes AS (
SELECT
number_id,
id,
SUM(CAST(plus_one + 1 AS FLOAT)) AS U,
SUM(CAST(minus_one + 1 AS FLOAT)) AS D
FROM
comments
GROUP BY
id,