Skip to content

Instantly share code, notes, and snippets.

View gudata's full-sized avatar
🏠
Working from home

Ivo Bardarov gudata

🏠
Working from home
View GitHub Profile
@gudata
gudata / chef-noatime-and-swap.rb
Created February 27, 2017 16:29 — forked from priestjim/chef-noatime-and-swap.rb
A quick (hacky) Chef recipe for adding noatime and a swap file in case a swap file does not exist
# Enable noatime on local ext3/4 & xfs filesystems
fstab = File.open('/etc/fstab',"r")
newlines = Array.new
needremount = Array.new
ihaveswap = false
fstab.each do |line|
# Tokenize each fstab line with a space separator
tokens = line.split
if tokens[2] == "swap"
@gudata
gudata / gource.sh
Created February 12, 2017 09:59 — forked from XueshiQiao/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install
@gudata
gudata / introrx.md
Created November 19, 2016 14:02 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@gudata
gudata / handlersjs.coffee
Created November 14, 2016 09:58
handlersjs with turbolinks5
class @Handlers
@handlers = {}
@register: (handler, registeredClass) ->
throw "No constructor on " + handler unless registeredClass.constructor
@handlers[handler] = registeredClass
@instantiate: (handlers, element) ->
handlers = handlers.replace(/\s/g, '').split(',')
element.handlers = []
@gudata
gudata / simple_form.rb
Created November 7, 2016 17:23
simple form initialization for http://materializecss.com/
# Use this setup block to configure all options available in SimpleForm.
# https://github.com/patricklindsay/simple_form-materialize/blob/master/lib/generators/simple_form/materialize/templates/config/initializers/simple_form_materialize.rb
# contribute here: https://github.com/mkhairi/materialize-sass/issues/16
SimpleForm.setup do |config|
config.wrappers :default, class: :input,
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
@gudata
gudata / no-graphic-boot
Created November 14, 2015 16:17 — forked from smoser/README.md
ubuntu-auto-install: install a ubuntu image with kvm
#!/bin/sh
set -e
echo blacklist vga16fb > /etc/modprobe.d/novga16fb.conf;
cat >> /etc/default/grub <<"EOF"
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_TERMINAL=console
EOF
update-initramfs -u
update-grub
@gudata
gudata / rur_intro.rb
Last active August 29, 2015 14:20 — forked from kanmeiban/rur_intro.rb
# RUR (Relationally Universal Ruby) is a Ruby relational algebra DSL
# that compiles to SQL, allowing you to write complex
# queries without leaving your favorite language. It is going to be a nice
# Ruby-like replacement of SQL in the same manner CoffeeScript is a
# Ruby-like replacement of JavaScript. It will use all the features
# found in a modern RDBMS (views, temp views, constraints, triggers, functions,
# etc) without being tightly coupled to one particular implementation.
#
# Unlike ActiveRecord, which maps tables to classes, RUR maps relations to
# objects.
o = -> { 'o' }
def activate! *args
print args.map(&:call)
end
activate! o,o
#nginx configuration
upstream simple_ci {
server unix:///tmp/simple_ci.0.sock;
}
server {
listen 80 default_server; # e.g., listen 192.168.1.1:80;
server_name ci.empowerunited.com; # e.g., server_name source.example.com;
root /home/ci_user/simple_ci/public;
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"