Skip to content

Instantly share code, notes, and snippets.

View iksnae's full-sized avatar

K Mills iksnae

View GitHub Profile
@mminer
mminer / MyService.swift
Last active April 23, 2024 23:00
Components of XPC service.
import Foundation
class MyService: NSObject, MyServiceProtocol {
func upperCaseString(_ string: String, withReply reply: @escaping (String) -> Void) {
let response = string.uppercased()
reply(response)
}
}
@profjsb
profjsb / generate_df_lambda_package.sh
Created June 22, 2017 13:51
Serverless Distributed Decision Forests with AWS Lambda
# build the environment ... this will take awhile
docker run -v $(pwd):/outputs -it amazonlinux:2016.09 /bin/bash /outputs/build.sh
# should end with something like "venv compressed size 51M"
# unpackage that environment
unzip venv.zip -d ve_package/
@andkirby
andkirby / slack.sh
Last active September 18, 2025 15:26
Shell/Bash script for sending slack messages.
#!/usr/bin/env bash
####################################################################################
# Slack Bash console script for sending messages.
####################################################################################
# Installation
# $ curl -s https://gist.githubusercontent.com/andkirby/67a774513215d7ba06384186dd441d9e/raw --output /usr/bin/slack
# $ chmod +x /usr/bin/slack
####################################################################################
# USAGE
# Send message to slack channel/user
@EQuimper
EQuimper / clear.txt
Created June 16, 2017 16:17
React-Native clear Watchman + Cache
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
@ayee
ayee / InstallOpenCViOS.md
Last active January 25, 2021 23:21
How to Install opencv for iOS on OSX
  1. Install cmake
  2. Add to cmake to PATH
PATH=$PATH:/Applications/CMake.app/Contents/bin
  1. Clone OpenCV repository
cd ~/<my_working _directory>
git clone https://github.com/opencv/opencv.git
@alexellis
alexellis / boostrap_faas_arm.md
Last active April 29, 2025 01:47
FaaS serverless framework bootstrap for Raspberry Pi

FaaS serverless framework bootstrap for Raspberry Pi

This bootstraps FaaS onto your Raspberry Pi or ARM board with Docker.

Any Linux/UNIX process can be made a serverless function. Communication with functions is via an API gateway with an easy to use UI portal.

https://github.com/alexellis/faas

Here's the one-shot equivalent from the TestDrive guide

@reitzig
reitzig / Data.swift
Last active April 15, 2022 03:47
Reading InputStream into Data
extension Data {
/**
Consumes the specified input stream, creating a new Data object
with its content.
- Parameter reading: The input stream to read data from.
- Note: Closes the specified stream.
*/
init(reading input: InputStream) {
self.init()
input.open()
@stefanbuck
stefanbuck / upload-github-release-asset.sh
Last active October 23, 2025 10:14
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner
@khanlou
khanlou / Fonts.swift
Created October 6, 2016 21:10
Print all fonts in Swift 3
UIFont.familyNames.forEach({ familyName in
let fontNames = UIFont.fontNames(forFamilyName: familyName)
print(familyName, fontNames)
})
@mojenmojen
mojenmojen / findNb.js
Created September 24, 2016 03:40
Codewars Kata: Your task is to construct a building which will be a pile of n cubes. The cube at the bottom will have a volume of n^3, the cube above will have volume of (n-1)^3 and so on until the top which will have a volume of 1^3. You are given the total volume m of the building. Being given m can you find the number n of cubes you will have…
function findNb(m) {
// create an endless loop that increments n, the cube number, starting with a value of 1
for ( var n = 0;;n++ ) {
if ( m > 0 ) {
// if m, the total volume, is not 0, we will subtract the volume of the current cube from it
// first calculate the volume of the current cube
var currCubeVol = Math.pow( n+1, 3);