Skip to content

Instantly share code, notes, and snippets.

View rehannali's full-sized avatar
🏠
Working from home

Rehan Ali rehannali

🏠
Working from home
View GitHub Profile
@rehannali
rehannali / install_realvnc_server.sh
Last active June 26, 2022 11:34 — forked from vietanhdev/install_realvnc_server.sh
Install RealVNC Ubuntu Headless - Raspberry Pi 4 armhf or using armhf
#!/usr/bin/env bash
mkdir realvncserversetup && cd realvncserversetup
echo 'Adding armhf arch'
sudo dpkg --add-architecture armhf && sudo dpkg --print-foreign-architectures
echo 'Update Repositories'
sudo apt update && sudo apt upgrade -y
@rehannali
rehannali / top-current-vc.swift
Created November 7, 2022 06:59
Find Top View Controller
public extension NSObject {
func findTopViewController(vc: UIViewController) -> UIViewController {
if (vc.presentedViewController != nil) {
return UIViewController().findTopViewController(vc:vc.presentedViewController!)
} else if (vc.isKind(of: AKSideMenu.self)) {
let rvc = vc as! AKSideMenu
if let left = rvc.leftMenuViewController {
return UIViewController().findBestVC(vc: left)
@rehannali
rehannali / storyboarded.swift
Created November 7, 2022 07:02
Initialize from Storyboard
public extension UIViewController {
class func initializeFromStoryboard(storyboardName: CONSTANTS.StoryboardName, bundle: Bundle? = nil, identifier: String = "") -> Self {
return initializeFromStoryboard(storyboardName: storyboardName.rawValue, bundle: bundle, identifier: identifier)
}
class func initializeFromStoryboard(storyboardName: String, bundle: Bundle? = nil, identifier: String = "") -> Self {
let storyboard = UIStoryboard(name: storyboardName, bundle: bundle)
if let controller = initializeFromStoryboard(storyboard: storyboard, type: self, identifier: identifier) {
return controller
}
@rehannali
rehannali / nav-bar-image.swift
Created November 7, 2022 07:03
Set Image in Navigation Bar
public extension UIViewController {
func setTitleImage(_ image: UIImage) {
let imageView = UIImageView(image: image)
let width = navigationController?.navigationBar.frame.size.width ?? 0
let height = navigationController?.navigationBar.frame.size.height ?? 0
let axisX = width / 2 - image.size.width / 2
let axisY = height / 2 - image.size.height / 2
imageView.frame = CGRect(x: axisX, y: axisY, width: width, height: height)
imageView.contentMode = .scaleAspectFit
@rehannali
rehannali / nextdns-with-pfsense-dns-resolver.md
Last active March 31, 2024 20:00
nextdns config with pfsense dns resolver

NextDNS with pfSense dns resolver

this is the basic configuration for nextdns combine with pfSense dns resolver to use both.

1. Login into pfSense GUI

SSH access is turned off by default on pfSense. To enable it, go to System -> Advanced -> Enable Secure Shell

image