Skip to content

Instantly share code, notes, and snippets.

View alxmal's full-sized avatar

Alexandr Malafeev alxmal

View GitHub Profile
@alxmal
alxmal / 01nginx-tls-sni.md
Created October 8, 2024 10:16 — forked from kekru/01nginx-tls-sni.md
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@alxmal
alxmal / differential_line_growth.js
Created September 26, 2024 14:28 — forked from JustinSDK/differential_line_growth.js
Differential line growth with p5.js
// Differential line growth with p5.js
// refactored from http://www.codeplastic.com/2017/07/22/differential-line-growth-with-processing/
const maxNodeNumbers = 400;
const nodesStart = 15;
const rayStart = 15;
let diffLine;
function setup() {
createCanvas(300, 300);
@alxmal
alxmal / nginx.service
Created September 19, 2024 20:24 — forked from clemensg/nginx.service
Example nginx service file for systemd
[Unit]
Description=NGINX HTTP and reverse proxy server
After=syslog.target network.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/bin/kill -s HUP $MAINPID
@alxmal
alxmal / nginx.service
Created September 19, 2024 20:24 — forked from clemensg/nginx.service
Example nginx service file for systemd
[Unit]
Description=NGINX HTTP and reverse proxy server
After=syslog.target network.target nss-lookup.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/bin/kill -s HUP $MAINPID
@alxmal
alxmal / esm-package.md
Created April 16, 2024 10:43 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@alxmal
alxmal / particles.html
Created January 8, 2024 10:55 — forked from laurent-h/particles.html
Particles
<!doctype html>
<html lang="en">
<head>
<title>Particles</title>
<meta charset="utf-8">
<meta name="author" content="Laurent Houdard | cables.and.pixels">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<style>
body { margin: 0; overflow: hidden; }
@alxmal
alxmal / magic_jq_task.sh
Created December 6, 2023 19:58 — forked from dishbreak/magic_jq_task.sh
Easy way in Bash to check that a binary is installed.
#!/bin/bash
# Exit on the first command that returns a nonzero code.
set -e
# Function that checks if a given executable is on the path. If it isn't, prints an install message and exits.
# Usage: check_binary EXECUTABLE_NAME INSTALL_MESSAGE
check_binary() {
if ! which "$1" > /dev/null; then
# Using a subshell to redirect output to stderr. It's cleaner this way and will play nice with other redirects.
@alxmal
alxmal / list-of-curl-options.txt
Created December 6, 2023 11:02 — forked from eneko/list-of-curl-options.txt
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@alxmal
alxmal / GLSL-Noise.md
Created December 5, 2023 10:05 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@alxmal
alxmal / media-query.css
Created January 15, 2019 12:29 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS