Skip to content

Instantly share code, notes, and snippets.

View scihant's full-sized avatar

Salih Cihan Tek scihant

  • Lyrebird Studio
  • Istanbul, Turkey
View GitHub Profile
@juliendargelos
juliendargelos / imagemagick-trim-transparent.sh
Last active June 17, 2025 15:02
Imagemagick command that trims transparent pixels from an image.
convert input.png -trim +repage output.png
//
// 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.
@telliott99
telliott99 / bytes.swift
Last active October 11, 2023 13:07
convert NSData -> [UInt8]
import Foundation
let n = 256
let a = Array(0..<n).map { UInt8($0) }
let data = NSData(bytes: a, length: a.count)
print(data) // "<0001...feff>"
let stream = NSInputStream(data: data)
stream.open()