Skip to content

Instantly share code, notes, and snippets.

View vookimedlo's full-sized avatar

Michal Duda vookimedlo

View GitHub Profile
@Fabrizz
Fabrizz / Cloudflared HomeAssistant.md
Last active June 23, 2025 13:41
Secure HomeAssistant with Cloudflared and client certificates

HA via Cloudflared with mTLS

This tutorial uses Cloudflare Tunnels to allow you to connect to your Home Assistant instance without opening ports to the intertet, it also guide you on adding client certificates (mTLS), allowing only you to access your instance, and fully compatible with the companinn app.

Important

Client certificates do not work properly on IOS. You still can use Cloudflared to allow remote access.
2016 bug HA Issue

Note

If you are not using (/dont want to use/) Cloudflare tunnels, or you want to use other services, HA offers ssl_peer_certificate to validate clients in a similar way.

@ktsaou
ktsaou / systemd-journal-self-signed-certs.sh
Last active May 11, 2025 21:36
systemd-journal-remote/upload self-signed certificates management script
#!/usr/bin/env bash
# The directory to save the generated certificates (and everything about this certificate authority).
# This is only used on the node generating the certificates (usually on the journals server).
DIR="/etc/ssl/systemd-journal-remote"
# The journals centralization server name (the CN of the server certificate).
SERVER="server-hostname"
# All the DNS names or IPs this server is reachable at (the certificate will include them).
@EricRabil
EricRabil / XCTHarness.swift
Last active August 1, 2024 08:32
XCTest doing absolutely nothing? Lack of documentation driving you insane? Avoiding a DTS ticket? Here's a Swift class that forcibly bootstraps XCTest when running inside of a test host and XCTest is not starting itself.
public class XCTHarness {
private typealias XCTestMainType = @convention(c) (_ something: AnyObject?) -> ()
private static func dlsymcast<T>(_ handle: UnsafeMutableRawPointer!, _ symbol: UnsafePointer<CChar>) -> T! {
dlsym(handle, symbol).map {
if T.self is AnyObject.Type {
return $0 as! T
} else {
return unsafeBitCast($0, to: T.self)
}
//
// Copyright (c) 2016, 2018 Nikolai Ruhe. All rights reserved.
//
import Foundation
public extension FileManager {
/// Calculate the allocated size of a directory and all its contents on the volume.
@AkdM
AkdM / Edit_Repack_ISO_tutorial.md
Last active May 20, 2025 08:25
Edit and repack .iso bootable image

On Linux

Installing mkisofs

apt-get install mkisofs

Editing ISO image

mkdir /tmp/custom_iso

@mosen
mosen / Share.swift
Created March 6, 2018 04:55
Convenient swift-like wrapper over NetFS smb mounting
import Foundation
import NetFS
enum ShareMountError: Error {
case InvalidURL
case MountpointInaccessible
case InvalidMountOptions
}
@randomsequence
randomsequence / CompareImages.swift
Last active October 2, 2024 21:09 — forked from ralfebert/CompareImages.swift
A couple of swift functions for comparing two CGImage using CIImage in OS X
//
// Thanks Kevin!
// https://gist.github.com/SheffieldKevin/566dc048dd6f36716bcd
//
import CoreGraphics
import CoreImage
extension CGImage {
@HertzDevil
HertzDevil / enum_traits.hpp
Last active December 25, 2023 06:31
safer enums in c++
#pragma once
#include <type_traits>
#include <limits>
// The default enumeration category. Conversion is equivalent to static_cast.
// Unspecialized enumeration traits use this category.
struct enum_default { };
// The standard-layout enumeration category. Values outside the given range are
@hfossli
hfossli / SHA256-Bridging-Header.h
Last active July 28, 2024 09:34
AES 256 in swift 4 with CommonCrypto
#import <CommonCrypto/CommonCrypto.h>
@nahuelDeveloper
nahuelDeveloper / CalculatorView.swift
Created October 4, 2017 12:49 — forked from natecook1000/CalculatorView.swift
An IBInspectable Calculator Construction Set
// CalculatorView.swift
// as seen in http://nshipster.com/ibinspectable-ibdesignable/
//
// (c) 2015 Nate Cook, licensed under the MIT license
import UIKit
/// The alignment for drawing an String inside a bounding rectangle.
enum NCStringAlignment {
case LeftTop