Skip to content

Instantly share code, notes, and snippets.

@NicholasBellucci
NicholasBellucci / ScrollingTextView.swift
Last active March 1, 2024 03:37
MacOS swift marquee scrolling text view
import Cocoa
open class ScrollingTextView: NSView {
// MARK: - Open variables
/// Text to scroll
open var text: NSString?
/// Font for scrolling text
open var font: NSFont?
//
// 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.
@DejanEnspyra
DejanEnspyra / Obfuscator.swift
Created May 31, 2017 17:51
Obfuscation of hard-coded security-sensitive strings.
//
// Obfuscator.swift
//
// Created by Dejan Atanasov on 2017-05-31.
//
import Foundation
class Obfuscator: AnyObject {
@sooop
sooop / StreamReader.swift
Last active May 28, 2023 13:00
Read a large text file line by line - Swift 3
import Foundation
class StreamReader {
let encoding: String.Encoding
let chunkSize: Int
let fileHandle: FileHandle
var buffer: Data
let delimPattern : Data
var isAtEOF: Bool = false
@mminer
mminer / formatBytes.swift
Last active April 19, 2023 00:59
Formats bytes into a more human-readable form (e.g. MB).
import Foundation
func format(bytes: Double) -> String {
guard bytes > 0 else {
return "0 bytes"
}
// Adapted from http://stackoverflow.com/a/18650828
let suffixes = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
let k: Double = 1000
AVCaptureDeviceFormat
'vide'/'420v' 192x 144, { 2- 30 fps}, fov:54.400, binned, max zoom:60.75 (upscales @6.75), AF System:1, ISO:33.0-792.0, SS:0.000016-0.500000>
'vide'/'420f' 192x 144, { 2- 30 fps}, fov:54.400, binned, max zoom:60.75 (upscales @6.75), AF System:1, ISO:33.0-792.0, SS:0.000016-0.500000>
'vide'/'420v' 352x 288, { 2- 30 fps}, fov:49.531, binned, max zoom:60.75 (upscales @3.35), AF System:1, ISO:33.0-792.0, SS:0.000016-0.500000>
'vide'/'420f' 352x 288, { 2- 30 fps}, fov:49.531, binned, max zoom:60.75 (upscales @3.35), AF System:1, ISO:33.0-792.0, SS:0.000016-0.500000>
'vide'/'420v' 480x 360, { 2- 30 fps}, fov:54.400, binned, max zoom:60.75 (upscales @2.70), AF System:1, ISO:33.0-792.0, SS:0.000016-0.500000>
'vide'/'420f' 480x 360, { 2- 30 fps}, fov:54.400, binned, max zoom:60.75 (upscales @2.70), AF System:1, ISO:33.0-792.0, SS:0.000016-0.500000>
'vide'/'420v' 640x 480, { 2- 30 fps}, fov:54.400, binned, max zoom:60.75 (upscales @2.03), AF System:1, ISO:33.0-792.0, SS:0.000016-0.500000>
'
<AdwareDefinition>
<Version>1.0</Version>
<DefinitionAuthor>Matthew Warren</DefinitionAuthor>
<DefinitionSource>http://www.adwaremedic.com/signatures.xml</DefinitionSource>
<!-- Supplemental ADF based on AdwareMedic Signatures. Should be used as
a complement to the default HT-203987 definitions
-->
<Adware>
<AdwareName>FkCodec</AdwareName>
<!-- Does not remove related browser extensions -->
@sheagcraig
sheagcraig / AdwareCheckExtensionAttribute.py
Last active November 27, 2021 23:51
Check for Adware per Apple Kbase article
#!/usr/bin/python
"""Identify or remove files known to be involved in Adware/Malware
infection.
Most of the code applies to building a list of malware files. Thus,
both extension attribute and removal handling are included.
Cleans files as a Casper script policy; thus, it expects four total
arguments, the first three of which it doesn't use, followed by
--remove
@kaishin
kaishin / UIColor+isLight.h
Last active May 19, 2021 06:22
Get whether a color is dark or light using either luminance or lightness.
#import <UIKit/UIKit.h>
@interface UIColor (isLight)
- (CGFloat)lightness;
- (CGFloat)perceivedLightness;
- (CGFloat)perceivedLightnessW3C;
- (BOOL)isLight;
- (BOOL)isPerceivedLightW3C;
- (BOOL)isPerceivedLight;
@jessepeterson
jessepeterson / remove_ilife_dvd.sh
Created May 23, 2013 03:10
Remove iLife '11 (DVD installer)
#!/bin/sh
# Remove *all* components of iLife '11 as installed by the "DVD" installer
rm -rf \
"/Applications/iWeb.app" \
"/Library/Audio/Apple Loops/Apple/iLife Sound Effects" \
"/Applications/GarageBand.app" \
"/Library/Audio/Apple Loops/Apple/Apple Loops for GarageBand" \
"/Applications/iDVD.app" \