Skip to content

Instantly share code, notes, and snippets.

Kamil Kieliszczyk kiela

Block or report user

Report or block kiela

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am kiela on github.
  • I am kamilkieliszczyk (https://keybase.io/kamilkieliszczyk) on keybase.
  • I have a public key whose fingerprint is E0AB 45B1 CB04 F2D4 E98F 2F41 4194 4F7D 0010 B692

To claim this, I am signing this object:

@kiela
kiela / commit-msg
Last active Dec 31, 2015
Add branch name at the beginning of commit message if branch name starts with WEB or OP or SEC or FM
View commit-msg
#!/bin/sh
branch=$(git symbolic-ref HEAD | awk -F/ '{ if($3 ~ /^(WEB|OP|DEVOPS|SEC|FM|PS|DAT|AD)-[[:digit:]]/) print $3 }' | awk -F"_" '{ if($1) print $1 }')
if [ -n "$branch" ]; then
sed -i "1 s/^/$branch: /" $1
sed -i '/'$branch\:'/a \\nIssue: https://acorns.atlassian.net/browse/'$branch $1
fi
View unchangeable
# validator
class UnchangeableValidator < ActiveModel::EachValidator
def validate_each(object, attribute, value)
if !object.new_record? && value.present?
original = object.class.send(:where, "id = #{object.id}").select("id, #{attribute.to_s}").first
if original.send(attribute) != value
object.errors[attribute] << (options[:message] || "cannot be changed once assigned")
end
end
end
@kiela
kiela / zfs
Last active Jul 4, 2018
HOWTO: Hetzner + FreeBSD 10.3 + mirrored root ZFS mountpoint optimized for 4K drives
View zfs
[root@rescue ~]# kldload zfs
[root@rescue ~]# sysctl kern.geom.label.gptid.enable=0
kern.geom.label.gptid.enable: 1 -> 0
[root@rescue ~]# gpart destroy -F nvd0
nvd0 destroyed
[root@rescue ~]# gpart destroy -F nvd1
nvd1 destroyed
# Getting "gpart: arg0 'nvdN': Invalid argument" is alright as it means that there was no partition table on the disk anyway.
[root@rescue ~]# gpart create -s gpt nvd0
@kiela
kiela / active_record_extension.rb
Created Apr 8, 2013
Some ActiveRecord extensions which are helpful for me in a couple of projects
View active_record_extension.rb
module ActiveRecordExtension
extend ActiveSupport::Concern
module ClassMethods
def from_current(period, options = { column: 'created_at' })
raise "Invalid options in #{self.to_s}\##{__method__.to_s}" unless [:year, :quarter, :month, :week, :day].include? period
start_method = "beginning_of_#{period.to_s}"
end_method = "end_of_#{period.to_s}"
@kiela
kiela / ubuntu_12.04_notifyosdconfiguration
Last active Dec 15, 2015
HOWTO install notify osd configuration tool on Ubuntu 12.04 LTS
View ubuntu_12.04_notifyosdconfiguration
kiela@rico ~$ uname -a
Linux rico 3.2.0-39-generic #62-Ubuntu SMP Thu Feb 28 00:28:53 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
kiela@rico ~$ sudo add-apt-repository ppa:leolik/leolik
kiela@rico ~$ sudo apt-get update
kiela@rico ~$ sudo apt-get upgrade
kiela@rico ~$ sudo apt-get install libnotify-bin
kiela@rico ~$ pkill notify-osd
kiela@rico ~$ sudo add-apt-repository ppa:nilarimogard/webupd8
kiela@rico ~$ sudo apt-get update
kiela@rico ~$ sudo apt-get install notifyosdconfig
@kiela
kiela / ZFS_geli_freebsd
Last active Apr 2, 2018
Simple HOWTO of creation an encrypted ZFS pool under FreeBSD using geli + 256-bit AES-XTS encryption + a 4 kb random data partial key and a secondary passphrase (required to type on each boot).
View ZFS_geli_freebsd
root@rizzo ~$ uname -a
FreeBSD rizzo.heimdall.pl 9.1-RELEASE FreeBSD 9.1-RELEASE #0: Wed Mar 13 21:02:32 CET 2013 root@rizzo.heimdall.pl:/sys/amd64/compile/rizzo amd64
root@rizzo ~$ kldload opensolaris
root@rizzo ~$ kldload zfs
root@rizzo ~$ kldload geom_eli
root@rizzo ~$ gpart destroy -F da0
da0 destroyed
root@rizzo ~$ gpart create -s gpt da0
da0 created
root@rizzo ~$ gpart add -t freebsd-zfs -a 4096 da0
You can’t perform that action at this time.