Skip to content

Instantly share code, notes, and snippets.

View cdmatta's full-sized avatar

Charandeep Matta cdmatta

  • Helsinki, Finland
View GitHub Profile
@cdmatta
cdmatta / yaml_dump.py
Created November 5, 2024 08:01
Python dump yaml to text correctly
import yaml
# https://stackoverflow.com/questions/25108581/python-yaml-dump-bad-indentation
class FixIndentationDumper(yaml.Dumper):
def increase_indent(self, flow=False, indentless=False):
return super(FixIndentationDumper, self).increase_indent(flow, False)
def yaml_dump(obj: dict) -> str:
@cdmatta
cdmatta / log_util.py
Created November 3, 2024 10:47
Python3 color log output with no additional packages
import logging
date_format = "%Y-%m-%dT%H:%M:%S"
log_format = "%(asctime)s.%(msecs)03d %(levelname)s %(message)s"
class LogFormatter(logging.Formatter):
white = "\x1b[37;20m"
blue = "\x1b[34;20m"
@cdmatta
cdmatta / rust-command-line-utilities.markdown
Created November 14, 2022 10:10 — forked from sts10/rust-command-line-utilities.markdown
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, exa, fd, hyperfine, miniserve, ripgrep, just, zoxide and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
  • bat: A replacement for cat that provides syntax highlighting and other features.
  • bottom: Yet another cross-platform graphical process/system monitor.
@cdmatta
cdmatta / main.go
Created April 14, 2022 10:21
Gin, Golang, Embed FE host at / and backend at /api
package main
import (
"embed"
"fmt"
"io/fs"
"net/http"
"strings"
"github.com/gin-gonic/gin"
@cdmatta
cdmatta / Check.java
Created April 14, 2018 21:14
Jackson custom annotations. Create alternate serialization of the object maintaining the original serialization intact.
package jackson;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
public class Check {
public static void main(String[] args) throws Exception {
Person person = new Person("George G. Shelton", "4444555566667890", "010199-111T");
System.out.println("To String = " + person);
@cdmatta
cdmatta / UndertowAccessLogApplication.java
Created April 12, 2018 21:13
Spring boot + Undertow access log, capture/record request processing time. Customize UndertowWebServerFactory
package io.cm.accesslog;
import io.undertow.Undertow;
import io.undertow.UndertowOptions;
import io.undertow.server.handlers.accesslog.AccessLogHandler;
import io.undertow.server.handlers.accesslog.AccessLogReceiver;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;