Skip to content

Instantly share code, notes, and snippets.

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

Ahmad ahmgeek

🛠️
Catching some ⛅️⛅️
View GitHub Profile
events
MaskDefined % thrown when "apply" button is hit, listen to this event
% to get the ROI information (obj.getROIData)
end
properties
image % image to work on, obj.image = theImageToWorkOn
roi % the generated ROI mask (logical)
labels % Connected component labens (multi ROI)
number % how many ROIs there are
@ahmgeek
ahmgeek / DNServer.rb
Created July 20, 2021 19:53
Dns To Dns Over TLS tcp proxy
require 'socket'
require "openssl"
require "logger"
HOST = "cloudflare-dns.com"
REMOTE_DNS = "1.1.1.1"
REMOTE_PORT = 853
LOCAL_PORT = 53
BLOCK_SIZE = 1024
LOGGER = Logger.new(STDOUT)
@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 / 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)
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem "http"
gem "pry"
gem 'json', require: false
end
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzkHxJ/ACWkddSbB3Luf8M9x+yLboTqGE/mrAOwxY5Cu4wuiR09KCVJ91STON2evgyJj77hzyBTowo+oeUzzlqFVLTvQu+mlgfuMK1GeIpJCf32uxJczp4GmSdm3nDKtK5GfKjuZ1fLEl6HzeodAhUf7WJSHYW5g/8uLOwTTATqgn91LiJUCMnaLYGmNMFFCCvFyZNkSNns6xxOspQgK2VEI4w0ef8xyv6f7SxY49Om+8g5ZlJnQ8pboldD5T0bO+pvBMGBApzU0saWWeVKQaNaJroQmC5wiDqo6IWPd0488Jg9QBCxYlEeUyN+V2NWHmfTTxzN6QcBGdVlStrEneO67LXr3iIuuTUun46aLG0/XlwOL+/qgqFloeYcucOyKfnbfO/bT6CX+z5t8m4cP1ABeXc6PFmn2QNpXqqmJmviiSBmkvsoVOmsNJ9lSa5W8KvSnpg/NQip9Rks8+QA5qsvhMvaeENAOJCDBLnaL3C6voPtchcTbGWLu504HboYqJbDeCyhZkZ9sCbDrq5df0yKY48HTxbzZGEJUGSTDkWF49mpHEulfN2KySEUmzsVkcHw8TmPTnz9Wa5N3vCPul2eEAVvatkRgLoN6EqP/OviW8R4F7HEkRrv12g+IC9gJTK57ieEvlLga3wVv/t/GswQEzjVdfQPceMHoUV1vUWJw== [email protected]
-- 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()
@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 / 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
@ahmgeek
ahmgeek / 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