I was trying to build https://github.com/systemfreund/go-libshout which wraps the C libshout library with Go. On Linux this worked fine, but on OpenBSD this was a bit more of a challenge as cgo could not find libshout. (install libshout with pkg_add first)
Although -lshout is specified as an LDFLAG in the go source code, I needed to to specify the include path for libshout and also link to libspeex (-lsppex)
CFLAGS and LDFLAGS can be passed to go build as environmental variables so I set:
export CGO_CFLAGS='-I/usr/local/include'
export CGO_LDFLAGS='-L/usr/local/lib -lshout -lspeex'
Then I is was able to do
go build -x github.com/systemfreund/go-libshout
(the -x is very useful for checking was gets passed to cgo)
Sunday, 12 July 2015
Monday, 1 June 2015
Ansible ad-hoc commands
Create an inventory file
host1.something
host2.something
[group1]
group1host.something
group2host.something
Run a command on all hosts
ansible -i inventory_file all -m command -a "uptime"
This specifies the inventory file (-i) run on all hosts (all) and run the command module (runs a remote command) with the module argument uptime (-a)
Run a command on all hosts simpler
ansible -i inventory_file all -a "uptime"
Same as above. Notice that the module name was not specified as the command module is used by default
Run a command on hosts in group1 with sudo
ansible -i inventory_file group1 -s -K -a "service rsyslog status"
-s Use sudo
-K ask for the sudo password (can be omitted if not required)
Copy a file to all hosts
ansible -i inventory_file all -m copy -a "src=~/.vimrc dest=~"
host1.something
host2.something
[group1]
group1host.something
group2host.something
Run a command on all hosts
ansible -i inventory_file all -m command -a "uptime"
This specifies the inventory file (-i) run on all hosts (all) and run the command module (runs a remote command) with the module argument uptime (-a)
Run a command on all hosts simpler
ansible -i inventory_file all -a "uptime"
Same as above. Notice that the module name was not specified as the command module is used by default
Run a command on hosts in group1 with sudo
ansible -i inventory_file group1 -s -K -a "service rsyslog status"
-s Use sudo
-K ask for the sudo password (can be omitted if not required)
Copy a file to all hosts
ansible -i inventory_file all -m copy -a "src=~/.vimrc dest=~"
Sunday, 8 March 2015
Real Time Scheduling for audio in openSUSE
I was getting the following message from jack / hydogen
Cannot use real-time scheduling
To solve this I added the following to /etc/security/limits.conf
@audio - rtprio 99
@audio - memlock 250000
@audio - nice -10
and also added myself to the audio group (sudo usermod -a -G audio jon)
Cannot use real-time scheduling
To solve this I added the following to /etc/security/limits.conf
@audio - rtprio 99
@audio - memlock 250000
@audio - nice -10
and also added myself to the audio group (sudo usermod -a -G audio jon)
Saturday, 8 November 2014
Bulk Filename Rewriting
In zsh you'll find zmv (autoload zmv) and in zmv it's easy to rewrite bulk files. For example, I had some downloaded files that were something.mp3?id=8795294528 etc and wanted to cut off the cruft at the end.
zmv '(*.mp3)*' '$1'
zmv '(*.mp3)*' '$1'
Saturday, 18 October 2014
Strip comments from an XML file
Ever had an xml file bloated with comments? Here's a great one-liner for striping them.
tidy -quiet -asxml -xml -indent -wrap 1024 --hide-comments 1 file.xml
Thanks to http://stackoverflow.com/questions/1464697/stripout-comments-from-xml
tidy -quiet -asxml -xml -indent -wrap 1024 --hide-comments 1 file.xml
Thanks to http://stackoverflow.com/questions/1464697/stripout-comments-from-xml
Thursday, 21 August 2014
Convert pem certificate to pkcs12 / p12
openssl pkcs12 -export -in widgets.crt -inkey widgets.key -out widgets.p12
Friday, 11 July 2014
Multiple desktops with xrandr on fluxbox
I use fluxbox. Sometimes I work with multiple screens, sometimes I don't, sometimes those screen are various resolutions.
To see what screens I have available I run
xrandr -q
from there I can see what screens and what resolutions I have availble. Then I can configure my setup with appropriately
e.g
xrandr --output VGA1 --mode 1680x1050 --left-of LVDS1
Thanks to http://awesome.naquadah.org/wiki/Using_Multiple_Screens for this one.
To see what screens I have available I run
xrandr -q
from there I can see what screens and what resolutions I have availble. Then I can configure my setup with appropriately
e.g
xrandr --output VGA1 --mode 1680x1050 --left-of LVDS1
Thanks to http://awesome.naquadah.org/wiki/Using_Multiple_Screens for this one.
Subscribe to:
Posts (Atom)