Skip to content

Instantly share code, notes, and snippets.

View philippbayer's full-sized avatar

Philipp Bayer philippbayer

View GitHub Profile
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
f, err := os.Open("./example")
@philippbayer
philippbayer / gist:5334931
Created April 8, 2013 07:36
Tiny comparison float() vs. +0.0
>>python -m timeit "100 + 0.0"
10000000 loops, best of 3: 0.0217 usec per loop
>>python -m timeit "float(100)"
10000000 loops, best of 3: 0.17 usec per loop
@philippbayer
philippbayer / gist:5559683
Created May 11, 2013 11:17
Brütal Legend with primusrun
PRIMUS_VERBOSE=2 primusrun ./Buddha.bin.x86
[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
[S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.dll.
primus: profiling: display: 45.6 fps, 24.3% wait, 20.0% upload, 55.7% draw+swap
primus: profiling: readback: 45.9 fps, 28.0% app, 18.6% map, 53.4% wait
primus: profiling: display: 59.9 fps, 0.7% wait, 27.1% upload, 72.2% draw+swap
primus: profiling: readback: 59.8 fps, 5.1% app, 20.8% map, 74.1% wait
primus: profiling: display: 51.3 fps, 15.4% wait, 23.5% upload, 61.1% draw+swap
primus: profiling: readback: 51.3 fps, 16.6% app, 19.2% map, 64.2% wait
primus: profiling: display: 59.9 fps, 0.7% wait, 26.8% upload, 72.5% draw+swap
[ 5527.775]
X.Org X Server 1.13.3
Release Date: 2013-03-07
[ 5527.775] X Protocol Version 11, Revision 0
[ 5527.775] Build Operating System: 2.6.32-358.2.1.el6.x86_64
[ 5527.775] Current Operating System: Linux localhost.localdomain 3.8.11-200.fc18.x86_64 #1 SMP Wed May 1 19:44:27 UTC 2013 x86_64
[ 5527.776] Kernel command line: BOOT_IMAGE=/vmlinuz-3.8.11-200.fc18.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/swap rd.md=0 rd.dm=0 rd.luks=0 rd.lvm.lv=fedora/root vconsole.keymap=de rhgb quiet LANG=en_US.UTF-8
[ 5527.776] Build Date: 17 April 2013 04:51:09AM
[ 5527.776] Build ID: xorg-x11-server 1.13.3-3.fc18
[ 5527.776] Current version of pixman: 0.28.0
@philippbayer
philippbayer / bla.py
Created May 24, 2013 07:01
How to slightly nudge the position of ylabels down
for tick in ax.get_xticklabels():
pos = tick.get_position()
tick.set_position((pos[0], pos[1]-1))
@philippbayer
philippbayer / gist:5881974
Created June 28, 2013 02:15
Running pg_stat_statements on openSNP
SELECT query, calls, total_time, rows, 100.0 * shared_blks_hit
nullif(shared_blks_hit + shared_blks_read, 0) AS hit_percent
FROM pg_stat_statements ORDER BY total_time DESC LIMIT 5;
--
query | calls | total_time | rows | hit_percent
-----------------------------------------------------------------------------------------------------------
@philippbayer
philippbayer / optima.sh
Last active January 25, 2016 09:16
optima
>cat /etc/*-release
Fedora release 23 (Twenty Three)
[more about Fedora I deleted]
>cat /proc/version
Linux version 4.3.3-301.fc23.x86_64 (mockbuild@bkernel02.phx2.fedoraproject.org) (gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC) ) #1 SMP Fri Jan 15 14:03:17 UTC 2016
>javac -version
javac 1.8.0_71
>java -version
openjdk version "1.8.0_71"
OpenJDK Runtime Environment (build 1.8.0_71-b15)
@philippbayer
philippbayer / problems.md
Last active February 11, 2016 04:31
Solution for weird Module::Build install bug under perl

Commands are:

cpan
install Module::Build

when makepl_arg etc. are set to a non-standard, local folder.

Error message is:

@philippbayer
philippbayer / gist:3c83b7131b3433e2c1e2
Created February 29, 2016 03:17
Masurca 01.install.sh
2016-02-29 13:13:28 +1000
./install.sh
++ pwd
+ ROOT=/tmp/masurca20160229-26095-1pbb98n/MaSuRCA-2.3.2b
+ '[' -z /gpfs1/homes/pbayer/.linuxbrew/Cellar/masurca/2.3.2b ']'
+ mkdir -p dist-bin
+ PATH=/home/pbayer/.rbenv/versions/2.3.0/bin:/gpfs1/homes/pbayer/.rbenv/libexec:/home/pbayer/.rbenv/plugins/ruby-build/bin:/gpfs1/homes/pbayer/.linuxbrew/bin:/gpfs1/homes/pbayer/.linuxbrew/sbin:/home/pbayer/.rbenv/shims:/90days/uqccha18/groupEnv/flashlite/scripts:/90days/uqccha18/groupEnv/flashlite/apps/bin:/90days/uqccha18/groupEnv/flashlite/bin:.:/home/pbayer/.linuxbrew/bin:/home/pbayer/.rbenv/bin:/home/pbayer/jre1.8.0_74/bin:/home/pbayer/localpython/bin:/home/pbayer/localperl/bin:/opt/openmpi/bin:/usr/lib64/qt-3.3/bin:/opt/torque-rcc/default/bin:/opt/torque-rcc/default/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/bio/ncbi/bin:/opt/bio/mpiblast/bin:/opt/bio/EMBOSS/bin:/opt/bio/clustalw/bin:/opt/bio/tcoffee/bin:/opt/bio/hmmer/bin:/opt/bio/phylip/exe:/opt/bio/mrbayes:/opt/bio/fasta:/opt/bio/glim
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Linuxbrew/linuxbrew.git
HEAD: 4a4df9a4a4708e9a0ff2794802f270f86775a091
Last commit: 25 hours ago
HOMEBREW_PREFIX: /gpfs1/homes/pbayer/.linuxbrew
HOMEBREW_REPOSITORY: /gpfs1/homes/pbayer/.linuxbrew
HOMEBREW_CELLAR: /gpfs1/homes/pbayer/.linuxbrew/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://linuxbrew.bintray.com
CPU: 24-core 64-bit haswell
Kernel: Linux 2.6.32-431.11.2.el6.x86_64 x86_64 GNU/Linux