Skip to content

Instantly share code, notes, and snippets.

@1ma
1ma / RenderingMiddleware.php
Created May 19, 2020 12:08
middleware outgoing data flow
<?php
declare(strict_types=1);
namespace Project\Infrastrucuture\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
@1ma
1ma / Syncthing.md
Created September 21, 2019 11:10
Syncthing Notes

Syncthing

Architecture

Syncthing works in a decentralized manner, meaning you can simply install the software in all your devices and they will directly stream any changes in your shared folders between them.

However, if you usually only have one device open at a time it won't have anywhere to send the changes. For this reason it's practical to install the software in a server so that

@1ma
1ma / VoidLinuxNotes.md
Last active November 6, 2023 18:52
Void Linux Notes

Essential packages:

sudo xbps-install -Su void-repo-nonfree

sudo xbps-remove firefox-esr

sudo xbps-install -Su \
ascii \
baobab \
@1ma
1ma / AvailabilityServiceDriver.php
Last active January 28, 2019 13:20
Layout for an interruptible Availability Service
<?php
declare(strict_types=1);
final class AvailabilityServiceDriver
{
/**
* @var IterableAvailabilityService
*/
private $as;
@1ma
1ma / Dockerfile
Created December 29, 2018 23:07
AdaCore GNAT 2016 environment based on Ubuntu
FROM ubuntu:14.04 AS adacore2016
ENV PATH="/usr/gnat/bin:${PATH}"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
libc6-dev \
make \
&& cd /tmp \
@1ma
1ma / Dockerfile
Created July 9, 2018 12:44
phactor freezing issue
FROM alpine:3.8
ENV PHP_VERSION=7.2.7
ENV CFLAGS="-O3 -march=x86-64"
RUN apk add --no-cache \
# generic dependencies for compiling the source
alpine-sdk \
autoconf \
[*] Updating `https://repo.voidlinux.eu/current/musl/x86_64-repodata' ...
[*] Updating `https://repo.voidlinux.eu/current/musl/nonfree/x86_64-repodata' ...
x86_64-repodata: [1550B 100%] 18MB/s ETA: 00m00s
x86_64-repodata: 1550B [avg rate: 18MB/s]
[*] Updating `https://repo.voidlinux.eu/current/x86_64-repodata' ...
[*] Updating `https://repo.voidlinux.eu/current/nonfree/x86_64-repodata' ...
x86_64-repodata: [15KB 27%] -- stalled -- ETA: 00m00s
x86_64-repodata: 15KB [avg rate: -- stalled --]
[*] Updating `https://repo.voidlinux.eu/current/aarch64/x86_64-repodata' ...
[*] Updating `https://repo.voidlinux.eu/current/multilib/x86_64-repodata' ...
<?php
declare(strict_types=1);
if (
1 === \version_compare('7.1.0', PHP_VERSION) ||
false === \extension_loaded('curl')
) {
\fwrite(STDERR, "bye bye\n");
exit(1);
@1ma
1ma / centos7
Last active July 10, 2017 14:28
centos7
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.network "private_network", ip: "10.0.1.10"
config.ssh.forward_agent = true
config.vm.synced_folder "./", "/vagrant", type: "virtualbox"
config.vm.provider "virtualbox" do |vb|
-- 100 million INSERTs benchmark
-- stock PostgreSQL 9.6 setup running on an Ubuntu 16.04 workstation
-- PK TYPE INSERT* time (ms) Relative time AVG throughput (op/s)
------------------------------------------------------------------------
-- BIGSERIAL 242,849.46 1.00 411,777.73
-- UUID COMB 337,028.15 1.39 296,711.12
-- UUID 1 470,385.37 1.94 212,591.65
-- UUID 4 7,808,502.45 32.15 12,806.55
------------------------------------------------------------------------