Skip to content

Instantly share code, notes, and snippets.

View groob's full-sized avatar
🌻

Victor Vrantchan groob

🌻
View GitHub Profile
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
/**
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
{
"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": {
@groob
groob / pem.go
Created November 21, 2017 05:37
package main
import (
"fmt"
"log"
"os"
"github.com/groob/plist"
)
#!/bin/bash
mkdir -p scripts
cat << EOF
#!/bin/bash
[[ $3 != "/" ]] && exit 0
/bin/launchctl load /Library/LaunchDaemons/com.acme.osqueryd.plist
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"io"
"log"
"os"
{
"decorators": {
"load": [
"SELECT uuid AS host_uuid FROM system_info;",
"SELECT hostname AS hostname FROM system_info;"
]
},
"options": {
"logger_plugin": "gcs",
"host_identifier": "hostname",
@groob
groob / README.md
Last active February 27, 2018 22:43
Puppet-Managedmac
<?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>
<?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>PayloadDisplayName</key>
<string>Security &amp; Privacy</string>
<key>PayloadEnabled</key>