Skip to content

Instantly share code, notes, and snippets.

View fatehMohamed14's full-sized avatar
🏠
Working from home

fateh mohamed fatehMohamed14

🏠
Working from home
View GitHub Profile
@fatehMohamed14
fatehMohamed14 / Elastic Security Alert Typescript Interfaces
Created May 28, 2023 08:43
ES Alert Typescript types and interfaces that you may need when integrating alerts in your Typescript based web applications
export interface Alert {
id?: string
agent?: AlertAgent
process?: Process
rule?: Rule
message?: string
'@timestamp'?: string
file?: File
Endpoint?: Endpoint
ecs?: Ecs
@fatehMohamed14
fatehMohamed14 / BinaryGap solution
Last active January 18, 2024 14:22
BinaryGap Codility solution, A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N
function solution(N) {
const binary = N.toString(2);
let gaps = [];
let count = 0;
for(let b of binary) {
if(b === "0") {
count++
} else {
gaps.push(count);
count = 0