Skip to content

Instantly share code, notes, and snippets.

View graudeejs's full-sized avatar

Aldis Berjoza graudeejs

View GitHub Profile
@graudeejs
graudeejs / gist:1257641
Created October 2, 2011 17:05
Create FreeBSD GPT ZFS bootable partition
gpart create -s GPT ad4
gpart add -b 34 -s 256 -t freebsd-boot ad4
gpart add -b 290 -s 5242880 -t freebsd-swap ad4
gpart add -b 5243170 -t freebsd-zfs ad4
gpart bootcode -b /dist/boot/pmbr -p /dist/boot/gptzfsboot -i 1 ad4
@graudeejs
graudeejs / gist:1257645
Created October 2, 2011 17:05
Create Swap on ZFS
zfs create -V 2G zroot/swap
zfs set org.freebsd:swap=on zroot/swap
zfs set checksum=off zroot/swap
@graudeejs
graudeejs / gist:1257650
Created October 2, 2011 17:11
Rebuild World
cd /usr/src
make buildworld buildkernel
make installkernel
mergemaster -p
make installworld
mergemaster -i -F -U
reboot
@graudeejs
graudeejs / gist:1257651
Created October 2, 2011 17:12
Firefox settings
browser.backspace_action = 0
browser.cache.disk.capacity = 0
browser.cache.disk.enable = 0
browser.cache.offline.capacity = 0
browser.download.manager.scanWhenDone = false
browser.formfill.enable = false
browser.fullscreen.animateUp = 0
browser.fullscreen.autohide = false
browser.link.open_newwindow = 3
browser.link.open_newwindow.restriction = 0
@graudeejs
graudeejs / gist:1260034
Created October 3, 2011 19:45
git patching
git format-patch master --stdout > fix_empty_poster.patch
git apply --stat fix_empty_poster.patch
git apply --check fix_empty_poster.patch
git am --signoff < fix_empty_poster.patch
@graudeejs
graudeejs / gist:2562683
Created April 30, 2012 21:04
create zpool cache from livecd
zpool import -o cachefile=/tmp/zpool.cache zroot
@graudeejs
graudeejs / xcfbd
Created June 5, 2012 12:46
xcfb daemon for jenkins on FreeBSD
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: xcfbd
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
@graudeejs
graudeejs / form_builder.rb
Created July 14, 2012 21:10
Rails: add asterix to required fields
class ActionView::Helpers::FormBuilder
alias :orig_label :label
# add a '*' after the field label if the field is required
def label(method, content_or_options = nil, options = nil, &block)
if content_or_options && content_or_options.class == Hash
options = content_or_options
else
content = content_or_options
end
@graudeejs
graudeejs / gist:3156501
Created July 21, 2012 17:30
field_error_proc
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
unless html_tag =~ /^<label/
unless html_tag =~ / type=(["'])(radio|chekbox)\1/
%{<div class="field_with_errors">#{html_tag}<div class="error">#{instance.error_message.first}</div></div>}.html_safe
end
else
html_tag
end
end
@graudeejs
graudeejs / passwords_controller.rb
Created November 20, 2012 09:22 — forked from kazpsp/passwords_controller.rb
StrongParameters with Devise
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end