Skip to content

Instantly share code, notes, and snippets.

View alxmal's full-sized avatar

Alexandr Malafeev alxmal

View GitHub Profile
@laurent-h
laurent-h / particles.html
Created January 7, 2024 14:10
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; }
@sindresorhus
sindresorhus / esm-package.md
Last active October 14, 2025 20:49
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.
@kekru
kekru / 01nginx-tls-sni.md
Last active October 14, 2025 08:34
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
@clemensg
clemensg / nginx.service
Created November 22, 2017 22:08
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
@MeLlamoPablo
MeLlamoPablo / nvmlink
Created February 1, 2017 11:34
Creates a symlink to /usr/bin/node after using nvm
@waleedahmad
waleedahmad / post_install.sh
Last active June 20, 2025 06:14
Ubuntu post installation script for installing software of your choice.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
#Update and Upgrade
echo "Updating and Upgrading"
apt-get update && sudo apt-get upgrade -y
@joepie91
joepie91 / express-server-side-rendering.md
Last active April 26, 2025 08:11
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@gazzwi86
gazzwi86 / setup.sh
Created June 4, 2016 03:14
A script to setup a Ubuntu server with uncomplicated firewall, ftp, node, express, pm2 and new relic.
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get -y update && apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get install -y vsftpd ufw htop curl unzip nodejs build-essential && sudo apt-get autoremove
# setup firewall
sudo ufw allow 2020 # ssh
sudo ufw allow ftp # ftp
sudo ufw allow http # http
# create a user
sudo useradd -d /home/web -m web
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active October 13, 2025 14:21
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);