Skip to content

Instantly share code, notes, and snippets.

View erhangundogan's full-sized avatar
👋

Erhan Gundogan erhangundogan

👋
View GitHub Profile
@erhangundogan
erhangundogan / getAllCustomElements.js
Last active May 31, 2024 12:53
Find all custom elements on the page
const allCustomElements = [];
function isCustomElement(el) {
const isAttr = el.getAttribute('is');
// Check for <super-button> and <button is="super-button">.
return el.localName.includes('-') || isAttr && isAttr.includes('-');
}
function findAllCustomElements(nodes) {
for (let i = 0, el; el = nodes[i]; ++i) {
@erhangundogan
erhangundogan / trips.md
Last active April 27, 2024 14:49
My trips

North America

  • East coast (NY, Washington),
  • Midwest (Chicago, Mount Rushmore)
  • West coast (Los Angeles, San Francisco)
  • Nevada (Las Vegas, Grand Canyon)
  • Floria (Miami)

Middle America

  • Cuba
  • Mexico

Aphorisms from Shaonian Ge Xing

  • Observe the galaxy above your head and the soil beneath your feet. Thus found the law of nature. - "I Ching, Xi Ci, Part 1"

  • Similar voices make an echo, similar souls make a strong bond. - "I Ching, Qian, Wenyan"

  • A noble one suppresses evil and promotes good, in harmony with the will of Heaven. - "Book of Changes, Great Possession"

  • Understanding the discussion of life and death. - "I Ching, Xi Ci, Part 1"

#!/bin/bash
# https://www.haproxy.com/blog/how-to-run-haproxy-with-docker/
docker pull haproxy
docker pull jmalloc/echo-server
docker network create --driver=bridge mynetwork
docker run -d --name web1 --net mynetwork jmalloc/echo-server:latest
docker run -d --name web2 --net mynetwork jmalloc/echo-server:latest
docker run -d --name web3 --net mynetwork jmalloc/echo-server:latest
@erhangundogan
erhangundogan / guessing-game.rs
Last active February 11, 2023 15:25
Rust learning very first example
use std::io;
use rand::Rng;
fn guess_number() -> i32 {
let mut guess = String::new();
println!("What is your guess?");
io::stdin().read_line(&mut guess).expect("Could not read line");
return match guess.trim().parse() {
Ok(n) => n,
Err(_e) => {
@erhangundogan
erhangundogan / StorageClass.yml
Last active May 20, 2023 08:23
kubernetes bare metal setup for Debian 10 (buster)
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: openebs-lvmpv
allowVolumeExpansion: true
parameters:
storage: "lvm"
volgroup: "vg0"
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer

Graph Algorithms

  • Breadth First Search (BFS)
  • Depth First Search (DFS)
  • Shortest Path from source to all vertices Dijkstra
  • Shortest Path from every vertex to every other vertex Floyd Warshall
  • Minimum Spanning tree Prim
  • Minimum Spanning tree Kruskal
  • Topological Sort
(* http://alaska-kamtchatka.blogspot.com/2012/07/theorems-for-free-monad-edition.html *)
module type FUNCTOR = sig
type 'a t
val fmap : ('a -> 'b) -> ('a t -> 'b t)
end
module type APPLICATIVE = sig
type 'a t
val pure : 'a -> 'a t
@erhangundogan
erhangundogan / dune
Last active October 10, 2021 18:36
Reads current directory and sub directories based on the depth (default 0. 1..nth)
(executable
(name main)
(preprocess (pps ppx_deriving.show)))