Skip to content

Instantly share code, notes, and snippets.

View lidalei's full-sized avatar

Dalei Li lidalei

  • FareHarbor
  • The Netherlands
View GitHub Profile
@pksunkara
pksunkara / config
Last active June 29, 2024 11:23
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[init]
defaultBranch = master
[core]
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
@niksumeiko
niksumeiko / git.migrate
Last active June 28, 2024 21:01
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active June 24, 2024 03:28
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

public static final String ANSI_RESET = "\u001B[0m";
public static final String ANSI_BLACK = "\u001B[30m";
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_GREEN = "\u001B[32m";
public static final String ANSI_LIGHT_YELLOW = "\u001B[93m";
public static final String ANSI_YELLOW = "\u001B[33m";
public static final String ANSI_YELLOW_BACKGROUND = "\u001B[43m";
public static final String ANSI_BLUE = "\u001B[34m";
public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_CYAN = "\u001B[36m";
@sanchezzzhak
sanchezzzhak / clickhouse-get-tables-size.sql
Created January 18, 2018 13:43
clickhouse get tables size
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@miguelmota
miguelmota / logrus_hooks.go
Last active September 7, 2021 07:27
Golang Logrus show filename and line number
package logger
import (
"fmt"
"path"
"runtime"
"github.com/sirupsen/logrus"
)
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active June 29, 2024 04:08
set -e, -u, -o, -x pipefail explanation
@zulhfreelancer
zulhfreelancer / zsh-timestamp.md
Last active February 12, 2024 14:52
How to add timestamp on right hand side of ZSH / iTerm2 terminal prompt?

Add the following snippet at the bottom of ~/.zshrc file.

Option 1 - Just time

RPROMPT='[%D{%L:%M:%S}] '$RPROMPT
@justinfx
justinfx / read_proto_desc.py
Created July 14, 2019 06:15
Dynamically reading a Protobuf FileDescriptorSet file into Python message classes
#!/usr/bin/env python
"""
Read a serialized Protobuf FileDescriptorSet that was
generated from the protoc tool, and dynamically generate
the python classes for each message.
"""
import sys
from google.protobuf import descriptor_pb2
from google.protobuf import reflection
@etigui
etigui / python_naming_conventions.md
Last active June 3, 2024 15:25
Python naming conventions

Python naming conventions

This document gives coding conventions example for the Python code. This style guide evolves over time as additional conventions are identified and past conventions are rendered obsolete by changes in the language itself.

1. General

  • Avoid using names that are too general or too wordy. Strike a good balance between the two.
    • Bad: data_structure, my_list, info_map, dictionary_for_the_purpose_of_storing_data_representing_word_definitions
    • Good: user_profile, menu_options, word_definitions
  • Never use the characters as single character variable names:
  • “l“ : lowercase letter el