Skip to content

Instantly share code, notes, and snippets.

mazz / app.exs
Created Dec 5, 2022 — forked from alvises/app.exs
app.exs test script which connects two Elixir nodes running in two containers
View app.exs
IO.puts("I'm here! Sleeping for 2 seconds")
Process.sleep 2_000 # waiting for the other node
nodes =[:app@app1, :app@app2])
other_node =
|> MapSet.delete(Node.self())
|> MapSet.to_list()
|> List.first()
mazz / PinEntryView.swift
Created Sep 30, 2022 — forked from willbrandin/PinEntryView.swift
A SwiftUI View for entering login pins. Supports first responder and has no third parties.
View PinEntryView.swift
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] {
mazz / app.js
Created Jul 23, 2022 — forked from goofansu/app.js
LiveView upload directly to AWS China S3
View app.js
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) {
# 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 / _user_menu.html.eex
Created Jan 28, 2021 — forked from andreaseriksson/_user_menu.html.eex
Use phoenix_live_session to communicate bewteen live views
View _user_menu.html.eex
<%= live_render @conn, EcommerceWeb.CartLive %>
mazz / NYXAVCEncoder.swift
Created Aug 13, 2020 — forked from Nyx0uf/NYXAVCEncoder.swift
Hardware accelerated GIF to MP4 converter in Swift using VideoToolbox
View NYXAVCEncoder.swift
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 / ecto_postgres_fulltext_search_querying_example.ex
Created Apr 16, 2019 — 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
View ecto_postgres_fulltext_search_querying_example.ex
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 == ^, order_by: [desc: l.updated_at], limit: 50
id = _try_integer(query)
mazz /
Created Sep 21, 2018 — forked from Luzifer/
Running docker-compose as a systemd service

Running docker-compose as a systemd service


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 /
Created Sep 9, 2018 — forked from olasd/
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://" # URL de base RTMP youtube
mazz /
Created Aug 27, 2018 — forked from mikoim/
YouTube recommended encoding settings on ffmpeg (+ libx264)
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