Skip to content

Instantly share code, notes, and snippets.

View colemancda's full-sized avatar
🏎️
Working with Swift on ARM

Alsey Coleman Miller colemancda

🏎️
Working with Swift on ARM
View GitHub Profile
@beccadax
beccadax / JSONFeed.swift
Last active June 18, 2020 08:21
JSON Feed parser in Swift 4—now updated for Xcode 9 Beta 1. Uses the new Codable protocol and JSONDecoder class.
import Foundation
let feedURL = URL(string: "https://daringfireball.net/feeds/json")!
// MARK: Basic models
// We do not model the `userComment` field because it is not supposed to be used by
// machines. We do not model extensions because they should be ignored unless
// supported anyway.
struct Feed {
@uraimo
uraimo / xcompiler_with_spm_raspbian_302.md
Last active March 9, 2018 03:13
Building a cross-compiling toolchain for Swift 3.0.2 on Raspbian with working SPM

To build a Raspbian toolchain for Swift 3.0.2 a few things need to be changed in the original guide.

Download the Swift 3.0.2 packages instead of the 3.1.1 ones:

curl -o /tmp/swift-3.0.2-RPi1Zero-RaspbianNov16.tgz  https://www.dropbox.com/s/dkrkt9ht1c3hog2/swift-3.0.2-RPi1Zero-RaspbianNov16.tgz
curl -o /tmp/swift-3.0.2-RELEASE-osx.pkg https://swift.org/builds/swift-3.0.2-release/xcode/swift-3.0.2-RELEASE/swift-3.0.2-RELEASE-osx.pkg

Launch the script with these parameters:

@NicholasTD07
NicholasTD07 / codecov-with-spm.md
Created May 10, 2017 23:29
Generate code coverage report with Swift Package Manager

Set up

gem install xcov # required | might need sudo
gem install fastlane # optional | might also need sudo

Generate code coverage report

exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
export ALREADYINVOKED="true"
@colemancda
colemancda / IoTLima-14-08-206.swift
Last active August 13, 2016 20:06
IoT, BLE, Swift y Linux Workshop
let title = "IoT, BLE, Swift y Linux"
// When
let date = "August 13th, 2016"
let city = "Lima, Peru"
let location = "Laboratoria Perú"
// Duration
let hours = 8
@colemancda
colemancda / SunXi.swift
Created June 7, 2016 05:25
SunXi Extensions for SwiftyGPIO
//
// SunXi.swift
//
//
// Created by Alsey Coleman Miller on 6/7/16.
// Copyright © 2016 ColemanCDA. All rights reserved.
//
public struct SunXiGPIO: CustomStringConvertible, Equatable {
@gabonator
gabonator / camera.md
Created June 4, 2016 13:48
Cheap chinese IP camera with H264 encoding based on Hisilicon 8M (Hi3518E) chip

Cheap chinese IP camera with H264 encoding based on Hisilicon 8M (Hi3518E) chip

Video stream url for VLC/DVR:

  • rtsp://192.168.1.93:554/user=admin&password=&channel=&stream=.sdp?real_stream--rtp-caching=100

Telnet access

  • telnet 192.168.1.10 23
  • Localhost login: root
  • Password: xmhdipc
import Foundation
extension UIDevice {
/**
Try to get the username from the device name using common knows
default device names format.
- copyright: Owen Godfrey on [StackOverflow](http://stackoverflow.com/questions/8261961/better-way-to-get-the-users-name-from-device)
- remark: Original regexpr improved to support custom name with model included eg. `<username>'s iPhone 6S`
@diamondo25
diamondo25 / main.go
Last active December 13, 2022 09:15
Golang TinyMapleServer
package main
import (
"bufio"
"bytes"
"encoding/binary"
"encoding/hex"
"flag"
"fmt"
"net"
@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen