Skip to content

Instantly share code, notes, and snippets.

{
"audio": {
"hasPlaylist": false,
"isRealtime": true,
"streamUrl": "http://sverigesradio.se"
},
"imageUrl": "",
"name": "Sveriges Radio P1",
"streamType": "liveRadio"
}
@ChiliMonanta
ChiliMonanta / connector.py
Last active May 23, 2019 11:55
npgsql detect connector leakage
import re
import time
# Detect connector leakage for npgsql
# Set DEBUG mode on Npgsql (https://github.com/npgsql/npgsql/blob/dev/src/Npgsql/NpgsqlConnection.cs)
# Set path to log file
filePath = 'the.log'
opened_connectors = {}
@ChiliMonanta
ChiliMonanta / cli cheatsheet.md
Last active April 11, 2024 14:10
cli cheatsheet, linux, bash

jq

curl http://stedolan.github.io/jq/download/linux64/jq -o ~/bin_compciv/jq
chmod a+x ~/bin_compciv/jq    
curl -s https://status.github.com/api/status.json | jq '.'
more info:
    http://www.compciv.org/recipes/cli/jq-for-parsing-json/

Columns in one line:

echo '[{"name":"A","id":"1"}]' | jq -r '.[] | "(.id)\t(.name)"'

@ChiliMonanta
ChiliMonanta / git cheatsheet.md
Last active November 9, 2020 15:26
git cheatsheet

Stash

Show recent content
git stash show -p

Show arbitrary
git stash show -p stash@{1}

One file

git stash -- filename.txt

@ChiliMonanta
ChiliMonanta / aws cheatsheet.md
Created March 21, 2019 10:15
aws cheatsheet

AWS kms

Endcode:

aws kms encrypt --key-id alias/<the key> --plaintext '{"api_key":"<api_key>", "app_key":"<dd_app_key>"}'

Decode (windows)

set source=%1

call certutil -decode %source% "%source%_decoded"

@ChiliMonanta
ChiliMonanta / postgres cheatsheet.md
Last active November 7, 2023 08:49
postgres cheatsheet

Postgres pgadmin

psql

Connect to postgres

psql -U postgres -h <uri> -p 5432

Some commands

@ChiliMonanta
ChiliMonanta / tinyweb.py
Created December 10, 2018 07:48
A slim web server to inspect callbacks
#!/usr/bin/python3
import http.server
import json
class Handler(http.server.SimpleHTTPRequestHandler) :
def do_GET(s) :
print('-----------------------')
print('GET %s (from client %s)' % (s.path, s.client_address))
print(s.headers)
s.send_response(200)
s.end_headers()
@ChiliMonanta
ChiliMonanta / example-static-webpage
Created April 5, 2018 05:08
Temporary static web pages on AWS S3
main.tf
provider "aws" {
region = "eu-west-1"
profile = "my-aws"
}
resource "aws_s3_bucket" "bucket" {
bucket = "www.downloads.spock.test-domain.com"
acl = "private"