Skip to content

Instantly share code, notes, and snippets.

View kohenkatz's full-sized avatar

MK kohenkatz

  • SaferMobility, LLC
  • Olney, MD
  • 18:32 (UTC -04:00)
View GitHub Profile
@Wirone
Wirone / Pie-PHP.Dockerfile
Last active November 26, 2024 18:17
Using PIE (Extensions Installer for PHP) in Docker builds
FROM php:8.4-cli AS php-debian
RUN apt-get -q update \
# Pie requires ZIP extension to be installed (checked with Box requirements when executing Pie's PHAR)
&& apt-get -yq install gnupg libzip-dev libzip4 \
&& docker-php-ext-install zip \
# Official docs includes one-liner that uses `latest` release, but URL gives 404.
# Anyway, it's probably better to use fixed version of Pie to have stable builds.
&& curl -L --output /usr/bin/pie https://github.com/php/pie/releases/download/0.2.0/pie.phar \
&& chmod +x /usr/bin/pie \
.log
0
1
1234
12345
123456
18Renmeng
2
ACrenshaw
AGorg
@valorin
valorin / .env.example
Last active December 24, 2024 18:18
CSP Middleware - the simple CSP middleware I use across all of my projects.
# Add to your .env.example and .env files
CSP_ENABLED=true
CSP_REPORT_ONLY=true
@joelonsql
joelonsql / PostgreSQL-EXTENSIONs.md
Last active April 26, 2025 09:23
1000+ PostgreSQL EXTENSIONs

🗺🐘 1000+ PostgreSQL EXTENSIONs

This is a list of URLs to PostgreSQL EXTENSION repos, listed in alphabetical order of parent repo, with active forks listed under each parent.

⭐️ >= 10 stars
⭐️⭐️ >= 100 stars
⭐️⭐️⭐️ >= 1000 stars
Numbers of stars might not be up-to-date.

Since version 2.23, git-blame has a feature to ignore certain commits. This feature is useful to ignore large formatting or apparently unimportant changes.

How to use

  1. Create a revisions list file. The file name is usually .git-blame-ignore-revs
  2. Set the file as a default ignore file for blame by git config blame.ignoreRevsFile .git-blame-ignore-revs

The file format is described in git-fsck's man: https://git-scm.com/docs/git-fsck#Documentation/git-fsck.txt-fsckskipList

@androidfred
androidfred / noargs_setters_builders.md
Last active March 9, 2023 15:51
Stop using noargsconstructors and setters (and builders)

Stop using noargsconstructors and setters (and builders)

TLDR summary

Noargsconstructors and setters are outdated, 90's style old school Java. They needlessly allow entire categories of defects that are easily avoided by using only allargsconstructors and no setters. Please stop writing code like that.

Longer version

How many times have you come across (or written) code like this

public class User {
@kjmph
kjmph / A_UUID_v7_for_Postgres.sql
Last active April 23, 2025 13:45
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well. Read more here: https://datatracker.ietf.org/doc/rfc9562/
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
create or replace function uuid_generate_v7()
returns uuid
as $$
begin
-- use random v4 uuid as starting point (which has the same variant we need)
-- then overlay timestamp
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string
return encode(
@zaxbux
zaxbux / chan_pjsip--X-UCM--Headers.c
Last active August 26, 2022 03:21
Grandstream GRP26xx SIP Integration
/*! \brief Add "X-UCM-AudioRecord" header and "X-UCM-CallPark" header to outgoing message
*
* if the right is allow callee or allow both, add the header in Invite message;
if the right is allow caller or allow both, add the header in 200 for Invite message
*
* \param req The request/response to which we will add the header
*/
void add_feature_map_header(pjsip_tx_data *tdata, int outgoing_call)
{
char audio_record_code[12] = {0};
@miken32
miken32 / Cidr.php
Last active October 24, 2023 07:27
Laravel CIDR validation rule
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
use const FILTER_FLAG_IPV4;
use const FILTER_FLAG_IPV6;
use const FILTER_VALIDATE_INT;
@cristianovagos
cristianovagos / .gitlab-ci.yml
Created September 26, 2019 11:37
GitLab CI/CD file for Protobuf Golang/Java generation
stages:
- build
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
build:go:
stage: build
image:
name: namely/protoc-all