kextstat | egrep -v '\bcom.apple.'
sudo fdesetup authrestart
// Based on https://www.tomas-dvorak.cz/posts/nodejs-request-without-dependencies/ | |
import * as https from "https"; | |
async function httpsExchange(requestOptions: https.RequestOptions): Promise<string> { | |
return new Promise<string>((resolve, reject) => { | |
const request = https.request(requestOptions, (response) => { | |
if (response.statusCode < 200 || response.statusCode > 299) { | |
reject(new Error("Non-2xx status code: " + response.statusCode)); | |
} |
swagger: "2.0" | |
info: | |
title: LIFX HTTP Remote Control API | |
version: v1 | |
description: https://api.developer.lifx.com/ | |
host: api.lifx.com | |
basePath: /v1 | |
schemes: | |
- https | |
produces: |
<properties> | |
<maven.compiler.source>1.8</maven.compiler.source> | |
<maven.compiler.target>1.8</maven.compiler.target> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |
</properties> |
;; https://github.com/plumatic/schema | |
;; https://github.com/dakrone/clj-http | |
;; http://api.developer.lifx.com/docs/set-state | |
(ns lifx-http-api | |
(:require [schema.core :as s] | |
[clj-http.client :as http])) | |
(def ^:dynamic *base-url* "https://api.lifx.com/v1/lights") | |
(def ^:dynamic *auth-token* "<get yours at https://cloud.lifx.com/settings>") |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Optional; | |
import java.util.Set; | |
import java.util.stream.Stream; | |
import static java.util.stream.Collectors.toList; | |
import static java.util.stream.Collectors.toSet; | |
public class Optionals { |
(ns fancy-defn | |
(:require [schema.core :as s] | |
[clojure.core.typed :as t] | |
[circle.schema-typer :as st])) | |
;; Schemas created with s/defn end up using this. | |
(defmethod st/convert schema.core.One [schema] | |
(assert (= false (:optional? schema))) ;; No support for optional arguments yet. | |
(st/convert (:schema schema))) |
class ThriftSerializer extends JsonSerializer<TBase> { | |
@Override | |
public void serialize(TBase value, JsonGenerator jgen, SerializerProvider provider) throws IOException { | |
try { | |
TProtocolFactory f = new TSimpleJSONProtocol.Factory(); | |
String s = new TSerializer(f).toString(value); | |
jgen.writeRawValue(s); | |
} | |
catch (TException e) { | |
throw new IOException(e); |
#!/bin/bash | |
# Usage: cwd.sh /app /usr/bin/python example.py | |
cd $1 && exec "${@:2}" |