Skip to content

Instantly share code, notes, and snippets.

View khelll's full-sized avatar

Khaled alHabache khelll

View GitHub Profile
@khelll
khelll / install-ffmpeg-amazon-linux.sh
Last active March 3, 2016 14:40 — forked from gboudreau/install-ffmpeg-amazon-linux.sh
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
# usage \curl -sSL https://gist.githubusercontent.com/khelll/6eee332fcbc8667b326c/raw/4efeb70acad6e41fea129c472d6bf7f2236fa37d/install-ffmpeg-amazon-linux.sh | bash
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
rm -rf ~/ffmpeg_build ~/bin/{ffmpeg,ffprobe,ffserver,lame,vsyasm,x264,x265,yasm,ytasm}
class Kops < Formula
desc "Production Grade K8s Installation, Upgrades, and Management"
homepage "https://github.com/kubernetes/kops"
url "https://github.com/kubernetes/kops/archive/1.8.0.tar.gz"
sha256 "16d75793d138204c56c43c28e356102a11901919ae9c7ce2eea16843f340abe6"
head "https://github.com/kubernetes/kops.git"
bottle do
cellar :any_skip_relocation
rebuild 1
@khelll
khelll / puma_notes.md
Last active June 19, 2018 17:30
Puma notes

Some notes about Puma that I collected while moving Shipit to work with Puma.

Shipit notes

  • Shipit is using a gem called pubsubstub to handle sockets. That gem will force the app server connection to be alive as long as the socket is open.
  • On the other side, Rails 5 introduced ActionCable that acts as a seperate process that uses EventMachine to handle sockets, thus after initiating the socket connection, the app server gets out of the picture. Unfortunatly, Shipit doesn't use ActionCable.

Puma notes

  • Has no worker request timeout. There is a setting called worker_timeout, but that's not for request timeout. Suggested workaround is to set Rack timeout, or have Nginx infront of it.
@khelll
khelll / flatten.rb
Last active September 10, 2019 13:25
Ruby Implementation for `Array#flatten`, that flattens a map.
# rspec flatten.rb
def flatten(array)
return array if array == []
head, *tail = array
current = head.class == Array ? flatten(head) : [head]
current + flatten(tail)
end
words = %w[الفاتحة البقرة آل\ عمران النساء المائدة الأنعام الأعراف الأنفال التوبة يونس هود يوسف الرعد إبراهيم الحجر النحل الإسراء الكهف مريم طه الأنبياء الحج المؤمنون النور الفرقان الشعراء النمل القصص العنكبوت الروم لقمان السجدة الأحزاب سبأ فاطر يس الصافات ص الزمر غافر فصلت الشورى الزخرف الدخان الجاثية الأحقاف محمد الفتح
الحجرات ق الذاريات الطور النجم القمر الرحمن الواقعة الحديد المجادلة الحشر الممتحنة الصف الجمعة المنافقون التغابن الطلاق التحريم الملك القلم الحاقة المعارج نوح الجن المزمل المدثر القيامة الإنسان المرسلات النبأ النازعات عبس التكوير الانفطار المطففين الانشقاق البروج الطارق الأعلى الغاشية الفجر البلد الشمس الليل الضحى الشرح التين العلق القدر
البينة الزلزلة العاديات القارعة التكاثر العصر الهمزة الفيل قريش الماعون الكوثر الكافرون النصر المسد الإخلاص الفلق الناس]
accepted_letters = %w[ن ل ج ش ر د م ح ع ق ا أ آ إ \ ]
words.select {|word| word.each_char.all? { |char| accepted_letters.include?(char) } }
# => ["آل عمران", "الأنعام", "الرعد", "الحجر", "النحل", "الحج", "النمل", "لقمان", "محمد", "ق", "