Skip to content

Instantly share code, notes, and snippets.

View dinobei's full-sized avatar

Park Byeongju dinobei

View GitHub Profile
# Building FAT librares for XCode 10
set -e
# If we're already inside this script then die
if [ -n "$MULTIPLATFORM_BUILD_IN_PROGRESS" ]; then
exit 0
fi
export MULTIPLATFORM_BUILD_IN_PROGRESS=1
@dinobei
dinobei / nodejs.sh
Last active September 18, 2019 06:49 — forked from Gioyik/nodejs.sh
Script to cross compile NodeJS for ARMv7, Cortex-a5
#!/bin/sh -e
#Define our target device
export TARGET_ARCH="-march=armv7-a"
export TARGET_TUNE="-mtune=cortex-a5 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb"
#Define the cross compilators on your system
export AR="arm-none-linux-gnueabi-ar"
export CC="arm-none-linux-gnueabi-gcc"
export CXX="arm-none-linux-gnueabi-g++"
@dinobei
dinobei / ViewController.swift
Created July 4, 2018 07:18
Scrolling NSScrollView programatically (swift 4.0, cocoa in macOS)
class ViewController {
...
override func viewDidAppear() {
...
// scrolling to top
scrollView.documentView?.scroll(NSPoint(x: 0, y: documentView.bounds.size.height))
// scrolling to bottom
scrollView.documentView?.scroll(NSPoint.zero)
@dinobei
dinobei / SomeSheetViewController.swift
Last active July 4, 2018 07:19
Prevent resizing a view controller which is presented as a sheet (swift 4.0, cocoa in macOS)
class SomeSheetViewController.swift {
...
override func viewDidLoad() {
...
// referenced by https://stackoverflow.com/a/30112516/6770674
self.preferredContentSize = self.view.frame.size
...
@dinobei
dinobei / KKSimplePlayer.swift
Created June 8, 2018 06:52 — forked from zonble/KKSimplePlayer.swift
Using AudioQueue and Swift to do a simple stream player
import Foundation
import AudioToolbox
class KKSimplePlayer: NSObject {
var URL: NSURL
var URLSession: NSURLSession!
var packets = [NSData]()
var audioFileStreamID: AudioFileStreamID = nil
var outputQueue: AudioQueueRef = nil
var streamDescription: AudioStreamBasicDescription?
@dinobei
dinobei / RecordAudio.swift
Created May 11, 2017 16:22 — forked from hotpaw2/RecordAudio.swift
Swift 3.0 Audio Recording class. Reads buffers of input samples from the microphone using the iOS RemoteIO Audio Unit API
//
// RecordAudio.swift
//
// This is a Swift 3.0 class
// that uses the iOS RemoteIO Audio Unit
// to record audio input samples,
// (should be instantiated as a singleton object.)
//
// Created by Ronald Nicholson on 10/21/16. Updated 2017Feb07
// Copyright © 2017 HotPaw Productions. All rights reserved.
@dinobei
dinobei / Keychain.swift
Created August 24, 2016 06:26 — forked from jackreichert/Keychain.swift
Swift Keychain class ( supported Xcode Version 7.0 beta 4 (7A165t) )
import UIKit
import Security
class Keychain {
class func save(key: String, data: NSData) -> Bool {
let query = [
kSecClass as String : kSecClassGenericPassword as String,
kSecAttrAccount as String : key,
kSecValueData as String : data ]