Skip to content

Instantly share code, notes, and snippets.

View ahyield's full-sized avatar
🛠️
Catching some ⛅️⛅️

Ahmed ahyield

🛠️
Catching some ⛅️⛅️
View GitHub Profile
@ahyield
ahyield / Movie_files.txt
Last active October 18, 2015 04:27
Enlightenment with أحماه.
Have you ever wondered, what is a movie file ?
Movie files have a few basic components.
First, the file itself is called a container, and the type of container determines where the information
in the file goes. Examples of containers are AVI and Quicktime. Next, you have a bunch of streams; for example,
you usually have an audio stream and a video stream.
(A "stream" is just a fancy word for "a succession of data elements made available over time".)
The data elements in a stream are called frames. Each stream is encoded by a different kind of codec.
The codec defines how the actual data is COded and DECoded - hence the name CODEC. Examples of codecs are DivX and MP3.
Packets are then read from the stream. Packets are pieces of data that can contain bits of data
@ahyield
ahyield / tweet-selenium.rb
Last active March 21, 2016 03:01 — forked from dannguyen/tweet-selenium.py
how to send a tweet through Firefox using Ruby + Selenium
#!/usr/bin/env ruby
require 'selenium-webdriver'
require 'rmagick'
include Magick
browser = Selenium::WebDriver.for :firefox
browser.get 'https://twitter.com'
element = browser.find_element(id: 'signin-email').send_keys('ahmgeek')
password = File.open('./pass.txt', 'r').read.strip
@ahyield
ahyield / crackle_pop.rb
Created June 3, 2016 23:27
Code CracklePop
module Divisable
def divided_by?(num, divisor)
num % divisor == 0
end
end
class CracklePop
include Divisable
def initialize
@ahyield
ahyield / crackle_pop.rb
Created June 3, 2016 23:29
Code CracklePop
module Divisable
def divided_by?(num, divisor)
num % divisor == 0
end
end
class CracklePop
include Divisable
def initialize
@ahyield
ahyield / README.md
Created March 6, 2017 01:26 — forked from sevko/README.md
Compile a full-featured Vim (w/ Python, Ruby, etc.).

compile full Vim

The default Vim installed on most Linux distros lacks a number of vital features, like xterm_clipboard (allows copy-and-pasting to the system clipboard) and python (on which certain plugins rely). The compile_full_vim.sh shell script removes the currently installed Vim and compiles a full-featured version; it's based entirely off Valloric's YouCompleteMe walkthrough, which it bundles into a simple script for convenience. Vim will be compiled with the following feature flags:

  • --with-features=huge
  • --enable-multibyte
-- Global counter through the request cycle.
counter = 0
-- App key, needed for Authentication
APP_KEY="_key_"
-- A warmup needed for lua's math engine, so random can work well.
-- this is suggested by the official docs.
math.randomseed(os.time())
math.random(); math.random(); math.random()
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzkHxJ/ACWkddSbB3Luf8M9x+yLboTqGE/mrAOwxY5Cu4wuiR09KCVJ91STON2evgyJj77hzyBTowo+oeUzzlqFVLTvQu+mlgfuMK1GeIpJCf32uxJczp4GmSdm3nDKtK5GfKjuZ1fLEl6HzeodAhUf7WJSHYW5g/8uLOwTTATqgn91LiJUCMnaLYGmNMFFCCvFyZNkSNns6xxOspQgK2VEI4w0ef8xyv6f7SxY49Om+8g5ZlJnQ8pboldD5T0bO+pvBMGBApzU0saWWeVKQaNaJroQmC5wiDqo6IWPd0488Jg9QBCxYlEeUyN+V2NWHmfTTxzN6QcBGdVlStrEneO67LXr3iIuuTUun46aLG0/XlwOL+/qgqFloeYcucOyKfnbfO/bT6CX+z5t8m4cP1ABeXc6PFmn2QNpXqqmJmviiSBmkvsoVOmsNJ9lSa5W8KvSnpg/NQip9Rks8+QA5qsvhMvaeENAOJCDBLnaL3C6voPtchcTbGWLu504HboYqJbDeCyhZkZ9sCbDrq5df0yKY48HTxbzZGEJUGSTDkWF49mpHEulfN2KySEUmzsVkcHw8TmPTnz9Wa5N3vCPul2eEAVvatkRgLoN6EqP/OviW8R4F7HEkRrv12g+IC9gJTK57ieEvlLga3wVv/t/GswQEzjVdfQPceMHoUV1vUWJw== [email protected]
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem "http"
gem "pry"
gem 'json', require: false
end
@ahyield
ahyield / prom_handler.rb
Last active March 13, 2019 16:53
Prometheus reloader.
#!/opt/chef/embedded/bin/ruby
require 'rack'
require 'logger'
require 'json'
Log = Logger.new(STDOUT)
# Server port
# Defaults to: 3009
PORT = ENV.fetch('PORT_NUMBER', 3009)
@ahyield
ahyield / search_insert.go
Created February 24, 2020 20:00 — forked from mustafa-zidan/search_insert.go
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
func searchInsert(nums []int, target int) int {
start, end := 0, len(nums)
if len(nums) == 0 || target < nums[start] {
return 0
} else if target > nums[end-1] {
return len(nums)
}
return getIndex(start, end, target, nums)
}