Skip to content

Instantly share code, notes, and snippets.

View melekhine's full-sized avatar

Igor A. Melekhine melekhine

View GitHub Profile
@CognitiveDifference
CognitiveDifference / Makefile.version
Last active October 19, 2022 07:03 — forked from grihabor/Makefile.version
Makefile to use for incremental semantic versioning
# Source: https://gist.github.com/CognitiveDifference/466c32bf98c07dcd9719599ceed3ecdc
MAKE := make --no-print-directory
DESCRIBE := $(shell git describe --match "v*" --always --tags)
STATUS := $(shell git status --porcelain | grep " M ")
DESCRIBE_PARTS := $(subst -, ,$(DESCRIBE))
VERSION_TAG := $(word 1,$(DESCRIBE_PARTS))
COMMITS_SINCE_TAG := $(word 2,$(DESCRIBE_PARTS))
@cristaloleg
cristaloleg / golangci.yaml
Last active July 15, 2022 17:03
An opinionated golangci-lint config (right version™)
# $ golangci-lint run --config=~/.golangci.yml ./... > lint.txt
run:
# default concurrency is a available CPU number
concurrency: 4
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 10m
# exit code when at least one issue was found, default is 1
@seblegall
seblegall / reverseproxy.go
Last active July 9, 2024 15:08
A reverse proxy in Golang using Gin
package main
import (
"fmt"
"net/http"
"net/http/httputil"
"net/url"
"github.com/gin-gonic/gin"
)
@Freddo3000
Freddo3000 / a3update.py
Last active April 6, 2024 21:52 — forked from marceldev89/a3update.py
Arma 3 Linux server and mod updater (workshop)
#!/usr/bin/python3
# MIT License
#
# Copyright (c) 2017 Marcel de Vries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@hermanbanken
hermanbanken / Dockerfile
Last active July 5, 2024 06:54
Compiling NGINX module as dynamic module for use in docker
FROM nginx:alpine AS builder
# nginx:alpine contains NGINX_VERSION environment variable, like so:
# ENV NGINX_VERSION 1.15.0
# Our NCHAN version
ENV NCHAN_VERSION 1.1.15
# Download sources
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \
@grihabor
grihabor / Makefile.version
Last active May 27, 2024 13:36
Makefile to use for incremental semantic versioning
MAKE := make --no-print-directory
DESCRIBE := $(shell git describe --match "v*" --always --tags)
DESCRIBE_PARTS := $(subst -, ,$(DESCRIBE))
VERSION_TAG := $(word 1,$(DESCRIBE_PARTS))
COMMITS_SINCE_TAG := $(word 2,$(DESCRIBE_PARTS))
VERSION := $(subst v,,$(VERSION_TAG))
VERSION_PARTS := $(subst ., ,$(VERSION))
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active July 14, 2024 18:27
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@rkasigi
rkasigi / osx-random-string.txt
Last active February 5, 2024 16:39
OSX Generate Random String
openssl rand -base64 6
openssl rand -hex 4
openssl rand -base64 8 | md5 | head -c8;echo
openssl rand -base64 6
ping -c 1 yahoo.com |md5 | head -c8; echo
#!/usr/bin/env python
'''Crop an image to just the portions containing text.
Usage:
./crop_morphology.py path/to/image.jpg
This will place the cropped image in path/to/image.crop.png.
For details on the methodology, see