Skip to content

Instantly share code, notes, and snippets.

View wader's full-sized avatar
🦫

Mattias Wadman wader

🦫
View GitHub Profile
@wader
wader / gist:09953b1fdd7b1984016e
Created September 1, 2014 13:41
run a dbus-daemon that allows everything
TEMP=`mktemp /tmp/dbusconf.XXXXXX`
# generate dbus config that allows everything
echo '<busconfig><type>system</type><listen>d</listen><auth>ANONYMOUS</auth><allow_anonymous/><policy context="default"><allow send_destination="*" eavesdrop="true"/><allow eavesdrop="true"/><allow own="*"/></policy></busconfig>' > $TEMP
dbus-daemon --nofork --config-file $TEMP --address tcp:bind=0.0.0.0,port=1234
rm $TEMP
@wader
wader / gist:46f380b86b4bb0112e73
Last active August 29, 2015 14:22
nginx webdav and tranmission
server {
listen 80;
server_name bla;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name bla;
mattias@cocospro:ansible (master *)$ pwd
/Users/mattias/src/youtube-audio-dl/ansible
mattias@cocospro:ansible (master *)$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'precise64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'precise64' (v0) for provider: virtualbox
default: Downloading: http://files.vagrantup.com/precise64.box
==> default: Successfully added box 'precise64' (v0) for 'virtualbox'!
@wader
wader / disable_sendfile_linux.go
Last active September 13, 2018 04:47
go http VirtualBox vboxfs sendfile bug workaround
// VirtualBox vboxsf sendfile bug workaround
// use seccomp to make sendfile return ENOTSUP which makes go http fallback to io.Copy
//
// if running in docker make sure to give SYS_ADMIN capabilities to container:
// docker create --cap-add=SYS_ADMIN
// docker-compose:
// cap_add:
// - SYS_ADMIN
//
// Licensed as public domain
@wader
wader / gist:ad7ec6f59657e071cb3d
Created September 30, 2015 22:29
kodi ios 9 airplay workaround hack (only audio works, no metadata)
package lates shairplay to /Users/Shared/xbmc-depends/tarballs/shairplay-$COMMIT.tar.bz2
tools/depends/target/libshairplay/Makefile:
change VERSION=$COMMIT
xbmc/network/NetworkServices.cpp:
comment out "_airplay._tcp" annonucment around line ~590
do normal build
@wader
wader / goeval.go
Created October 1, 2015 15:03
Run go one liners for testing stuff
#!/bin/bash
# depends:
# go get golang.org/x/tools/cmd/goimports
# usage:
# $ goeval 'strings.SplitN("a,b,c", ",", 2)'
# []string{"a", "b,c"}
F="$(mktemp -t goplayXXXX).go"
cat << EOF > "$F"
package main
@wader
wader / gist:adcfdbc50da012258903
Last active September 13, 2022 13:04
Hacky curl websocket client, pipe to jq only works if frame data does not include literal new lines
curl -v -s -N \
-H "Connection: Upgrade" \
-H "Upgrade: websocket" \
-H "Sec-WebSocket-Version: 13" \
-H "Sec-WebSocket-Key: dummy" \
http://host |
while read -r l; do echo "${l:4}" ; done | jq .
@wader
wader / gist:80c2ee7ce157b074d2df
Created December 25, 2015 17:58
Easy format convert with ffmpeg docker image
docker pull jrottenberg/ffmpeg
for f in *.mp4 ; do docker run --rm -v $PWD:/files jrottenberg/ffmpeg -i /files/$f /files/${f/\.mp4/\.mp3} ; done
@wader
wader / Vagrantfile
Last active November 20, 2016 11:29
Vagrant ubuntu development machine
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "wily"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/wily/current/wily-server-cloudimg-amd64-vagrant-disk1.box"
config.ssh.forward_agent = true
config.vm.provider :virtualbox do |vb, override|
vb.customize ["modifyvm", :id, "--cpus", 8]
vb.customize ["modifyvm", :id, "--memory", 1024]
vb.customize ["modifyvm", :id, "--ioapic", "on"]
@wader
wader / gist:56649546c49578f9c5b9
Created January 9, 2016 17:45
clang-format clang-tidy config
#!/bin/sh
# brew install llvm --with-clang-extra-tools --with-clang
/usr/local/Cellar/llvm/3.6.2/bin/clang-tidy -fix \
-fix-errors \
-header-filter=.* \
--checks=readability-braces-around-statements,misc-macro-parentheses \
*.c *.h \
-- -I. -I/usr/include