Skip to content

Instantly share code, notes, and snippets.

View gorillka's full-sized avatar
💭
👨🏻‍💻

Artem Orynko gorillka

💭
👨🏻‍💻
View GitHub Profile
@gorillka
gorillka / readme.md
Created January 26, 2025 17:14 — forked from diyfr/readme.md
AdGuard Home + Traefik

edit traefik.yml

entryPoints:
  web:
    address: ":80"
  websecure:
    address: ":443"
  dot: # <- ADD THIS
    address: ":853"  # <- ADD THIS
import Foundation
// MARK: - Extensions
extension URL {
var isDirectory: Bool {
(try? resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory == true
}
}
@gorillka
gorillka / README.md
Created April 4, 2024 08:54 — forked from chatchavan/README.md
Setup Wifi on Raspberry Pi

Setup Wireless LAN for Raspberry Pi

The following guide describes how to setup Raspberry Pi to connect to Wifi. It was tested on the following environment:

  • Raspberry Pi Model B
  • Edimax EW-7811Un USB Wifi dongle
  • OS: Raspbian Jessie

Here are the overview of the steps:

@gorillka
gorillka / docker-compose-unifi.yaml
Created October 3, 2023 04:48 — forked from dragonfire1119/docker-compose-unifi.yaml
Docker compose for Unifi Controller
# https://docs.linuxserver.io/images/docker-unifi-controller
---
version: "2.1"
services:
unifi-controller:
image: lscr.io/linuxserver/unifi-controller:latest
container_name: unifi-controller
environment:
- PUID=1000 # for UserID
- PGID=1000 # for GroupID

optimising-unifi-performance

NOTE: Content below is written by Adrian Mace. Click here for an updated version.

Below are the key settings that I apply on any unifi installation for optimal performance.

Settings

Settings > Site

  • Ensure Enable Advanced Features is enabled
    This allows you to follow along with the guide in it's entirety.
@gorillka
gorillka / index.sh
Created October 31, 2020 06:57 — forked from max-mapper/index.sh
generate ES512 and RS256 elliptic curve keypairs for JWT JWK (JSON Web Token JSON Web Key) using openssl
# RS256
# private key
openssl genrsa -out rs256-4096-private.rsa 4096
# public key
openssl rsa -in rs256-4096-private.rsa -pubout > rs256-4096-public.pem
# ES512
# private key
openssl ecparam -genkey -name secp521r1 -noout -out ecdsa-p521-private.pem
# public key
@gorillka
gorillka / UniColor+hex.swift
Created August 21, 2020 06:01 — forked from foxicode/UniColor+hex.swift
Swift extension to convert String/Int to UIColor/NSColor and back
#if os(iOS) || os(tvOS)
import UIKit
typealias UniColor = UIColor
#else
import Cocoa
typealias UniColor = NSColor
#endif
private extension Int {
func duplicate4bits() -> Int {
@gorillka
gorillka / String+isEmailValid2.swift
Created August 21, 2020 05:59 — forked from foxicode/String+isEmailValid2.swift
Alternative way to check if String is email (Swift)
extension String {
func matches(_ expression: String) -> Bool {
if let range = range(of: expression, options: .regularExpression, range: nil, locale: nil) {
return range.lowerBound == startIndex && range.upperBound == endIndex
} else {
return false
}
}
var isValidEmail: Bool {
@gorillka
gorillka / UIImage+resized.swift
Created August 21, 2020 05:56 — forked from foxicode/UIImage+resized.swift
Resizing UIImage keeping aspect ratio
import UIKit
extension UIImage {
func resized(maxSize: CGFloat) -> UIImage? {
let scale: CGFloat
if size.width > size.height {
scale = maxSize / size.width
}
else {
scale = maxSize / size.height
@gorillka
gorillka / String+size.swift
Created August 21, 2020 05:54 — forked from foxicode/String+size.swift
Getting String width and height for provided UIFont
import UIKit
extension String {
func height(withConstrainedWidth width: CGFloat, font: UIFont) -> CGFloat {
let constraintRect = CGSize(width: width, height: .greatestFiniteMagnitude)
let boundingBox = self.boundingRect(with: constraintRect, options: .usesLineFragmentOrigin, attributes: [.font: font], context: nil)
return ceil(boundingBox.height)
}