Skip to content

Instantly share code, notes, and snippets.

@nshalman
nshalman / wireguard-example.sh
Created June 30, 2023 16:29
wireguard example for SmartOS
#!/bin/bash -x
################ CHANGE THESE ##################
# Your Home IP or DNS record
WG_ADDRESS=wireguard.example.com
# UDP port forwarded to this machine
WG_PORT=12345
# DNS entries for the client to use when on VPN
WG_DNS=8.8.8.8
# Unused private IPs for this connection
@jperkin
jperkin / trunk-images.md
Last active May 18, 2019 16:02
Test pkgsrc trunk bootstraps and images

pkgsrc trunk packages and images

Now that pkgin has refresh support and the macOS trunk builds have proven that a rolling trunk release works well, I am happy to make SmartOS/illumos trunk packages and images available again for testing.

These are rolling builds of pkgsrc trunk every day (or so), providing the latest packages without having to upgrade across quarterly releases. Just install once then pkgin full-upgrade to keep up-to-date.

This is primarily of interest to:

  • Users who just want the latest software.
  • Users who don't want to bother with having to upgrade releases every quarter.
@simme
simme / diff.swift
Created August 10, 2016 13:43
Utility for diffing two arrays of arrays.
enum DiffModification<T: Equatable> {
case inserted(position: NSIndexPath, value: T)
case deleted(position: NSIndexPath, value: T)
case moved(position: NSIndexPath, newPosition: NSIndexPath, value: T)
}
extension DiffModification: CustomDebugStringConvertible {
var debugDescription: String {
switch self {
case .inserted(let position, let value):
@bahamat
bahamat / no_compute_resources_available.md
Last active December 5, 2021 07:14
Diagnosing "No Compute Resources Available" messages in Triton.

No Compute Resources Available

This error is somewhat ambiguious because there is seemingly no indication which resource is exhausted.

Triton chooses compute nodes with a subcomponent called sdc-designation (also refered to as , DAPI). The full DAPI log for a provision job is embedded in the CNAPI log file and can be extracted with the workflow job uuid.

Note: The script below is no longer necessary because cnapi now includes /opt/smartdc/cnapi/bin/alloc-reasons.sh which does the same thing.

#!/bin/bash
@pkuecuekyan
pkuecuekyan / SearchContainerInTabBar.swift
Last active March 23, 2021 14:54
Set up a UISearchContainerViewController inside a UITabBar for tvOS 9
func setupTabBarWithSearchContainerView() {
// configure a UIViewController to display search results
// needs to conform to the UISearchResultsUpdating protocol
let searchResultsViewController = SearchResultsViewController()
// setup UISearchController and hook up to search results UIViewController
let searchController = UISearchController(searchResultsController: searchResultsViewController)
searchController.searchResultsUpdater = searchResultsViewController
searchController.hidesNavigationBarDuringPresentation = false
@bahamas10
bahamas10 / 0-README.md
Last active January 4, 2019 18:02
Joyent Manta Functions

Setting up fabrics in coal

Prerequisites

You need pretty much the newest version of everything. Go update it all. I'll wait.

sdcadm installations and configuring

MDB is unlike most debuggers you've experienced.

It is not a source level debugger like gdb or lldb or even Node's builtin debugger

Generally used for postmortem analysis.

Postmortem is for Production and Development

We operate mostly on core files, though you can attach to running processes as well.

@sebastianhoitz
sebastianhoitz / StreamingResponse.coffee
Last active December 26, 2022 07:06
node.JS streaming zip file
zipstream = require "zipstream"
fs = require "fs"
async = require "async"
class StreamingResponse
filename: ""
files: []
streaming: true
###
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)