Skip to content

Instantly share code, notes, and snippets.

View arthurdapaz's full-sized avatar
📱
Tweaking iOS and CI/CDs

Arthur da Paz arthurdapaz

📱
Tweaking iOS and CI/CDs
View GitHub Profile
@arthurdapaz
arthurdapaz / luna-vpn.sh
Created January 5, 2022 22:36 — forked from modestman/luna-vpn.sh
Подключение к Endpoint Security VPN с помощью bash скрипта
#!/bin/bash
# Инструкция
#
# Для начала надо попросить у техподдрежки, чтобы сменили способ 2FA с приложения Multifactor на Google Authenticator.
# Во время настройки Google Authenticator сделайте скриншот QR кода и сохраните его в виде картинки.
# На сайте webqr.com можно расшифровать QR код и получить secret для генерации OTP.
# Пример: otpauth://totp/Luna:username?secret=TQPNWO37ZC6J6RG22MLSOIKQR5&algorithm=SHA256
#
# В приложении "Связка ключей" на macOS необходимо вручную создать две записи с паролями:
#!/bin/bash
# Completely stops & unloads Checkpoint, then uninstalls.
#/Library/Application\ Support/Checkpoint/Endpoint\ Connect/uninstall --uninstall
VPN_SITE_ADDRESS="secure.contoso.com"
# !!! Script expects a flat DMG file, such as one created using JAMF's Composer!
CHECKPOINT_INSTALLER_URL="https://s3-us-west-2.amazonaws.com/my-cool-bucket/checkpoint-endpointVPN-versionDERP.dmg"
CHECKPOINT_INSTALLER_VOLUME="endpointVPN-835017303"
REMOVE_PATHS=( "/Applications/Endpoint Security VPN.app" \
"/Library/Application Support/Checkpoint/" \
@arthurdapaz
arthurdapaz / closeAppElegantly.swift
Created January 12, 2022 01:46 — forked from yoni-g/closeAppElegantly.swift
How to exit an iOS app without it looking like a crash? - Swift
func showMessageResetApp(){
let exitAppAlert = UIAlertController(title: "Restart is needed",
message: "We need to restart the app on your first login to the app.\n Please reopen the app after this.",
preferredStyle: .alert)
let resetApp = UIAlertAction(title: "Close Now", style: .destructive) {
(alert) -> Void in
// home button pressed programmatically - to thorw app to background
UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)
// terminaing app in background
@arthurdapaz
arthurdapaz / Image+Trim.swift
Created March 10, 2022 02:29 — forked from msnazarow/Image+Trim.swift
[Swift 5] NSImage/UIImage Crop/Trim Transparency
// Image+Trim.swift
//
// Copyright © 2020 Christopher Zielinski.
// https://gist.github.com/chriszielinski/aec9a2f2ba54745dc715dd55f5718177
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@arthurdapaz
arthurdapaz / Injector.swift
Created July 7, 2022 11:41 — forked from kevinmbeaulieu/Injector.swift
Thumbtack Swift Dependency Injector
import Foundation
/// Thread-safe Swift dependency injector
///
/// **Using Injector**
/// 1. Call `Injector.setup()` early in the application lifecycle.
/// 2. In dependency classes, conform to one of `Injectable`, `Singleton`, `WeakSingleton`, `EagerSingleton`.
/// 3. In application code, construct dependencies using property injection like:
/// ```
/// private let logger: TTLogger = inject()