Skip to content

Instantly share code, notes, and snippets.

@IslamAzab
IslamAzab / test_schema_update_table.md
Last active Jul 31, 2019
when updating BigQuery table, schema changes are always shown
View test_schema_update_table.md

1- Create a new google_bigquery_table

Terraform will perform the following actions:

  # google_bigquery_dataset.test_us_bigquery_dataset will be created
  + resource "google_bigquery_dataset" "test_us_bigquery_dataset" {
      + creation_time      = (known after apply)
      + dataset_id         = "test_schema_update_dataset"
      + etag               = (known after apply)
@IslamAzab
IslamAzab / imagemagick-install-steps.bash
Last active Dec 9, 2015 — forked from rodleviton/imagemagick-install-steps
Installing Image Magick on Ubuntu 14.04
View imagemagick-install-steps.bash
sudo -i
cd
apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y
sudo apt-get install libperl-dev gcc libjpeg-dev libbz2-dev libtiff4-dev libwmf-dev libz-dev libpng12-dev libx11-dev libxt-dev libxext-dev libxml2-dev libfreetype6-dev liblcms1-dev libexif-dev perl libjasper-dev libltdl3-dev graphviz pkg-config
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xf ImageMagick.tar.gz
cd ImageMagick-6.9.2-8/
./configure --prefix=/opt/imagemagick-6.9
make
make install
@IslamAzab
IslamAzab / net-http-debug.rb
Created Oct 20, 2015 — forked from ahoward/net-http-debug.rb
a simple way to debug tons of libs that use ruby's net/http
View net-http-debug.rb
BEGIN {
require 'net/http'
Net::HTTP.module_eval do
alias_method '__initialize__', 'initialize'
def initialize(*args,&block)
__initialize__(*args, &block)
@IslamAzab
IslamAzab / sublime-3-better_errors.md
Last active Sep 29, 2015 — forked from stevenpetryk/sb2-better_errors.md
Using Sublime Text 3 with better_errors on Ubuntu
View sublime-3-better_errors.md

Using better_errors on Ubuntu with SublimeText 3

After I installed the fantastic better_errors gem, I was disappointed to notice that linking to your text editor doesn't work correctly on Ubuntu (at least, it didn't for me). Here's how I fixed it.

First, create a new desktop entry:

# /usr/share/applications/subl-urlhandler.desktop
View git stuff
# remove all merged branches except "develop" branch
git branch -r --merged | grep -v master | grep -v '^ develop$' | sed 's/origin\///' | xargs -n 1 git push --delete origin
# to remove them
git branch -r --merged | grep -v master | grep -v '^ development$' | sed -e 's/origin\///' | xargs -n 1 git branch --delete
# track all remote branches locally
for remote in `git branch -r | grep -v /HEAD`; do git checkout --track $remote ; done
@IslamAzab
IslamAzab / benchmark.sh
Last active Sep 7, 2015 — forked from emersonmoretto/benchmark.sh
Apache bench + Gnuplot Script
View benchmark.sh
#!/bin/bash
echo -e "\nbenchmark.sh -n<number of requests> -c<number of concurrency> <URL1> <URL2> ..."
echo -e "\nEx: benchmark.sh -n100 -c10 http://www.google.com/ http://www.bing.com/ \n"
## Gnuplot settings
echo "set terminal jpeg
set output 'benchmark_${1}_${2}.jpeg'
set title 'Benchmark: ${1} ${2}'
View debug_utils.rb
class DebugUtils
def self.run_in_sql_transaction
ActiveRecord::Base.transaction do
yield
end
end
def self.time_some_code
time = Benchmark.realtime do
yield
View development gems.rb
group :development do
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'better_errors'
gem 'binding_of_caller'
gem 'pry-byebug'
gem 'rack-mini-profiler'
gem 'thin'
gem 'marginalia'
gem 'pry-rails'
View Installing pg_activity.bash
sudo -i
apt-get update
apt-get install -y python-pip python-dev build-essential
pip install psycopg2
pip install psutil
pip install setuptools
git clone https://github.com/julmon/pg_activity.git
cd pg_activity/
python setup.py install --with-man
@IslamAzab
IslamAzab / Error trace
Created Jun 9, 2015
Ruby Bug #11240 "[BUG] Segmentation fault"
View Error trace
[1] pry(#<#<Class:0x000000068defe0>>)> quit-program
/home/myuser/.rvm/gems/ruby-2.0.0-p451@mygemset/gems/activesupport-3.2.18/lib/active_support/notifications.rb:125: [BUG] Segmentation fault
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0062 p:0002 s:0343 e:000342 EVAL /home/myuser/.rvm/gems/ruby-2.0.0-p451@mygemset/gems/activesupport-3.2.18/lib/active_support/notifications.rb:125 [FINISH]
c:0061 p:---- s:0341 e:000340 CFUNC :eval
c:0060 p:0010 s:0337 E:002598 BLOCK /home/myuser/.rvm/gems/ruby-2.0.0-p451@mygemset/gems/better_errors-2.1.1/lib/better_errors/raised_exception.rb:37 [FINISH]
c:0059 p:---- s:0331 e:000330 CFUNC :map