Zaid Annas
Devsinc inc. 30/08/2018
git config --global alias.fixup "\!f(){ git reset --soft HEAD~${1} && git commit --amend -C HEAD; };f" | |
git fixup 1 # squashes last commit into it's parent |
$ benchmark-driver benchmark.yml --rbenv '2.0.0::2.0.0-p648 --disable-gems;2.5.3::2.5.3 --disable-gems;2.6.0-preview3::trunk --disable-gems;2.6.0-preview3+JIT::trunk --disable-gems --jit' -v --repeat-count 24 | |
2.0.0: ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux] | |
2.5.3: ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux] | |
2.6.0-preview3: ruby 2.6.0dev (2018-10-31 trunk 65474) [x86_64-linux] | |
2.6.0-preview3+JIT: ruby 2.6.0dev (2018-10-31 trunk 65474) +JIT [x86_64-linux] | |
Calculating ------------------------------------- | |
2.0.0 2.5.3 2.6.0-preview3 2.6.0-preview3+JIT | |
Optcarrot Lan_Master.nes 34.548 48.314 54.535 85.690 fps | |
Comparison: |
# 1) Create your private key (any password will do, we remove it below) | |
$ cd ~/.ssh | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
# Install | |
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome | |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' | |
sudo apt-get update | |
sudo apt-get install google-chrome-stable | |
# Update |
Prepare a server for a Rails app with MySQL (percona) + NGINX (passenger)
Deploy rails app in new server with Capistrano v3
require 'chunky_png' | |
class ChunkyPNG::Image | |
def at(x,y) | |
ChunkyPNG::Color.to_grayscale_bytes(self[x,y]).first | |
end | |
end | |
img = ChunkyPNG::Image.from_file('engine.png') |
"Russian-Doll Caching" is great. It embraces the Rails (and Ruby) goal to "make the developer happy". And it does. Not having to worry about cache expiration is superb.
It has its limits, though. If you're trying to avoid any database queries, russian-doll caching will not work for you. If you are trying to represent thousands, or even hundreds, of objects under a single cache fragment, russian-doll caching is not the best option.
We use it whenever it makes sense, but sometimes we just have to bite the bullet and expire a cache fragment manually. When you want to start manually expiring cache on a fairly busy website, you have to start considering race conditions. I recently ran into the following scenario:
class Post < ActiveRecord::Base
after_save :expire_cache
[user] | |
name = Raja J | |
email = raja_j@apple.com | |
[alias] | |
aa = add --all | |
br = branch | |
ca = commit --amend | |
cb = checkout -b | |
cm = commit -a --amend -C HEAD | |
ci = commit -a -v |
#!/bin/bash | |
apt-get update | |
apt-get install -y dialog | |
apt-get -y dist-upgrade | |
apt-get install -y bash-completion joe-jupp mosh byobu software-properties-common \ | |
php5-fpm php5-gd php5-ldap php5-mysql php5-mcrypt php5-json php5-sqlite \ | |
libapache2-mod-fastcgi \ | |
python-setuptools python-simplejson python-imaging python-mysqldb python-flup \ |