Skip to content

Instantly share code, notes, and snippets.

View Mati365's full-sized avatar
🚧
Work Work Work

Mateusz Bagiński Mati365

🚧
Work Work Work
View GitHub Profile
@schmichael
schmichael / nomad-consul-tls.md
Last active April 15, 2025 19:57
Nomad+Consul TLS Story

Nomad+Consul TLS Story

See https://github.com/schmichael/nomad-tls for sample configs.

Nomad issues

  • Consul uses ssl instead of tls config parameters
  • Consul uses verify_ssl instead of verify_tls
  • consul.cert_file should specify that it's the client certificate used for mutual authentication.
  • consul.{ca,cert,key}_file should default to tls.{ca,cert,key}_file
@gcanti
gcanti / fp-ts-technical-overview.md
Last active March 11, 2024 02:40
fp-ts technical overview

Technical overview

A basic Option type

// Option.ts

// definition
export class None {
  readonly tag: 'None' = 'None'
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active August 27, 2025 17:22
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@georgexsh
georgexsh / goto.py
Created September 18, 2017 07:47
python goto with system trace function
import sys
def j(lineno):
frame = sys._getframe().f_back
called_from = frame
def hook(frame, event, arg):
if event == 'line' and frame == called_from:
try:
frame.f_lineno = lineno
@Manouchehri
Manouchehri / ieee754.js
Created October 13, 2017 19:00 — forked from bartaz/gist:1119041
Convert JavaScript number to string of 64bit double precision floating point representation (IEEE 754)
// Convert a JavaScript number to IEEE-754 Double Precision
// value represented as an array of 8 bytes (octets)
//
// http://cautionsingularityahead.blogspot.com/2010/04/javascript-and-ieee754-redux.html
function toIEEE754(v, ebits, fbits) {
var bias = (1 << (ebits - 1)) - 1;
// Compute sign, exponent, fraction
@jaytaylor
jaytaylor / delete-from-v2-docker-registry.md
Last active May 6, 2025 17:49
One liner for deleting images from a v2 docker registry

One liner for deleting images from a v2 docker registry

Just plug in your own values for registry and repo/image name.

registry='localhost:5000'
name='my-image'
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$(
    curl -sSL -I \
        -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
@cyril-lakech
cyril-lakech / morgan.nestjs.middleware.ts
Created August 30, 2018 16:14
Simplest Morgan NestJS Middleware
import { Injectable, MiddlewareFunction, NestMiddleware } from '@nestjs/common';
import * as morgan from 'morgan';
import { LoggerService } from './mylogger';
@Injectable()
export class MorganMiddleware implements NestMiddleware {
constructor(private readonly logger: LoggerService) {}
resolve(): MiddlewareFunction {
return morgan('combined', {
stream: { write: str => this.logger.info(str) },
@gitCommitLit
gitCommitLit / index.html
Created September 24, 2018 13:04
Liquid Button
<!-- For more examples: https://codepen.io/Zaku/pen/eRmRxz -->
<svg class="liquid-button"
data-text="BUTTON"
data-force-factor="0.1"
data-layer-1-viscosity="0.5"
data-layer-2-viscosity="0.4"
data-layer-1-mouse-force="400"
data-layer-2-mouse-force="500"
data-layer-1-force-limit="1"
@tulik
tulik / tic-tac-toe.sql
Created October 2, 2018 16:23
TicTacToe in SQL (Postgres)
--- Introduced by Mariusz Krynski.
with recursive rnd_move(move) as (
select *, random() rnd from generate_series(1, 9) move
), winning_positions(a, b, c) as (
values (1, 2, 3), (4, 5, 6), (7, 8, 9), -- rows
(1, 4, 7), (2, 5, 8), (3, 6, 9), -- cols
(1, 5, 9), (3, 5, 7) -- diagonals
), game as (
select 'O' as who_next, ARRAY['.', '.', '.', '.', '.', '.', '.', '.', '.'] as board