Skip to content

Instantly share code, notes, and snippets.

View st3fan's full-sized avatar

Stefan Arentz st3fan

View GitHub Profile
#[cfg(test)]
mod tests {
use std::convert::TryInto;
use std::num::TryFromIntError;
#[test]
fn it_works() {
let a = 1i16;
let b: Result<i8, TryFromIntError> = a.try_into();
assert!(b.is_ok());
// Random code from https://docs.microsoft.com/en-ca/learn/paths/rust-first-steps/
use std::fmt;
trait Distance<T> {
fn distance(&self) -> T;
}
#[derive(Debug, PartialEq)]
struct Point<T> {
@st3fan
st3fan / day20.c
Created November 14, 2021 23:20
Advent of Code - 2015 Day 20
/* Advent of Code - 2015 Day 20 */
#include <stdio.h>
#include <dispatch/dispatch.h>
int number_of_presents(int house) {
int n = 0;
for (int elf = 1; elf <= house; elf++) {
if ((house % elf) == 0) {
n += (10 * elf);
#!/bin/sh
#
# Disable Siri Suggestions on Simulators and SwiftUI Previews to
# avoid Spotlight heating up your MacBook by keeping 4 cores busy
# at 100%.
#
# See https://developer.apple.com/forums/thread/683277
#
//
// ContentView.swift
// WhatIsMyIP
//
// Created by Stefan Arentz on 02/10/2021.
//
import SwiftUI
struct Address {
#!/bin/sh
set -x
env CGO_CFLAGS="-mmacosx-version-min=10.15" CGO_LDFLAGS="-mmacosx-version-min=10.15" CGO_ENABLED=1 GOARCH=amd64 go build -installsuffix argussh_amd64 -o argussh-amd64.a -buildmode=c-archive
env CGO_CFLAGS="-mmacosx-version-min=10.15" CGO_LDFLAGS="-mmacosx-version-min=10.15" CGO_ENABLED=1 GOARCH=arm64 go build -installsuffix argussh_arm64 -o argussh-arm64.a -buildmode=c-archive
mv ./argussh-amd64.h ./argussh.h
lipo -create argussh-amd64.a argussh-arm64.a -output argussh.a
import Vapor
import Redis
struct Counter: Content {
let id: UUID
let name: String
let value: Int
}