Skip to content

Instantly share code, notes, and snippets.

View aghyad's full-sized avatar
🤖
Never give up

Aghyad Saleh aghyad

🤖
Never give up
View GitHub Profile
module BinaryTree
class Node
attr_reader :word, :count, :left, :right
include Enumerable
def initialize(word)
@word, @count = word, 1
end
@aghyad
aghyad / chef_solo_bootstrap_centos.sh
Last active January 3, 2016 07:09 — forked from ryanb/chef_solo_bootstrap.sh
chef_solo_bootstrap.sh for Centos 6.5 <forked from RyanB's Ubuntu>
#!/usr/bin/env bash
sudo yum -y update && sudo yum -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev libyaml wget rubygems
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
sudo make
sudo make install
gem install chef ruby-shadow --no-ri --no-rdoc
@aghyad
aghyad / chef_solo_bootstrap_ubuntu.sh
Last active January 3, 2016 07:09 — forked from ryanb/chef_solo_bootstrap.sh
chef_solo_bootstrap.sh for Ubuntu <forked from RyanB's Ubuntu>
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@aghyad
aghyad / .tmux.conf
Last active August 29, 2015 13:58 — forked from emachnic/.tmux.conf
.tmux.conf from emachnic
set -g prefix C-a # Make C-a the prefix instead of default
bind C-a send-prefix # Send to application
unbind C-b # Unbind C-b
set -sg escape-time 1 # Remove delay for keystrokes
setw -g mode-keys vi # Use vi mode
### Mouse mode ###
setw -g mode-mouse on # Toggle mouse mode globally
set -g mouse-select-pane on # Select pane using mouse

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@aghyad
aghyad / core_exts.rb
Last active August 29, 2015 14:11 — forked from shell/core_exts.rb
## Like a Symbol#to_proc but for array
class Array
def to_proc
lambda {|object|
self.map{|symbol| object.send(symbol.to_sym)}
}
end
end
@aghyad
aghyad / genmac.rb
Last active August 29, 2015 14:22 — forked from cyberkov/genmac.rb
#!/usr/bin/env ruby
#require 'rubygems'
#require 'pry'
#require 'pp'
# This scripts returns a list of MAC addresses.
# Usage:
# ./$0 LIMIT START END
# ./genmac.rb 5 00:50:56:00:00:00 00:50:56:3F:FF:FF
#
@aghyad
aghyad / gdb_ruby_backtrace.py
Created June 20, 2016 16:21 — forked from csfrancis/gdb_ruby_backtrace.py
Dump an MRI call stack from gdb
string_t = None
def get_rstring(addr):
s = addr.cast(string_t.pointer())
if s['basic']['flags'] & (1 << 13):
return s['as']['heap']['ptr'].string()
else:
return s['as']['ary'].string()
def get_lineno(iseq, pos):