Skip to content

Instantly share code, notes, and snippets.

View golgote's full-sized avatar

Bertrand Mansion golgote

  • Mamasam
  • Vincennes, France
View GitHub Profile
@dmilith
dmilith / wezterm.lua
Last active September 16, 2023 21:38
Wezterm Nightly configuration dmilith
local wezterm = require 'wezterm';
local mux = wezterm.mux
local act = wezterm.action
local MY_EDITOR = "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
return {
default_cwd = "/Volumes/Projects",
@fabiolimace
fabiolimace / ksuid.sql
Last active April 24, 2024 09:40
Functions for generating Segment's KSUIDs on PostgreSQL
/*
* MIT License
*
* Copyright (c) 2023 Fabio Lima
*
* 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
* copies of the Software, and to permit persons to whom the Software is
@lkopocinski
lkopocinski / postal_codes_regex.json
Last active April 7, 2024 19:35
JSON file with postal codes regex patterns
[
{
"abbrev":"AF",
"name":"Afghanistan",
"postal":"[0-9]{4}"
},
{
"abbrev":"AL",
"name":"Albania",
"postal":"(120|122)[0-9]{2}"
@fabiolimace
fabiolimace / fn_tsid_milli.sql
Last active April 25, 2024 04:23
Function for generating Time Sortable ID with millisecond precision on PostgreSQL
/**
* Returns a Time Sortable ID with millisecond precision.
*
* Time component: 42 bits (2^42 = ~69 years)
*
* Random component: 22 bits (2^22 = 4,194,304)
*
* The time component is the count of milliseconds since 2020-01-01T00:00:00Z.
*
* Tags: tsid ulid snowflake id-generator generator time sortable sort order id
@rseon
rseon / Prestashop_exports.md
Last active November 9, 2023 16:17
Quelques scripts SQL d'export pour Prestashop

Prestashop exports

URL replacement

ps_configuration.name (PS_SHOP_DOMAIN, PS_SHOP_DOMAIN_SSL, PS_SSL_ENABLED)
ps_shop_url.domain
ps_shop_url.domain_ssl
@hmenke
hmenke / matheval.lua
Last active February 29, 2020 21:10
Simple mathematical expression parser and evaluator in Lua with LPEG
local lpeg = require"lpeg"
local C, P, R, S, V = lpeg.C, lpeg.P, lpeg.R, lpeg.S, lpeg.V
local white = S(" \t") ^ 0
local digit = R("09")
local dot = P(".")
local eE = S("eE")
local sign = S("+-")^-1
local mantissa = digit^1 * dot * digit^0 + dot * digit^1 + digit^1
@MarcelFox
MarcelFox / dns_cpmail.sh
Created April 8, 2018 15:21
dns_cpmail.sh | checks DMARC, DKIM & SPF of a primary domain of a user.
#!/bin/bash
#
# Name: dns_cpmail
# Version: 1.0
# By MarcelFox
#
# HOW TO WORK WITH?
# As 'root' and in a cPanel server run:
# bash dns_cpmail.sh
#
@MarcelFox
MarcelFox / 01_postfix_installer.md
Last active December 17, 2020 20:40 — forked from solusipse/01_postfix_installer.md
Postfix + Dovecot + Postgresql + Postfixadmin + Roundcube + Opendkim

Postfix Installer

Following script may be used for configuring complete and secure email server on fresh install of Debian 9. It will probably work on other distributions using apt-get. After minor changes you'll be able to use it on other Linux distros.

What it does?

02_postfix.sh:

  • Install Postfix and configure it with TLS support.
  • Install Dovecot and configure it's transport on Postfix.
  • Download, extract and correct permissions for Postfixadmin.
  • Download, extract and correct permissions for Roundcube.
@Noble-Mushtak
Noble-Mushtak / Calculator.lua
Last active April 8, 2024 16:56
Simple Calculator for Lua
function characterPresent(stringParam, character)
--[[
This function returns true if and only if character is in stringParam.
]]--
--Loop through stringParam:
for i=1, #stringParam do
--If the current character is character, return true.
if stringParam:sub(i, i) == character then return true end
end
--If we go through the whole string without returning true, we get to this point.
@catwell
catwell / mp_magic.lua
Last active October 30, 2015 10:10
mp_magic
-- For use with https://github.com/fperrad/lua-MessagePack
-- Usage:
-- local mp = require "MessagePack"
-- local MP = mp_magic(mp)
-- mp.pack{ this_is_a_string = MP{binary = "this_is_a_binary"} }
local mp_magic = function(mp)
if mp.mpmagic then return mp.mpmagic end
local mp_mt = {}
local new = function(t) return setmetatable(t, mp_mt) end