Skip to content

Instantly share code, notes, and snippets.

View groob's full-sized avatar
🌻

Victor Vrantchan groob

🌻
View GitHub Profile
@groob
groob / homepage.go
Created November 8, 2016 22:50
read safari homepage in go
package main
/*
#cgo LDFLAGS: -framework IOKit -framework ApplicationServices
#include <CoreFoundation/CoreFoundation.h>
#include <stdlib.h>
// cfstring_utf8_length returns the number of characters successfully converted to UTF-8 and
// the bytes required to store them.
static inline CFIndex cfstring_utf8_length(CFStringRef str, CFIndex *need) {
@groob
groob / deploy.go
Last active December 21, 2022 03:39
/*
HookHandler - listen for github webhooks, sending updates on channel.
DeploymentMonitor select update type based on channel and call deployment script
*/
package main
import (
"fmt"
"html/template"
"io/ioutil"
func getOSVerProfile() throws -> OSVersionRequirement? {
if Utils().demoModeEnabled() {
return nil
}
guard
let osRequirements = nudgeDefaults.object(forKey: "osVersionRequirements") as? [[String:AnyObject]]
else {
// Log missing key in nudgeDefaults
return nil
<?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>PayloadType</key>
<string>com.apple.applicationaccess</string>
<key>PayloadVersion</key>
@groob
groob / hi_frogor.go
Last active December 12, 2019 01:26 — forked from pudquick/hi_groob.py
Search my gists ;p
package main
import (
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
)
import Foundation
enum Pixel: Int {
case black = 0
case white = 1
case transparent = 2
}
let width = 25
let height = 6
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()
import Foundation
enum GeometryErr: Error {
case InvalidDirection
case InvalidDistance
}
enum Direction {
case Up(_ distance: Int)
case Down(_ distance: Int)
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 {