Skip to content

Instantly share code, notes, and snippets.

@xocialize
xocialize / jerry.swift
Created April 18, 2025 18:08 — forked from vorce/jerry.swift
Mouse move and click test thing for macos in swift
import Cocoa
import Foundation
// Move around and click automatically at random places in macos, kinda human like in a cheap way.
// Moves the mouse pointer to `moves` random locations on the screen and runs the `action` function at
// each point with the point as argument.
func mouseMoveWithAction(moves: Int, action: (CGPoint) -> Void = defaultAction) {
let screenSize = NSScreen.main?.visibleFrame.size
@xocialize
xocialize / HoverView.swift
Created April 9, 2025 23:26 — forked from mminer/HoverView.swift
NSView subclass that applies an effect when the mouse hovers over it.
import AppKit
class HoverView: NSView {
override var wantsUpdateLayer: Bool {
return true
}
private var isMouseOver = false {
didSet {
@xocialize
xocialize / .sh
Created April 10, 2019 18:15
default setup for new os x installation
#!/bin/sh
#Run this script after imaging a machine, this can run as a first run script (at REBOOT), but needs no parameters set if used from the Casper Suite
# Determine OS version
osvers=$(sw_vers -productVersion | awk -F. '{print $2}')
sw_vers=$(sw_vers -productVersion)
# Determine OS build number
sw_build=$(sw_vers -buildVersion)
LOCATION="${BUILT_PRODUCTS_DIR}"/"${FRAMEWORKS_FOLDER_PATH}"
# By default, use the configured code signing identity for the project/target
#IDENTITY="${CODE_SIGN_IDENTITY}"
IDENTITY="${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
if [ "$IDENTITY" == "" ]
then
# If a code signing identity is not specified, use ad hoc signing
IDENTITY="-"
fi
@xocialize
xocialize / gist:7f5d8b119bf143e1cdc83f217a0bf90b
Created March 15, 2019 21:21
Output from Sparkle Make Release
Merus-Mac-mini:Sparkle-ui-separation-and-xpc meru$ make release
xcodebuild -scheme Distribution -configuration Release -derivedDataPath "/var/folders/7q/2cq4mfm560g0cynz6t84zm1m0000gn/T//Sparkle.P2NhnD" build
User defaults from command line:
IDEDerivedDataPathOverride = /var/folders/7q/2cq4mfm560g0cynz6t84zm1m0000gn/T/Sparkle.P2NhnD
note: Using new build system
note: Planning build
note: Constructing build description
Build system information
warning: SparkleDownloader isn't code signed but requires entitlements. It is not possible to add entitlements to a binary without signing it. (in target 'SparkleDownloader')
@xocialize
xocialize / fontslist.swift
Created January 18, 2019 23:44
List Mac OS fonts
let fontFamilies = NSFontManager.shared.availableFontFamilies
for (index, family) in fontFamilies.enumerated() {
print("\(index). \(family)")
}
let fonts = NSFontManager.shared.availableFonts
for (index, font) in fonts.enumerated() {
print("\(index). \(font)")
}
@xocialize
xocialize / mac os hardware device id
Created January 16, 2019 23:02
Hardware ID mac os
//http://www.markcornelisse.nl/cocoa/cocoa-hardware-identifier-inside-os-x/
import Foundation
import IOKit
public var hardwareUUID: NSUUID = {
var hwUUIDBytes: [UInt8] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
var ts = timespec(tv_sec: 0,tv_nsec: 0)
gethostuuid(&hwUUIDBytes, &ts)
return NSUUID(UUIDBytes: hwUUIDBytes)
}()
@xocialize
xocialize / vfl.swift
Created January 10, 2019 00:29
VFL Centering
// Center horizontally
var constraints = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[superview]-(<=1)-[label]",
options: NSLayoutFormatOptions.AlignAllCenterX,
metrics: nil,
views: ["superview":view, "label":label])
view.addConstraints(constraints)
// Center vertically
Quit Xcode.
Open Terminal.
Typed Command xattr -rc /Users/manabkumarmal/Desktop/Projects/MyProjectHome
Open Xcode.
Cleaned.
Now worked and No Error.
@xocialize
xocialize / Create iOS Icons 2017 Sizes.jsx
Created October 25, 2017 21:51 — forked from alexsdesign/Create iOS Icons 2016 Sizes.jsx
Photoshop Script to Create iOS Icons from a source image
// JavaScript Document
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale