##Create a new repository on the command line
REPO="REPO_NAME_HERE"
curl -u 'USER' https://api.github.com/user/repos -d '{"name":"$REPO"}'
touch README.md
git init
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() |
// 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 |
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 |
#!/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/" \ |
#!/bin/bash | |
# Инструкция | |
# | |
# Для начала надо попросить у техподдрежки, чтобы сменили способ 2FA с приложения Multifactor на Google Authenticator. | |
# Во время настройки Google Authenticator сделайте скриншот QR кода и сохраните его в виде картинки. | |
# На сайте webqr.com можно расшифровать QR код и получить secret для генерации OTP. | |
# Пример: otpauth://totp/Luna:username?secret=TQPNWO37ZC6J6RG22MLSOIKQR5&algorithm=SHA256 | |
# | |
# В приложении "Связка ключей" на macOS необходимо вручную создать две записи с паролями: |
const FileManager = (()=>{ | |
function pwd() { | |
return $.NSFileManager.defaultManager.currentDirectoryPath.js | |
} | |
function cd(path='~') { | |
if (path==='') path = '.' | |
let p = $(path).stringByStandardizingPath | |
let r = $.NSFileManager.defaultManager |
ObjC.import('stdlib') | |
ObjC.import('CoreGraphics'); | |
// Move mouse cursor to specified position | |
function moveMouse(x, y) { | |
var pos = $.CGPointMake(x, y); | |
var event = $.CGEventCreateMouseEvent(null, $.kCGEventMouseMoved, pos, $.kCGMouseButtonLeft); | |
$.CGEventPost($.kCGHIDEventTap, event); | |
} |
#if DEBUG | |
import SwiftUI | |
protocol UIViewControllerRepresentableHelper: UIViewControllerRepresentable { | |
var configuration: (UIViewControllerType) -> () { get set } | |
} | |
extension UIViewControllerRepresentableHelper { | |
func makeUIViewController(context: Context) -> UIViewControllerType { UIViewControllerType() } | |
func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { configuration(uiViewController) } |
import UIKit | |
import AVFoundation | |
class ViewController: UIViewController { | |
// Duplicate players to handle optional cross-fading. | |
let playerQueue = [AVPlayer(), AVPlayer()] | |
var timeObserverToken: Any? |