Skip to content

Instantly share code, notes, and snippets.

View fix-auto-focus.js
// Run with node fix-auto-focus.js
//
// This disables the broken auto-focus on Logitech cameras.
// It works for me on my Logictech 920.
var UVCControl = require('uvc-control');
var camera = new UVCControl(0x046d, 0x082d);
camera.get('autoFocus', function (error, value) {
console.log('Before AutoFocus setting:', value);
View checklist-gist-example.md

Adding a Simple Config Field for Client Agents

  • Add the field to the Config struct (or an appropriate sub-struct) in agent/config/config.go.
  • Add the field to the actual RuntimeConfig struct in agent/config/runtime.go.
  • Add an appropriate parser/setter in agent/config/builder.go to translate.
  • Add the new field with a random value to both the JSON and HCL blobs in TestFullConfig in agent/config/runtime_test.go, it should fail now, then
View stuck-server-goroutines.txt
This file has been truncated, but you can view the full file.
goroutine 643475 [running]:
runtime/pprof.writeGoroutineStacks(0x3628a40, 0xd01a7ad7a0, 0x0, 0x0)
/usr/local/go/src/runtime/pprof/pprof.go:679 +0x9d
runtime/pprof.writeGoroutine(0x3628a40, 0xd01a7ad7a0, 0x2, 0x0, 0x0)
/usr/local/go/src/runtime/pprof/pprof.go:668 +0x44
runtime/pprof.(*Profile).WriteTo(0x566ef00, 0x3628a40, 0xd01a7ad7a0, 0x2, 0xd01a7ad7a0, 0x7f8ec613a460)
/usr/local/go/src/runtime/pprof/pprof.go:329 +0x390
net/http/pprof.handler.ServeHTTP(0xcf94a9c4f1, 0x9, 0x36771a0, 0xd01a7ad7a0, 0xc6c6572b00)
/usr/local/go/src/net/http/pprof/pprof.go:245 +0x356
View gist:778662bec80edd928c1c90fbeb8c453d
Attaching to envoy_consul_1
consul_1 | ==> Starting Consul agent...
consul_1 | ==> Consul agent running!
consul_1 | Version: 'v1.4.4-285-g19361f073-dev (19361f073+CHANGES)'
consul_1 | Node ID: '6d9e3780-cd4a-4520-c4a7-e59a58cb69a5'
consul_1 | Node name: 'a21b7272d6b9'
consul_1 | Datacenter: 'dc1' (Segment: '<all>')
consul_1 | Server: true (Bootstrap: false)
consul_1 | Client Addr: [0.0.0.0] (HTTP: 8500, HTTPS: -1, gRPC: 8502, DNS: 8600)
consul_1 | Cluster Addr: 127.0.0.1 (LAN: 8301, WAN: 8302)
View gomsgpack_polymorphic_type.go
package main
import (
"bytes"
"fmt"
"github.com/hashicorp/go-msgpack/codec"
)
var h codec.MsgpackHandle
View fix-auto-focus.js
var UVCControl = require('uvc-control');
var camera = new UVCControl(0x046d, 0x082d);
camera.get('autoFocus', function (error, value) {
console.log('Before AutoFocus setting:', value);
});
camera.set('autoFocus', 0, function (error) {
if (error != undefined) {
View catalog_bench_test.go
package state
import (
"fmt"
"testing"
"github.com/hashicorp/go-memdb"
"github.com/hashicorp/consul/agent/structs"
"github.com/hashicorp/consul/api"
View sim.go
package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"log"
"math"
"math/rand"
View health-load.go
package main
import (
"context"
"flag"
"fmt"
"net"
"os"
"os/signal"
"time"
View watchpool.go
package watchpool
import (
"context"
"sync"
"time"
)
// WatchPool is a shared container for watch channels that are closed to notify
// multiple observers of a change. It allows sharing the monitor goroutine