Skip to content

Instantly share code, notes, and snippets.

View datenimperator's full-sized avatar

Christian Aust datenimperator

View GitHub Profile
@datenimperator
datenimperator / Gemfile
Created September 7, 2012 18:55
Sinatra, sprockets, compass, bootstrap-sass playing together
source :rubygems
gem 'shotgun', :group=>:development
gem 'rack-cache'
gem 'sinatra', :require => 'sinatra/base'
gem 'sinatra-support'
gem 'haml'
@datenimperator
datenimperator / sqlite.rb
Created November 22, 2013 16:19
Speed up your Rails sqlite database for large dataset. This should be a Rails initializer, goes into config/initializers.
if ::ActiveRecord::Base.connection_config[:adapter] == 'sqlite3'
if c = ::ActiveRecord::Base.connection
# see http://www.sqlite.org/pragma.html for details
# Page size of the database. The page size must be a power of two between 512 and 65536 inclusive
c.execute 'PRAGMA main.page_size=4096;'
# Suggested maximum number of database disk pages that SQLite will hold in memory at once per open database file
c.execute 'PRAGMA main.cache_size=10000;'

Keybase proof

I hereby claim:

  • I am datenimperator on github.
  • I am datenimperator (https://keybase.io/datenimperator) on keybase.
  • I have a public key ASDPliMCnFOzTNN1WeO8hME-LOOxQXu-fhKGGF2YJe1vcQo

To claim this, I am signing this object:

@datenimperator
datenimperator / mail_report.rb
Last active December 29, 2018 15:00
Ruby Postfix log file report
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'pp'
require 'time'
PROCESS = /^(?<process>[a-z]+)\/?(?<sub>[a-z]+)?\[?(?<pid>\d+)?\]?/
class Histo < Hash
def default(val)
@datenimperator
datenimperator / settings.json
Created January 21, 2018 11:55
Sublime 3 Settings
{
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/Agila Theme/Agila Monokai Extended.tmTheme",
"default_encoding": "UTF-8",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".git"
],
"font_face": "Office Code Pro",
@datenimperator
datenimperator / passenger
Created December 21, 2017 10:33
Passenger init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: passenger in standalone
# Required-Start: $network $syslog
# Should-Start: $mysql
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Start/stop rails web site
@datenimperator
datenimperator / cubesql.service
Created August 3, 2017 17:12
cubesql systemd service
[Unit]
Description=A fast and reliable SQL database engine based on sqlite.
After=network.target
[Service]
Type=simple
WorkingDirectory=/data/cubesql
ExecStart=/opt/cubesql/cubesql -x /data/cubesql -s /data/cubesql/cubesql.settings
Restart=on-failure
User=cubesql
@datenimperator
datenimperator / README.md
Last active September 7, 2016 09:47
Temporary fix for Gitlab sockets not working inside a LXC container on Proxmox 4.1

This is a temporary fix for a problem running Gitlab on Proxmox 4.1 inside a LXC container. Symptom: UNIX sockets created inside containers get wrong permissions. This seems to be related to AppArmor and the Debian kernel used by Proxmox. See this thread on the Proxmox forum for details.

Run apt-get install inotify-tools if you haven't installed inotifywait yet.

Place the first file in /usr/local/sbin/fix_gitlab.sh and make it executable: chmod 755 /usr/local/sbin/fix_gitlab.sh. Edit etc/rc.local to include it during boot.

@datenimperator
datenimperator / foundation_grids.html
Created January 12, 2014 10:36
Comparison of Foundation grid elements from version 2-5
<!-- Foundation 2.x, http://foundation.zurb.com/docs/v/2.2.1/grid.php -->
<div class="container">
<div class="row">
<div class="eight columns">
Eight columns
</div>
<div class="four columns">
Four columns
</div>
</div>
@datenimperator
datenimperator / isin.rb
Created December 3, 2013 11:57
An International Securities Identification Number (ISIN) uniquely identifies a security. Its structure is defined in ISO 6166. This Ruby code implements a validity check for a given ISIN string.
class Isin
COUNTRY_CODES = %w{AF AX AL DZ AS AD AO AI AQ AG AR AM AW AU AT AZ BS BH BD BB BY BE BZ BJ BM BT BO BQ BA BW BV BR IO BN BG BF BI KH CM CA CV KY CF TD CL CN CX CC CO KM CG CD CK CR CI HR CU CW CY CZ DK DJ DM DO EC EG SV GQ ER EE ET FK FO FJ FI FR GF PF TF GA GM GE DE GH GI GR GL GD GP GU GT GG GN GW GY HT HM VA HN HK HU IS IN ID IR IQ IE IM IL IT JM JP JE JO KZ KE KI KP KR KW KG LA LV LB LS LR LY LI LT LU MO MK MG MW MY MV ML MT MH MQ MR MU YT MX FM MD MC MN ME MS MA MZ MM NA NR NP NL NC NZ NI NE NG NU NF MP NO OM PK PW PS PA PG PY PE PH PN PL PT PR QA RE RO RU RW BL SH KN LC MF PM VC WS SM ST SA SN RS SC SL SG SX SK SI SB SO ZA GS SS ES LK SD SR SJ SZ SE CH SY TW TJ TZ TH TL TG TK TO TT TN TR TM TC TV UG UA AE GB US UM UY UZ VU VE VN VG VI WF EH YE ZM ZW}
def initialize(v)
@content = v.upcase
end
def to_s
@content
end