Skip to content

Instantly share code, notes, and snippets.

View vajapravin's full-sized avatar
😀
Available

vajapravin vajapravin

😀
Available
View GitHub Profile
What's new in Ruby on Rails 4
A RoR 4 press review
Silvio Relli @ Florence On Ruby
Bibliography and related resources
1) Rails queue
http://reefpoints.dockyard.com/ruby/2012/06/25/rails-4-sneak-peek-queueing.html
http://blog.remarkablelabs.com/2012/12/rails-queue-rails-4-countdown-to-2013
https://github.com/rails/rails/commit/adff4a706a5d7ad18ef05303461e1a0d848bd662

Setup PHP

apt-get install mysql-server php5-cgi php5-mysql php5-curl php5-cli

cp default-php-fastcgi /etc/default/php-fastcgi cp php-fastcgi /etc/init.d/

update-rc.d php-fastcgi defaults

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@vajapravin
vajapravin / tmux.conf
Last active August 29, 2015 14:11 — forked from spicycode/tmux.conf
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@vajapravin
vajapravin / application_helper.rb
Last active April 12, 2016 12:48
How to upload image in AngularJS with Rails backend.
# Sorry for not explaining basic stuff
module ApplicationHelper
def decode_base64_image document
if document[:base64] && document[:filetype] && document[:filename]
decoded_data = Base64.decode64(document[:base64])
data = StringIO.new(decoded_data)
data.class_eval do
attr_accessor :content_type, :original_filename
#!/bin/sh
cd ~/rails_workspace/MyAwsmProject;
git filter-branch --env-filter '
OLD_EMAIL="john.wills@gmail.com"
CORRECT_NAME="foobar"
CORRECT_EMAIL="foo.bar@gmail.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then

Figure out a good standard for how to use the HTTP response codes in a 'truly RESTful' (Now called 'Hypermedia API' apparently) way.

Summary

tail -fn0 /var/log/auth.log | \
while read line ; do
echo "$line" | grep "password check failed for user"
if [ $? = 0 ]
then
echo "Wrong Login Attempt" | mail -s "Login Password Wrong - GigoLinux" vajapravin23@gmail.com
fi
done
git clone https://github.com/nicehash/nheqminer.git
cd nheqminer/cpu_xenoncat/asm_linux/
chmod +x fasm
sh assemble.sh
cd ../../../
mkdir build && cd build
curl -sSL https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | tar -xzC ./
cmake-3.5.2-Linux-x86_64/bin/cmake ../nheqminer/
@vajapravin
vajapravin / 1_user.rb
Last active January 5, 2018 04:43 — forked from i-arindam/1_user.rb
class User < ApplicationRecord
has_many :posts
has_many :comments
# id :integer not null, primary key
# name :string(50) default("")
end