Skip to content

Instantly share code, notes, and snippets.

🐧
🦀

Leandro Lisboa Penz lpenz

🐧
🦀
Block or report user

Report or block lpenz

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
@lpenz
lpenz / .travis.yml
Created Apr 23, 2015
.travis.yml: base for go with coveralls
View .travis.yml
language: go
go:
- tip
before_install:
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- go get github.com/bradfitz/goimports
- go get github.com/golang/lint/golint
- go get golang.org/x/tools/cmd/vet
- if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
@lpenz
lpenz / brewer.tex
Created Apr 25, 2015
colorbrewer colors for latex
View brewer.tex
% Colors from www.ColorBrewer.org by Cynthia A. Brewer, Geography, Pennsylvania State University.
% Apache-Style Software License for ColorBrewer software and ColorBrewer Color Schemes
%
% Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University.
%
% Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
@lpenz
lpenz / .travis.yml
Created Feb 21, 2016
Test .gitignore in travis
View .travis.yml
script:
- true TESTS RUN HERE
- true Test if we .gitignore test files
- TMP=$(tempfile)
- git ls-files . --exclude-standard --others | tee "$TMP"
- if test -s "$TMP"; then false; else true; fi
- true Test if we .gitignore any tracked files
- git ls-files -i --exclude-standard | tee "$TMP"
- if test -s "$TMP"; then false; else true; fi
@lpenz
lpenz / docker-gc
Last active Apr 18, 2016
Docker garbage collector
View docker-gc
#!/bin/bash
set -x -e
: gc conteiners
docker ps --filter 'status=exited' -q | xargs -r docker rm
docker ps --filter 'status=created' -q | xargs -r docker rm
: gc images
docker images --filter "dangling=true" -q | xargs -r docker rmi
@lpenz
lpenz / debootstrap-vagrant
Last active Oct 4, 2016
Use debootstrap to create a chroot that can be turned into a vagrant-compatible (virtualbox, wheezy 32) VM
View debootstrap-vagrant
#!/bin/bash
DIR=${1?usage: $0 <dir>}
NAME=${DIR##*/}
set -e -x
rm -rf "$DIR"
trap 'set +e; umount "$DIR/proc"; umount "$DIR/sys"; rm -rf "$DIR"' EXIT INT
@lpenz
lpenz / img2vagrant
Created Oct 5, 2016
Create a package.box for vagrant (virtualbox) from the specified raw img file
View img2vagrant
#!/bin/bash
IMG=${1?usage: $0 <img>}
NAME=wheezy32
set -e -x
rm -f "${IMG}.vmdk" package.box
VBoxManage convertfromraw "$IMG" "${IMG}.vmdk" --format vmdk
VBoxManage unregistervm "$NAME" --delete || :
@lpenz
lpenz / winclick
Created Nov 17, 2016
Click a window selected by name; uses xwininfo and xdotool
View winclick
#!/bin/bash
WINNAME="${1?usage: "$0" windowname}"
set -e
TMP=$(mktemp)
trap 'rm -f $TMP' EXIT
eval "$(xdotool getmouselocation --shell)"
@lpenz
lpenz / nix-enter
Last active Mar 26, 2017
Enter a shell with ~/nix privately mounted in /nix, using mount namespaces. sudo required
View nix-enter
#!/bin/bash
set -e -x
TMP=$(mktemp)
trap 'rm -f $TMP' EXIT
chmod u+x "$TMP"
cat > "$TMP" <<END
sudo mkdir /nix
@lpenz
lpenz / pa-monofy-stereo
Last active Mar 26, 2017
Join audio sink channels into a single mono channel, for stereo audio files with sound in only a channel
View pa-monofy-stereo
#!/bin/bash
set -e -x
pacmd load-module module-remap-sink sink_name=mono master=$(pacmd list-sinks | grep -m 1 -oP 'name:\s<\K.*(?=>)') channels=2 channel_map=mono,mono
@lpenz
lpenz / ansible-apt-repos
Last active Jun 23, 2017
Install apt repositories with ansible
View ansible-apt-repos
#!/bin/bash
set -x -e -o pipefail
: for deb-multimedia keyring, browse http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring
ansible -i localhost, -c local localhost -m apt_repository -a 'repo="deb http://www.deb-multimedia.org stable main non-free"'
ansible -i localhost, -c local localhost -m apt_repository -a 'repo="deb http://www.deb-multimedia.org testing main non-free"'
ansible -i localhost, -c local localhost -m apt_repository -a 'repo="deb http://www.deb-multimedia.org unstable main non-free"'
: for dropbox
You can’t perform that action at this time.