Skip to content

Instantly share code, notes, and snippets.

View erhangundogan's full-sized avatar
👋

Erhan Gundogan erhangundogan

👋
View GitHub Profile
@erhangundogan
erhangundogan / create-k3s-cluster-with-multipass.sh
Created August 1, 2024 11:48
Create K3S Cluster with multipass
#!/bin/bash
multipass launch -c 1 -m 1G -d 4G -n k3s-master 24.04
multipass info k3s-master
for f in 1 2; do
multipass launch -c 1 -m 1G -d 4G -n k3s-worker-$f 18.04
done
multipass list
multipass exec k3s-master -- bash -c "curl -sfL https://get.k3s.io | sh -"
TOKEN=$(multipass exec k3s-master sudo cat /var/lib/rancher/k3s/server/node-token)
@erhangundogan
erhangundogan / application-ld+json.html
Last active July 23, 2024 08:58
application/ld+json
<!-- first -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"dateModified": "2024-07-22",
"headline": "Erhan&amp;#39;s journey to the web"
}
</script>
const colorSpace = window.matchMedia('(color-gamut: p3)').matches ? 'display-p3' : 'srgb';
canvas.getContext('2d', { colorSpace });
@erhangundogan
erhangundogan / p3.css
Last active July 22, 2024 19:22
sRGB display-p3
/* https://webkit.org/blog/10042/wide-gamut-color-in-css-with-display-p3/ */
/* sRGB color */
:root {
--deepest-pink: deeppink;
}
/* Display-P3 color, when supported */
@supports (color: color(display-p3 1 1 1)) {
:root {
--deepest-pink: color(display-p3 1 0 0.5);
@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) => {