Skip to content

Instantly share code, notes, and snippets.

View groob's full-sized avatar
🌻

Victor Vrantchan groob

🌻
View GitHub Profile
package main
/*
#cgo darwin CFLAGS: -DDARWIN -x objective-c
#cgo darwin LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
void DockRunning() {
int isRunning = 0;
NSWorkspace * ws = [NSWorkspace sharedWorkspace];
package main
/*
#cgo LDFLAGS: -framework SystemConfiguration
#include <SystemConfiguration/SystemConfiguration.h>
#include <stdlib.h>
*/
import "C"
import (
"errors"
func checkDistribution(pkgPath string) (bool, error) {
const (
xarHeaderMagic = 0x78617221
xarHeaderSize = 28
)
f, err := os.Open(pkgPath)
if err != nil {
return false, err
}
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"io"
"log"
"os"
@groob
groob / munki_loop.go
Last active May 1, 2017 22:23
run munki in a loop until removed.
// runs `managedsoftwareupdate --id=dep_bootstrap` in a loop.
// This utility is installed along with munkitools via InstallApplication during DEP enrollment.
// The utility is stopped/removed by a package called dep_complete which is the last item to run in the
// `dep_bootstrap` munki manifest.
package main
import (
"fmt"
"log"
#!/bin/bash
mkdir -p scripts
cat << EOF
#!/bin/bash
[[ $3 != "/" ]] && exit 0
/bin/launchctl load /Library/LaunchDaemons/com.acme.osqueryd.plist
package main
import (
"crypto/tls"
"flag"
"io"
"log"
"net"
"net/http"
"net/http/httputil"
@groob
groob / munki-dep-graph.go
Created January 30, 2017 19:09
building a DAG for munki catalogs. This is an incomplete exercise.
// Copyright (c) 2016 Marin Atanasov Nikolov <dnaeon@gmail.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer
// in this position and unchanged.
// 2. Redistributions in binary form must reproduce the above copyright
@groob
groob / index.html
Created January 27, 2017 19:28
go form error
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>awesome go project</title>
</head>
<body>
<form class="form-upload" method="post" action="/upload">
<fieldset>
<input type="text" name="first_name" />
package scoped
import (
"errors"
"github.com/go-kit/kit/auth/jwt"
"github.com/go-kit/kit/endpoint"
"golang.org/x/net/context"
)