Skip to content

Instantly share code, notes, and snippets.

View kdwinter's full-sized avatar

Kenneth De Winter kdwinter

  • Belgium
  • 05:33 (UTC +02:00)
View GitHub Profile
@aaronlauterer
aaronlauterer / Arch-ZFSRoot-on-dm-crypt-UEFI
Last active November 5, 2017 11:18
ZFSRoot installation over a dm-crypt volume for Arch Linux (UEFI)
# arch uefi dm-crypt zfsroot install (archiso)
# modified to work with current repos as of 2016-06-16 and with hints from
# comments by larskotthoff
# uses only one boot partition for EFI and initramfs
# partition disk
# start at 1MB (sector 2048)
512Mib EFI
@shiroyasha
shiroyasha / dog.rb
Created February 16, 2016 22:20
Method tracer for Ruby classes
class Dog
attr_writer :name
def initialize(name)
@name = name
end
def bark
puts "patrick"
end
@fntlnz
fntlnz / i3wm-fedora.md
Last active July 8, 2021 01:31
i3wm fedora lightdm

Install i3

dnf install i3

Add exec i3 to xinitrc

echo "exec i3" > ~/.xinitrc
anonymous
anonymous / arch install
Created June 20, 2015 06:36
#!/bin/bash
#This script is best used if modified for each person
#The install can quickly completed if there is a local mirror.
#on an existing arch install, run: darkhttpd /var/cache/pacman/pkg/
#then set LOCALMIRROR to point to that machine
#It's okay if errors come up, pacman will resolve them.
export LOCALMIRROR="Server = http://192.168.1.1:8080"
export MIRRORLIST="/etc/pacman.d/mirrorlist"
@otobrglez
otobrglez / jaccard_recommendation.rb
Last active April 2, 2024 17:51
Simple recommendation system written in Ruby based on Jaccard index.
# Simple Recommendation Engine in Ruby
# Visit: http://otobrglez.opalab.com
# Author: Oto Brglez <otobrglez@gmail.com>
class Book < Struct.new(:title)
def words
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort
end
@rpheath
rpheath / authlogic-to-devise.md
Last active December 30, 2020 14:35
Steps and troubleshooting tips when moving Authlogic to Devise.

How To: Authlogic to Devise

Step 1: Migration

  1. bin/rails g migration AuthlogicToDevise
  2. (see the file below for the actual migration, authlogic_to_devise.rb)
  3. bin/rake db:migrate

Step 2: Update Gemfile

  1. gem "devise", "~> 2.2.0"
  2. bundle install
anonymous
anonymous / arch_install
Created November 22, 2012 19:33
arch install
passwd
systemctl enable sshd.service
systemctl start sshd.service
parted -s /dev/sda mklabel gpt
parted -s /dev/sda mkpart "primary" "fat16" "50MB" "60MB"
parted -s /dev/sda mkpart "primary" "ext4" "1%" "99%"
parted -s /dev/sda set 1 bios_grub on
mkfs.ext4 /dev/sda2
@Zoxc
Zoxc / ggpk_defragment.rb
Last active January 4, 2024 02:50
GGPK Defragmenter
require 'bindata'
require 'benchmark'
require 'win32/registry'
require 'io/console'
class GGPK
class UTF16String < BinData::String
def snapshot
super.force_encoding('UTF-16LE')
end
@josevalim
josevalim / rbx_partial_application.diff
Created September 17, 2011 20:59
Partial application on rubinius. Apply the diff to rubinius project and run `rake build`. Idea by @josevalim, code by @wycats.
diff --git a/lib/compiler/ast/transforms.rb b/lib/compiler/ast/transforms.rb
index 19e1cfb..4e52ec2 100644
--- a/lib/compiler/ast/transforms.rb
+++ b/lib/compiler/ast/transforms.rb
@@ -59,6 +59,71 @@ module Rubinius
end
end
+ # Provide an underscore node that allows partial application in Ruby.
+ # Instead of doing a method call, we are going to generate a lambda
# gem install sunspot_rails
class Foo
include MongoMapper::Document
include Sunspot::Rails::Searchable
key :title, String
searchable do
text :title
end