Skip to content

Instantly share code, notes, and snippets.

@jkraemer
jkraemer / hillshade-transparent-overlay.md
Created October 4, 2018 03:16 — forked from cquest/hillshade-transparent-overlay.md
transparent hillshade cooking guide using gdal

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 August 1, 2018 03:07
Rake task to create Trigram indizes for a Redmine database (PostgreSQL only)
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 September 14, 2020 12:39
Let's Encrypt certificate renewal with HAProxy
# Use a 4096 bit RSA key instead of 2048
rsa-key-size = 4096
# update to register with the specified e-mail address
email = [email protected]
# use a text interface instead of ncurses
text = True
non-interactive = True
agree-tos = True
@jkraemer
jkraemer / bm.rb
Last active July 5, 2016 11:26
logging and string interpolation
require 'benchmark'
require 'logger'
iterations = 1000000
logger = Logger.new(STDOUT)
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."

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 July 14, 2013 19:15
Linux on Lenovo X230 field notes
/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 July 13, 2013 10:33
Install Skype on 64bit Debian Wheezy / Crunchbang 11
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 April 19, 2013 08:11
Vagrant 1.2.1 / berkshelf-vagrant 1.1.3
site :opscode
cookbook 'apt'
@jkraemer
jkraemer / scheduler.rb
Created October 8, 2012 10:48
Rufus Scheduler initialization script
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}"