Skip to content

Instantly share code, notes, and snippets.

global
lua-load /usr/local/etc/haproxy/acme-http01-webroot.lua
ssl-default-bind-ciphers AES256+EECDH:AES256+EDH:!aNULL;
tune.ssl.default-dh-param 4096
debug
defaults
mode http
option log-health-checks
option dontlognull
@mazz
mazz / encode.sh
Created August 27, 2018 01:22 — forked from mikoim/README.md
YouTube recommended encoding settings on ffmpeg (+ libx264)
#/bin/sh
ffmpeg -i input -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 384k -profile:a aac_low output
@mazz
mazz / stream_to_youtube.sh
Created September 9, 2018 22:37 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@mazz
mazz / README.md
Created September 21, 2018 13:04 — forked from Luzifer/README.md
Running docker-compose as a systemd service

Running docker-compose as a systemd service

Files

File Purpose
/etc/compose/docker-compose.yml Compose file describing what to deploy
/etc/systemd/system/docker-compose.service Service unit to start and manage docker compose
/etc/systemd/system/docker-compose-reload.service Executing unit to trigger reload on docker-compose.service
/etc/systemd/system/docker-compose-reload.timer Timer unit to plan the reloads
@mazz
mazz / ecto_postgres_fulltext_search_querying_example.ex
Created April 16, 2019 01:31 — forked from pmarreck/ecto_postgres_fulltext_search_querying_example.ex
How to set up postgres fulltext search triggers, index, and tsvector column on Elixir/Phoenix, with Ecto querying, including ranking and sorting by rank
defmodule YourAppName.Search do
# ...
@doc """
Queries listings.
"""
def query_listings(query, current_user) do
default_scope = from l in Listing, where: l.draft == false or l.user_id == ^current_user.id, order_by: [desc: l.updated_at], limit: 50
id = _try_integer(query)
@mazz
mazz / NYXAVCEncoder.swift
Created August 13, 2020 21:49 — forked from Nyx0uf/NYXAVCEncoder.swift
Hardware accelerated GIF to MP4 converter in Swift using VideoToolbox
import VideoToolbox
import AVFoundation
private var __canHWAVC: Bool = false
private var __tokenHWAVC: dispatch_once_t = 0
public protocol NYXAVCEncoderDelegate : class
{
func didEncodeFrame(frame: CMSampleBuffer)
func didFailToEncodeFrame()
@mazz
mazz / _user_menu.html.eex
Created January 28, 2021 00:15 — forked from andreaseriksson/_user_menu.html.eex
Use phoenix_live_session to communicate bewteen live views
<%= live_render @conn, EcommerceWeb.CartLive %>
@mazz
mazz / remove-all-from-docker.sh
Created March 24, 2022 21:28 — forked from beeman/remove-all-from-docker.sh
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@mazz
mazz / app.js
Created July 23, 2022 14:30 — forked from goofansu/app.js
LiveView upload directly to AWS China S3
let Uploaders = {}
Uploaders.S3 = function (entries, onViewError) {
entries.forEach(entry => {
let xhr = new XMLHttpRequest()
onViewError(() => xhr.abort())
xhr.onload = () => (xhr.status === 200 ? entry.done() : entry.error())
xhr.onerror = () => entry.error()
xhr.upload.addEventListener("progress", event => {
if (event.lengthComputable) {
@mazz
mazz / PinEntryView.swift
Created September 30, 2022 03:12 — forked from willbrandin/PinEntryView.swift
A SwiftUI View for entering login pins. Supports first responder and has no third parties.
import SwiftUI
struct PinEntryView: View {
var pinLimit: Int = 4
var isError: Bool = false
var canEdit: Bool = true
@Binding var pinCode: String
private var pins: [String] {