This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env osascript -l JavaScript | |
ObjC.import("Cocoa"); | |
function run(argv) { | |
var app = $.NSApplication.sharedApplication; | |
var statusBarItem = $.NSStatusBar.systemStatusBar.statusItemWithLength($.NSVariableStatusItemLength); | |
var track = Application('Spotify').currentTrack | |
ObjC.registerSubclass({ | |
name: "ProgramDelegate", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/.../fds" | |
"github.com/.../fds/dict" | |
"github.com/.../fds/list" | |
"github.com/.../fds/tree" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autoload -U add-zsh-hook | |
load-devrc() { | |
if [[ -f .devrc && -r .devrc ]]; then | |
source .devrc | |
else | |
if typeset -f devrc-unset > /dev/null; then | |
devrc-unset | |
unset -f devrc-unset | |
fi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ItemList(items: Item[]) { | |
return html` | |
<div class="flex flex-row"> | |
<for each=${items} do=${(item) => html` | |
<if cond=${item.enabled} then=${() => html` | |
<div class="text-white mx-2">${item.label}</div> | |
`}> | |
`} else=${() => html` | |
<div class="text-gray font-bold">No items</div> | |
`}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
"net/http" | |
"os" | |
"os/user" | |
"path/filepath" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo softwareupdate --fetch-full-installer | |
/Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/startosinstall \ | |
--eraseinstall --agreetolicense --nointeraction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from checks import AgentCheck | |
class ConsulCheck(AgentCheck): | |
def should_check(self): | |
r = requests.get(self.init_config["consul_url"] + "/v1/agent/self") | |
if r.status_code != 200: | |
return False | |
agent = r.json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CONSUL="localhost:8500" | |
main() { | |
case "$1" in | |
info) | |
curl -s "$CONSUL/v1/kv/$2" | jq -r .[] | |
;; | |
get) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run this as root | |
while [ 1 ]; do echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload; done | |
# or as an upstart job | |
script | |
echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload | |
end script | |
respawn | |
# now any process can run this or do the equivalent with sockets to trigger reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
type MyInterface interface { | |
Foo() string | |
} |