Skip to content

Instantly share code, notes, and snippets.

View tessi's full-sized avatar

Philipp Tessenow tessi

View GitHub Profile
@tessi
tessi / byte_array.rb
Last active September 27, 2019 06:08
class ByteArray
include Enumerable
def initialize(n)
@size = n
@char_count = (n / 8.0).ceil
@store = String.new("\0" * @char_count, encoding: "ASCII-8BIT")
end
def [](n)

Keybase proof

I hereby claim:

  • I am tessi on github.
  • I am tessi (https://keybase.io/tessi) on keybase.
  • I have a public key ASCnhquaMtRQU8NfCVTGIGGkMe3JQBNsbSU26FjGtgJXlQo

To claim this, I am signing this object:

@tessi
tessi / my-way-to-postgresql-9-6-2-on-an-uberspace.md
Last active November 27, 2018 22:53
Upgrade Postgresql from 9.2 to 9.6 on an uberspace

Upgrade Postgresql from 9.2 to 9.6 on an uberspace

Uberspace (an awesome german web hoster) has superb postgresql support, except that it currently only offers postgresql versions 9.2.x and 9.3.x. I run postgresql 9.6.2 on my uberspace and documented steps for a migration to postgresql 9.6 here.

My goal was to be as close to the original uberspace-postgresql-setup as possible, but I had to copy and modify some uberspace scripts so they correctly use the new postgresql version.

Warning: Here be dragons. This is what I did -- that doesn't mean you should do the same or what I did was clever. Always backup your data and maybe test on a throw-away uberspace first. If you find things to improve, let me know and I'll try to keep this updated.

What I assume you have

@tessi
tessi / op_install.sh
Last active February 17, 2018 02:59
NOT MAINTAINED: OpenProject Install Script for a fresh uberspace
#!/bin/sh
set -e
echo "this script installs openproject"
echo "things might take a while, please be patient"
echo ""
echo "setup environment..."
echo "gem: --user-install --no-rdoc --no-ri" > ~/.gemrc
@tessi
tessi / installation.md
Last active July 30, 2020 11:52
Install OpenProject on uberspace.de

How to install OpenProject on uberspace.de

Follow those steps to install OpenProject on a fresh uberspace.

Step 1: Install dependencies

First we set-up all dependencies. We use ruby 2.1.2 and install gems in a user directory:

echo "gem: --user-install --no-rdoc --no-ri" > ~/.gemrc

cat <<'EOF' >> ~/.bash_profile

@tessi
tessi / keybase.md
Last active August 29, 2015 13:58
keybase.md

Keybase proof

I hereby claim:

  • I am tessi on github.
  • I am tessi (https://keybase.io/tessi) on keybase.
  • I have a public key whose fingerprint is A948 40E0 C745 A694 C9F2 C221 E01F 12D7 8B9B 048D

To claim this, I am signing this object:

Jumping, Finding, ...

Keybinding - Description
Ctrl-1 - Move to 1st tab (work every number)
Ctrl-p - Go to anything
Ctrl-g - Go to line
Ctrl-r - Go to symbol (e.g. section and labels)
Ctrl-m - Move to bracket
@tessi
tessi / hg aliases
Created January 21, 2014 08:28
hg aliases
[alias]
lg = log -G --pager always --color always --template '\033[0;31m{node|short} \033[0;34m({author|person}) - \033[0;33m{tags} {bookmarks} {branches} \033[0m{desc|firstline|strip} \033[0;32m({date|age})\033[0m\n'
show = log -pr
chp = graft
shortlog = !hg log --template "{author|person}\n" | sort | uniq -c | sort -nr
require 'benchmark'
iterations = 10_000
arr = Array.new(1000) { Array.new(2) << (rand()*100).to_s}
def use_map_join(arr)
arr.map {|a| a[2]}.join ', '
end
def use_inject(arr)
join_str = ', '
ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
ruby bench.rb
user system total real
babai1 1.700000 0.000000 1.700000 ( 1.707292)
babai2 29.630000 0.010000 29.640000 ( 29.769966)