Skip to content

Instantly share code, notes, and snippets.

View krzysztofjablonski's full-sized avatar

Krzysztof Jablonski krzysztofjablonski

  • Siepomaga.pl
  • Poznań
View GitHub Profile
@krzysztofjablonski
krzysztofjablonski / github_gpg_key.md
Last active February 14, 2020 21:38 — forked from ankurk91/github_gpg_key.md
Github : Signing commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Install required tools
  • Latest Git Client
  • gpg tools
brew install gpg
  • Generate a new gpg key
@krzysztofjablonski
krzysztofjablonski / gist:5700562
Last active December 18, 2015 00:59 — forked from kurisuchan/gist:1262135
Ramdisk for mysql
# Tweaked from http://tomislavsantek.iz.hr/2011/03/moving-mysql-databases-to-ramdisk-in-ubuntu-linux
# Log in as root
# Mount ramdisk folder in RAM
mkdir /tmp/ramdisk
mount -t tmpfs -o size=128M tmpfs /tmp/ramdisk/
# Move MySQL data
mv /var/lib/mysql /tmp/ramdisk/mysql
ln -s /tmp/ramdisk/mysql/ /var/lib/mysql
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev git-core
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xvzf ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247/
./configure --prefix=/usr/local
make
make install
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@krzysztofjablonski
krzysztofjablonski / regex.irb
Created March 1, 2012 15:06 — forked from fguillen/regex.irb
Non Greedy Regex match
# By default ReGex will match the bigest occurrence:
ruby-1.9.2-p180 > "_one_ two _three_".scan(/_(.+)_/)
=> [["one_ two _three"]]
# But we can tell it to match all the smallest ones:
ruby-1.9.2-p180 > "_one_ two _three_".scan(/_(.+?)_/)
=> [["one"], ["three"]]
@krzysztofjablonski
krzysztofjablonski / config.ru
Created March 1, 2012 15:06
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
require "rails"
@krzysztofjablonski
krzysztofjablonski / cumulative_performance.patch
Created January 27, 2012 12:00 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p0 cumulative performance patch.
diff --git a/common.mk b/common.mk
index ea244cc..4f22609 100644
--- a/common.mk
+++ b/common.mk
@@ -629,7 +629,8 @@ file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
{$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
- {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h
+ {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h \
@krzysztofjablonski
krzysztofjablonski / commands
Created December 23, 2011 11:39 — forked from panchicore/commands
setup postgis on Snow Leopard 64-bits
#Download and install XCode
#Install homebrew (package manager) IF INSTALLED: just update it
ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"
#Install git
brew install git
#IF LION
sudo vi /etc/paths and move /usr/local/bin to the top, cuz LION comes with a specific osx restricted PG.