Skip to content

Instantly share code, notes, and snippets.

@romeugodoi
romeugodoi / GeoDistance.php
Created April 18, 2023 13:52
This routine calculates the distance between two points (latitude/longitude)
<?php
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
/*:: :*/
/*:: This routine calculates the distance between two points (given the :*/
/*:: latitude/longitude of those points). It is being used to calculate :*/
/*:: the distance between two locations using GeoDataSource(TM) Products :*/
/*:: :*/
/*:: Definitions: :*/
/*:: South latitudes are negative, east longitudes are positive :*/
@bpolaszek
bpolaszek / mercure-provision.sh
Last active February 12, 2025 23:25
Setup Mercure as a service on Ubuntu 20.04
MERCURE_URL=${MERCURE_URL:=https://github.com/dunglas/mercure/releases/download/v0.10.4/mercure_0.10.4_Linux_x86_64.tar.gz}
JWT_KEY=${JWT_KEY:=!ChangeMe!}
MERCURE_FILE=${MERCURE_URL##*/}
# Settings perms
echo "Creating mercure user..."
groupadd --system mercure
useradd --system \
--gid mercure \
--create-home \
@croblesm
croblesm / Dockerfile
Last active December 7, 2021 18:14
msql-tools custom image using Alpine
# SQL Server Command Line Tools - custom image
# From Alpine 3.11 (~5 MBs)
FROM alpine:3.11
LABEL maintainer="@dbamastery"
# Installing system utilities
RUN apk add --no-cache curl gnupg
# Adding custom MS repository for mssql-tools and msodbcsql
RUN curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.5.2.1-1_amd64.apk
@butschster
butschster / dbdiagram-builder.php
Created January 14, 2020 20:15
Database diagram builder for https://dbdiagram.io/
<?php
namespace App\Console\Commands;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Illuminate\Console\Command;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Support\Arr;
class BuildDatabaseSchemaDiagramCommand extends Command
@2ec0b4
2ec0b4 / listener.php
Created December 13, 2019 10:38
PostgreSQL Notifier with a PHP Listener
<?php
set_time_limit(0);
$db = new PDO(
'pgsql:dbname=dbname host=host port=5432;options=--application_name=APPLICATION_NAME',
'user',
'password',
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
@nicolasdao
nicolasdao / elasticbeanstalk_guide.md
Last active May 28, 2025 01:58
Elastic Beanstalk guide. Keywords: elastic bean beanstalk elasticbeanstalk cli eb eb
@diego3g
diego3g / settings.json
Last active December 9, 2025 18:38
VSCode Settings (Updated)
{
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 16,
"editor.lineHeight": 1.8,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [
80,
120
],
@axelvnk
axelvnk / OrSearchFilter.php
Last active November 1, 2024 23:08
Api platform OR search filter
<?php
namespace Axelvkn\AppBundle\Filter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
use ApiPlatform\Core\Exception\InvalidArgumentException;
use Doctrine\ORM\QueryBuilder;
class OrSearchFilter extends SearchFilter
@victorlin
victorlin / batch-cr2-jpg-downsize-readme.md
Last active August 16, 2024 22:54
Script to convert and downsize RAW photos to small JPG files for fast Google Drive upload

Overview

Script to convert and downsize RAW images. Good for web uploading.

  1. Convert all .CR2 files (RAW) to jpg
  2. Downsize image dimensions by 25%
  3. Move to new directory jpg

Quickstart

@luisjuniorj
luisjuniorj / Fibo_Bands
Created January 4, 2018 09:20
ProfitChart Pro - Indicador com mais de 4 linhas
input
plen(17);
fast(0.666);
slow(0645);
var
mTrueRange : float;
Oval : Float;
Hval : Float;