kextstat | egrep -v '\bcom.apple.'
sudo fdesetup authrestart
import javax.servlet.*; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import java.io.IOException; | |
import java.net.URI; | |
import java.net.URISyntaxException; | |
import static java.lang.String.format; | |
public class HttpsFilter implements Filter { |
<?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>Label</key> | |
<string>spiped-ssh</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/bin/spiped</string> | |
<string>-d</string> |
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); |
(ns ring.middleware.x-forwarded-for | |
(:use [clojure.string :only (split)])) | |
(defn wrap-x-forwarded-for [handler] | |
(fn [request] | |
(if-let [xff (get-in request [:headers "x-forwarded-for"])] | |
(handler (assoc request :remote-addr (last (split xff #"\s*,\s*")))) | |
(handler request)))) |
; Context: | |
; http://stackoverflow.com/questions/3436216/how-to-map-clojure-code-to-and-from-json | |
(defn escape-string [x] | |
(clojure.string/replace x #"^[':\\]" "\\\\$0")) | |
(defn code-to-json [x] | |
(condp #(%1 %2) x | |
number? x | |
symbol? (str \' (name x)) |
require "lifx" # http://www.rubydoc.info/gems/lifx | |
def calculate_color(i) # 0 <= i <= 1 | |
h = [40 * 2 * i, 40].min # will be 40 (yellow) at i=1/2 and stay there | |
s = 1.0 - [(i - 0.5) * 2, 0].max # will be 1 until i=1/2 and then go down to 0 | |
b = i | |
LIFX::Color.hsbk(h, s, b, LIFX::Color::KELVIN_MIN) | |
end | |
duration = 10 * 60 # seconds |
#!/usr/bin/env ruby | |
require "libvirt" | |
def vm_sync_shutdown(name) | |
conn = Libvirt::open("qemu:///system") | |
dom = conn.lookup_domain_by_name(name) | |
# TODO: Use dom.state instead of dom.info.state when it gets available |
// 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: |