Skip to content

Instantly share code, notes, and snippets.

Eric Drechsel edrex

Block or report user

Report or block edrex

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@edrex
edrex / README.md
Last active Aug 17, 2019
Streaming screen capture under Wayland
View README.md

Recipes

kmsgrab capture with ffmpeg

sudo LIBVA_DRIVER_NAME=iHD ffmpeg -crtc_id 69  -framerate 60 -f kmsgrab -i - -vaapi_device /dev/dri/renderD128 -filter:v hwmap,scale_vaapi=w=1920:h=1200:format=nv12 -c:v h264_vaapi -profile:v constrained_baseline -level:v 3.1 -b:v 20000k test.mp4

LIBVA_DRIVER_NAME=iHD ffmpeg -device /dev/dri/card0 -f kmsgrab -i - -vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' -c:v h264_vaapi -vstats output.mp4

View gist:b54023fc9dbe8d21c0c81f5cce523ede
eric@spacelab ~/Downloads $ sudo curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.7.0/docker-machine-driver-kvm -o /usr/local/bin/docker-machine-driver-kvm
eric@spacelab ~/Downloads $ sudo chmod a+x /usr/local/bin/docker-machine-driver-kvm
eric@spacelab ~/Downloads $ sudo curl -L https://github.com/kubernetes/minikube/releases/download/v0.17.1/minikube-linux-amd64 -o /usr/local/bin/minikube
eric@spacelab ~/Downloads $ sudo chmod a+x /usr/local/bin/minikube
eric@spacelab ~/Downloads $ groups
eric adm cdrom sudo dip plugdev lpadmin sambashare docker libvirtd
eric@spacelab ~/Downloads $ curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.5.3/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
eric@spacelab ~/Downloads $ minikube start --vm-driver=kvm
Starting local Kubernetes cluster...
Starting VM...
View sha1.py
from hashlib import *
sha1("hithere").hexdigest()
# '8c2dfa8f32fb0ee305ae7c0ee34cee1f64808417'
View ring_buffer.go
// RingBuffer reads messages from in and writes them to out.
// Whenever out is full, it will remove the oldest message to make room.
// Adapted from https://blog.pivotal.io/labs/labs/a-concurrent-ring-buffer-for-go.
func RingBuffer(in <-chan Message, size int) <-chan Message {
out := make(chan Message, size)
go func() {
defer close(out)
for m := range in {
select {
case out <- m:
@edrex
edrex / docker-compose.yml
Last active Jan 5, 2017
Private godoc.org docker container
View docker-compose.yml
version: '2'
services:
godoc:
image: clever/godoc-docker:b5f1b24
ports:
- "8080:8080"
depends_on:
- redis_up
environment:
REDIS_URL: redis://redis:6379
View foo.elm
import Json.Decode as Json exposing (..)
j = "{\"value\":\"{\\\"foo\\\":\\\"bar\\\"}\"}"
decodeString (object1 (decodeString (at ["foo"] string)) (at ["value"] string)) j
-- Ok (Ok "bar") : Result.Result String (Result.Result String String)
View -
eric@ark ~/g/s/g/s/s/switch (master)> ./switch master -l 7468
{"context":"starting","function":"New","level":"info","msg":"starting","package":"master","time":"2016-08-16T09:47:20-07:00"}
SetUpListener: serverName (of self); localhost:7468
I'm a master switch called 'none' listening on 7468
2016/08/16 09:47:21 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp [::1]:7468: getsockopt: connection refused"; Reconnecting to {"localhost:7468" <nil>}
2016/08/16 09:47:21 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp [::1]:7468: getsockopt: connection refused"; Reconnecting to {"localhost:7468" <nil>}
2016/08/16 09:47:21 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp [::1]:7468: getsockopt: connection refused"; Reconnecting to {"localhost:7468" <nil>}
View -
bash-3.2$ echo  '{"value": "health"}' | http --pretty=all --verify=no POST https://localhost:7467/v1/health
HTTP/1.1 400 Bad Request
Content-Length: 74
Content-Type: application/json
Date: Thu, 11 Aug 2016 19:06:05 GMT
{
"Code": 3,
"Error": "invalid character 'Â' looking for beginning of value"
}
View -
Go Oracle
/Users/eric/go/src/github.com/sixgill/service/switch/cmd/device/service.go:380:25: cannot use float32(math.Mod(float64(gpsLocation.Heading) + (r.NormFloat64() * float64(stdDeltas.Heading)) + headingDelta, 360.)) (value of type float32) as float64 value in assignment
/Users/eric/go/src/github.com/sixgill/service/switch/cmd/device/service.go:382:4: invalid operation: mismatched types float64 and float32
/Users/eric/go/src/github.com/sixgill/service/switch/cmd/device/service.go:384:28: invalid operation: mismatched types float32 and float64
oracle: couldn't load packages due to errors: github.com/sixgill/service/switch/cmd/device
View -
# github.com/sixgill/service/switch/cmd/device
cmd/device/service.go:202: cannot use gwmux (type *"github.com/sixgill/service/vendor/github.com/gengo/grpc-gateway/runtime".ServeMux) as type *"github.com/sixgill/service/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime".ServeMux in argument to protobuf.RegisterHealthServiceHandlerFromEndpoint
cmd/device/service.go:210: cannot use gwmux (type *"github.com/sixgill/service/vendor/github.com/gengo/grpc-gateway/runtime".ServeMux) as type *"github.com/sixgill/service/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime".ServeMux in argument to protobuf.RegisterSGMSServiceHandlerFromEndpoint
cmd/device/service.go:218: cannot use gwmux (type *"github.com/sixgill/service/vendor/github.com/gengo/grpc-gateway/runtime".ServeMux) as type *"github.com/sixgill/service/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime".ServeMux in argument to protobuf.RegisterInitialContactServiceHandlerFromEndpoint
# github.com/sixgill/service/switch/cmd/master
cmd/master/service.go
You can’t perform that action at this time.