Skip to content

Instantly share code, notes, and snippets.

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

Ahmad ahmgeek

🛠️
Catching some ⛅️⛅️
View GitHub Profile
@ahmgeek
ahmgeek / 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)
}
@ahmgeek
ahmgeek / 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
@ahmgeek
ahmgeek / 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