Skip to content

Instantly share code, notes, and snippets.

View aK0nshin's full-sized avatar
:octocat:
Working from home

Alexander aK0nshin

:octocat:
Working from home
View GitHub Profile
@CSTDev
CSTDev / auto-increment-version.sh
Last active October 23, 2024 23:42
Script that will find the last Git Tag and increment it. It will only increment when the latest commit does not already have a tag. By default it increments the patch number, you can tell it to change the major or minor versions by adding #major or #minor to the commit message.
#!/bin/bash
#get highest tag number
VERSION=`git describe --abbrev=0 --tags`
#replace . with space so can split into an array
VERSION_BITS=(${VERSION//./ })
#get number parts and increase last one by 1
VNUM1=${VERSION_BITS[0]}
@CAFxX
CAFxX / golang_minimize_allocations.md
Last active March 9, 2025 14:32
Minimize allocations in Go

📂 Minimize allocations in Go

A collection of tips for when you need to minimize the number of allocations in your Go programs.

Use the go profiler to identify which parts of your program are responsible for most allocations.

⚠️ Never apply these tricks blindly (i.e. without measuring the actual performance benefit/impact). ⚠️

Most of these tricks cause a tradeoff between reducing memory allocations and other aspects (including e.g. higher peak memory usage, higher CPU usage, lower maintainability, higher probability of introducing subtle bugs). Only apply these tricks if the tradeoff in every specfic case is globally positive.

@huklee
huklee / MyLogger.py
Last active October 11, 2024 00:30
python Logger using example with Singleton Pattern
# -*- coding: utf-8 -*-
import logging
import os
import datetime
import time
class SingletonType(type):
_instances = {}
@azami
azami / sample.py
Last active October 11, 2020 12:18
SQLAlchemy Core Sample with relationship and polymorphic
# -*- coding: utf-8 -*-
from sqlalchemy import create_engine, func
from sqlalchemy import Table, Column, Integer, String, DateTime, MetaData, ForeignKey
from sqlalchemy.pool import NullPool
from sqlalchemy.orm import mapper, sessionmaker, relationship
params = {'user': 'admin',
'password': 'password',
'host': 'localhost',
@ciarans
ciarans / app.php
Last active March 8, 2022 12:16
Add Graylog to Laravel
$app->configureMonologUsing(function($monolog) {
$transport = new \Gelf\Transport\UdpTransport("127.0.0.1", 12201, \Gelf\Transport\UdpTransport::CHUNK_SIZE_LAN);
$publisher = new \Gelf\Publisher();
$publisher->addTransport($transport);
$monolog->pushHandler(new \Monolog\Handler\GelfHandler($publisher));
});