Skip to content

Instantly share code, notes, and snippets.

import Foundation
struct EmojiUnkeyedEncodingContainer : UnkeyedEncodingContainer {
// MARK: Properties
private(set) public var codingPath: [CodingKey]
private var encoder: EmojiEncoder;
/// The number of elements encoded into the container.
public var count: Int {
@fikeminkel
fikeminkel / DNSTxtRecord.swift
Created April 26, 2017 20:56
Swift 3.1 DNS TXT record lookup
import dnssd
struct DNSTxtRecord {
typealias DNSLookupHandler = ([String: String]?) -> Void
static func lookup(_ domainName: String, completionHandler: @escaping DNSLookupHandler) {
var mutableCompletionHandler = completionHandler // completionHandler needs to be mutable to be used as inout param
let callback: DNSServiceQueryRecordReply = {
(sdRef, flags, interfaceIndex, errorCode, fullname, rrtype, rrclass, rdlen, rdata, ttl, context) -> Void in
@julianxhokaxhiu
julianxhokaxhiu / create-iso.sh
Created September 24, 2016 21:46
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
@zwaldowski
zwaldowski / Extra Logging for My Great App.mobileconfig
Last active October 11, 2024 08:09
Apple Configuration Profile for Logging in iOS 10 and macOS Sierra
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- iOS 10, macOS Sierra, and friends bring a new logging subsystem that's
supposed to scale from the kernel, up to frameworks, and up to apps. It defaults
to a more regimented, privacy-focused approach that large apps and complex
systems need.
It, along with Activity Tracing introduced in iOS 8 and macOS Yosemite and the
Console app in macOS Sierra, hope to help you graduate from caveman debugging to
@iamarcel
iamarcel / Creating Neat .NET Core Command Line Apps.md
Last active November 28, 2023 10:41
Creating Neat .NET Core Command Line Apps

Creating Neat .NET Core Command Line Apps

You can now read this on my (pretty) website! Check it out here.

Every reason to get more HackerPoints™ is a good one, so today we're going to write a neat command line app in .NET Core! The Common library has a really cool package Microsoft.Extensions.CommandlineUtils to help us parse command line arguments and structure our app, but sadly it's undocumented.

No more! In this guide, we'll explore the package and write a really neat

@timsutton
timsutton / make_acrobat_dc_cust_pkg.sh
Created July 12, 2016 17:17
Simple script to automate the Adobe Acrobat Customization Wizard steps
#!/bin/sh
#
# Very quick and dirty script to make an unserialized, customized
# Acrobat Pro DC installer via the customization wizard, but
# in an automated fashion.
# This does the equivalent of the following in the wizard:
# - Accept EULA
# - Disable PDF Rendering in browsers
# - Enable Feature Lockdown (supplies a plist that disables the updater
# for 10/11/2015/DC)
import ctypes, zlib
import xml.etree.ElementTree as ET
class SimpleObj(object):
pass
class XarHeader(ctypes.BigEndianStructure):
_pack_ = 1
_fields_ = [('magic', ctypes.c_char*4),
('size', ctypes.c_uint16),
@bruienne
bruienne / manifest.plist
Last active October 21, 2020 13:41
Sample manifest to use with MDM InstallApplication command
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
@pudquick
pudquick / bom.py
Last active November 18, 2021 15:55
Parsing of bom files in pure python
# Python routines for parsing bom files
#
# Examples so far:
#
# dump_bom(filename) - prints diagnostic structure information about bom file (including path list)
from ctypes import BigEndianStructure, c_char, c_uint8, c_uint16, c_uint32, sizeof, memmove, addressof
class BOMHeader(BigEndianStructure):
_pack_ = 1
@groob
groob / coreos-user_data.yml
Last active January 20, 2016 17:26
netboot on linux
#cloud-config
---
ssh_authorized_keys:
- ssh-rsa mysecretkey
hostname: coreos01
coreos:
etcd:
name: coreos01
#discovery: https://discovery.etcd.io/b37f862b7eb38b8703effc034b814019