Skip to content

Instantly share code, notes, and snippets.

Cecile Muller cecilemuller

Block or report user

Report or block cecilemuller

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cecilemuller
cecilemuller / letsencrypt_2019.md
Last active Oct 20, 2019
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2019.md

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@cecilemuller
cecilemuller / get_combinations.php
Created Feb 1, 2013
PHP: Get all combinations of multiple arrays (preserves keys)
View get_combinations.php
<?php
function get_combinations($arrays) {
$result = array(array());
foreach ($arrays as $property => $property_values) {
$tmp = array();
foreach ($result as $result_item) {
foreach ($property_values as $property_value) {
$tmp[] = array_merge($result_item, array($property => $property_value));
}
@cecilemuller
cecilemuller / 2018-https-localhost.md
Last active Oct 17, 2019
How to create an HTTPS certificate for localhost domains
View 2018-https-localhost.md

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@cecilemuller
cecilemuller / launch.json
Created Jan 8, 2018
Run ts-node in VSCode Debugger
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Node Inspector",
"type": "node",
"request": "launch",
"args": ["${workspaceRoot}/src/service.ts"],
"runtimeArgs": ["-r", "ts-node/register"],
"cwd": "${workspaceRoot}",
@cecilemuller
cecilemuller / index.html
Last active Oct 3, 2019
Record three.js to WebM video using CCapture.js
View index.html
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Record WebGL to WebM (Chrome only)</title>
<meta charset="utf-8">
<link rel="stylesheet" href="styles.css" charset="utf-8">
</head>
<body>
<div class="buttons">
@cecilemuller
cecilemuller / gist:3081372
Created Jul 10, 2012
PostgreSQL trigger: loop through the columns of NEW record (requires `hstore` extension)
View gist:3081372
DECLARE
r record;
BEGIN
FOR r IN SELECT (each(hstore(NEW))).*
LOOP
RAISE NOTICE '% value is %', r.key, quote_nullable(r.value);
END LOOP;
RETURN NEW;
END
@cecilemuller
cecilemuller / .travis.yml
Last active Sep 1, 2019
Travis CI config to run headless Node tests via Xvfb
View .travis.yml
language: node_js
node_js:
- '6.9.1'
- '7.0.0'
sudo: false
addons:
apt:
packages:
- xvfb
@cecilemuller
cecilemuller / gist:3081392
Created Jul 10, 2012
PostgreSQL: UPDATE if the row exists, INSERT if it doesn't exists (UPSERT)
View gist:3081392
CREATE OR REPLACE FUNCTION upsert_tableName(arg1 type, arg2 type) RETURNS VOID AS $$
DECLARE
BEGIN
UPDATE tableName SET col1 = value WHERE colX = arg1 and colY = arg2;
IF NOT FOUND THEN
INSERT INTO tableName values (value, arg1, arg2);
END IF;
END;
$$ LANGUAGE 'plpgsql';
@cecilemuller
cecilemuller / tasks.json
Last active Jul 14, 2019
VSCode: Compile Typescript on file save
View tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Delete Output Folder",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
@cecilemuller
cecilemuller / mjpeg.js
Last active Jul 8, 2019
Emit a looped serie of images as an MJPEG stream using Node.js
View mjpeg.js
'use strict';
const {readFileSync} = require('fs');
const {createServer} = require('http');
const {EventEmitter} = require('events');
let bufferIndex = -1;
const buffers = [
readFileSync('1.jpg'),
readFileSync('2.jpg'),
readFileSync('3.jpg'),
You can’t perform that action at this time.