Skip to content

Instantly share code, notes, and snippets.

@jkraemer
jkraemer / hillshade-transparent-overlay.md
Created Oct 4, 2018 — forked from cquest/hillshade-transparent-overlay.md
transparent hillshade cooking guide using gdal
View hillshade-transparent-overlay.md

Ingredients

  • a decent DEM
  • gdal
  • some computer

compute grayscale hillshade using gdaldem

gdaldem hillshade -compute_edges your_dem_file hillshade.tif

color-ramp to compute transparency (alpha channel)

In another bowl, prepare the following shade.ramp file:

@jkraemer
jkraemer / pg_trgm.rake
Created Aug 1, 2018
Rake task to create Trigram indizes for a Redmine database (PostgreSQL only)
View pg_trgm.rake
class CreatePostgresqlTrgmIndex
def self.call(model, column, concurrently: true)
table = model.table_name
column = column.sub(/.*\./, "")
puts sql = "CREATE INDEX #{"CONCURRENTLY" if concurrently} index_#{table}_on_#{column}_trgm ON #{table} USING gin (#{column} gin_trgm_ops)"
model.connection.execute sql
rescue ActiveRecord::StatementInvalid
raise $! unless $!.message =~ /PG::Duplicate/
end
end
@jkraemer
jkraemer / cli.ini
Last active Sep 14, 2020
Let's Encrypt certificate renewal with HAProxy
View cli.ini
# Use a 4096 bit RSA key instead of 2048
rsa-key-size = 4096
# update to register with the specified e-mail address
email = user@host.com
# use a text interface instead of ncurses
text = True
non-interactive = True
agree-tos = True
@jkraemer
jkraemer / bm.rb
Last active Jul 5, 2016
logging and string interpolation
View bm.rb
require 'benchmark'
require 'logger'
iterations = 1000000
logger = Logger.new(STDOUT)
View devise_invitable.de.yml
de:
devise:
failure:
invited: "Du hast bereits eine Einladung erhalten. Nimm die Einladung an um dein Nutzerkonto zu erstellen."
invitations:
send_instructions: "Eine Einladung wurde an %{email} verschickt."
View keybase.md

Keybase proof

I hereby claim:

  • I am jkraemer on github.
  • I am jkraemer (https://keybase.io/jkraemer) on keybase.
  • I have a public key whose fingerprint is C388 0ACE 6187 419B 177C 472E 0862 5A14 CE3C DDAA

To claim this, I am signing this object:

@jkraemer
jkraemer / gist:5995430
Created Jul 14, 2013
Linux on Lenovo X230 field notes
View gist:5995430
/etc/rc.local
# reduce swapping to a minimum
echo 0 > /proc/sys/vm/swappiness
/etc/fstab
use "noatime,nodiratime,discard" mount options for SSD
use tmpfs for tmp and friends:
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/spool tmpfs defaults,noatime,mode=1777 0 0
@jkraemer
jkraemer / gist:5990285
Created Jul 13, 2013
Install Skype on 64bit Debian Wheezy / Crunchbang 11
View gist:5990285
sudo dpkg --add-architecture i386
sudo aptitude install libxv1:i386 libxss1:i386 libasound2:i386 libqt4-dbus:i386 libqtwebkit4:i386 libasound2-plugins:i386 libssl1.0.0:i386
sudo dpkg -i skype-debian_4.2.0.11-1_i386.deb
@jkraemer
jkraemer / Berksfile
Created Apr 19, 2013
Vagrant 1.2.1 / berkshelf-vagrant 1.1.3
View Berksfile
site :opscode
cookbook 'apt'
@jkraemer
jkraemer / scheduler.rb
Created Oct 8, 2012
Rufus Scheduler initialization script
View scheduler.rb
require 'rufus/scheduler'
class Scheduler
# Starts the scheduler unless it is already running
def self.start_unless_running(pid_file)
with_lockfile(File.join(File.dirname(pid_file), 'scheduler.lock')) do
if File.exists?(pid_file)
pid = IO.read(pid_file).to_i
if pid > 0 && process_running?(pid)
puts "not starting scheduler because it already is running with pid #{pid}"