Skip to content

Instantly share code, notes, and snippets.

View binaryhq's full-sized avatar

BinaryHQ binaryhq

View GitHub Profile

How to use nginx as a reverse-proxy with letsencrypt

Your infrastructure

generated via plantuml

Imgur

Requirements

localeParseFloat(s, locale) {
// Get the thousands and decimal separator characters used in the locale.
let [,thousandsSeparator,,,,decimalSeparator] = 1111.1.toLocaleString(locale);
// Remove thousand separators, and put a point where the decimal separator occurs
s = Array.from(s, c => c === thousandsSeparator ? ""
: c === decimalSeparator ? "." : c).join("");
// Now it can be parsed
return parseFloat(s);
}
@binaryhq
binaryhq / imagemagick-svg.md
Created July 8, 2021 14:08 — forked from maxivak/imagemagick-svg.md
Issue with Carrierwave, ImageMagick with processing svg files

Issue with Carrierwave, ImageMagick (or MiniMagick) with processing svg files

Problem:

When uploading svg file with Carrierwave you may get an error:

Failed to manipulate with MiniMagick, maybe it is not an image? 
Original Error: `identify /tmp/mini_magick20190222-32759-1g7lnmy.svg` failed with error:

import React from "react";
import { PropTypes } from "prop-types";
import classNames from "classnames";
import withStyles from "@material-ui/core/styles/withStyles";
import TableCell from "@material-ui/core/TableCell";
import TableSortLabel from "@material-ui/core/TableSortLabel";
import {
AutoSizer,
Column,
SortDirection,
@binaryhq
binaryhq / imagick-svg2png.txt
Last active July 8, 2021 09:57 — forked from alinmigea/imagick-svg2png.txt
PHP: Use Imagick to convert SVG chart to PNG
Commands for installing the server library:
sudo apt-get install php7.0-imagick
sudo apt-get update
sudo service apache2 restart
Errors:
Caught exception: no decode delegate for this image format `' @ error/blob.c/BlobToImage/
use the following, because it might be that you don't have the MIME tyep SVG installed:
sudo certbot certonly --manual -d *.domain.com -d domain.com --agree-tos --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory --config-dir /home/ubuntu/ssl/config-dir --work-dir /home/ubuntu/ssl/work-dir --logs-dir /home/ubuntu/ssl/logs-dir
More information:
https://websiteforstudents.com/setup-lets-encrypt-wildcard-on-ubuntu-20-04-18-04/
@binaryhq
binaryhq / index.php
Created February 2, 2019 14:16 — forked from ajitbohra/index.php
mpdf: HTML/CSS to PDF & send pdf via email
<?php
/*
mPDF: Generate PDF from HTML/CSS (Complete Code)
*/
require_once( 'mpdf/mpdf.php'); // Include mdpf
$stylesheet = file_get_contents('assets/css/pdf.css'); // Get css content
$html = '<div id="pdf-content">
Your PDF Content goes here (Text/HTML)
</div>';
@binaryhq
binaryhq / full-ffmpeg.sh
Created February 3, 2016 06:31
Install full ffmpeg in debian wheezy (with aac(m4a) and x264 support)
# Add multimedia source
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
apt-get update
# Go to local source directory
cd /usr/local/src