Skip to content

Instantly share code, notes, and snippets.

Victor Vrantchan groob

Block or report user

Report or block groob

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Advent of Code Day 8.swift
import Foundation
enum Pixel: Int {
case black = 0
case white = 1
case transparent = 2
}
let width = 25
let height = 6
View Advent of Code Day 4.swift
extension Int {
func digits() -> [Int] {
var newN = self
var result: [Int] = []
while newN > 0 {
let r = newN % 10
newN = newN / 10
result.append(r)
}
result.reverse()
View Advent of Code Day 3.swift
import Foundation
enum GeometryErr: Error {
case InvalidDirection
case InvalidDistance
}
enum Direction {
case Up(_ distance: Int)
case Down(_ distance: Int)
View Advent of Code 2019 Day 2.swift
func calculate(_ inputs: [Int], _ idx: Int = 0) -> [Int] {
let opcode = inputs[idx]
if opcode == 99 { return inputs }
let x = inputs[inputs[idx+1]]
let y = inputs[inputs[idx+2]]
let out = inputs[idx+3]
var result : [Int] = inputs
switch opcode {
case 1: result[out] = x+y
View Advent2019_Day1.swift
import Foundation
func cost(_ mass: Int) -> Int {
return (mass/3) - 2
}
func moduleCost(_ mass: Int, _ sum: Int = 0) -> Int {
let remainder = cost(mass)
let sum = sum + remainder
if cost(remainder) <= 0 {
View SynchronizedDefaults.swift
/**
Example SwiftUI which synchronizes GUI toggles as booleans and stores them in UserDefaults
Mostly from the answer here:
https://stackoverflow.com/questions/56822195/how-do-i-use-userdefaults-with-swiftui
*/
import SwiftUI
import Foundation
import Combine
View osquery.conf
{
"decorators": {
"load": [
"SELECT uuid AS host_uuid FROM system_info;",
"SELECT hostname AS hostname FROM system_info;"
]
},
"options": {
"logger_plugin": "gcs",
"host_identifier": "hostname",
View osquery.conf
{
"options": {
"logger_plugin": "dev_logger,gcplog",
"logger_path": "/tmp/osq.log",
"host_identifier": "specified",
"specified_identifier" : "groob.acme.co",
"config_plugin": "gist",
"schedule_splay_percent": 10
},
"schedule": {
View pem.go
package main
import (
"fmt"
"log"
"os"
"github.com/groob/plist"
)
View mdm_profile.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>AccessRights</key>
<integer>8191</integer>
<key>CheckInURL</key>
You can’t perform that action at this time.