Skip to content

Instantly share code, notes, and snippets.

View hozgan's full-sized avatar

H. Ozgan hozgan

  • Thoughtworks
  • London
View GitHub Profile
@hozgan
hozgan / latency.txt
Created July 11, 2022 11:49 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@hozgan
hozgan / git-ssh-error-fix.sh
Created August 18, 2022 10:12 — forked from Tamal/git-ssh-error-fix.sh
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
@hozgan
hozgan / talisman.sh
Last active November 11, 2022 10:51
Talisman Script
#!/usr/bin/env bash
NAME=talisman.sh
VERSION=1.1.0
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
TALISMAN_REPORT_VERSION="${TALISMAN_REPORT_VERSION:-1.4}"
TALISMAN_INSTALL_SCRIPT="$HOME/install-talisman.sh"
TALISMAN_HTML_REPORT="$HOME/.talisman/talisman_html_report"
check_deps() {
if [ -f "$TALISMAN_INSTALL_SCRIPT" ]; then
@hozgan
hozgan / 0.12.tf
Created November 4, 2022 15:56 — forked from tuannvm/0.12.tf
#terraform #hashicorp #cheatsheet #0.12
#### first class expresssion
variable "ami" {}
resource "aws_instance" "example" {
ami = var.ami
}
#### list & map
resource "aws_instance" "example" {
vpc_security_group_ids = var.security_group_id != "" ? [var.security_group_id] : []
}
@hozgan
hozgan / unix_philospohy.md
Created November 17, 2022 17:35 — forked from twbell/unix_philospohy.md
Unix Philosophy
  1. Rule of Modularity: Write simple parts connected by clean interfaces.
  2. Rule of Clarity: Clarity is better than cleverness.
  3. Rule of Composition: Design programs to be connected to other programs.
  4. Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
  5. Rule of Simplicity: Design for simplicity; add complexity only where you must.
  6. Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
  7. Rule of Transparency: Design for visibility to make inspection and debugging easier.
  8. Rule of Robustness: Robustness is the child of transparency and simplicity.
  9. Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.
  10. Rule of Least Surprise: In interface design, always do the least surprising thing.
@hozgan
hozgan / gist:bc4b70e3b57578361a6c37233fdf855a
Created November 17, 2022 17:44
Rob Pike’s Rules of Programming

Rob Pike’s Rules of Programming

Rule 1. 

You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is.

Rule 2. 

Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest.

Rule 3. 

Fancy algorithms are slow when n is small, and n is usually small. Fancy algorithms have big constants. Until you know that n is frequently going to be big, don't get fancy. (Even if n does get big, use Rule 2 first.)

@hozgan
hozgan / multiple_ssh_setting.md
Created April 18, 2023 10:55 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@hozgan
hozgan / global-gitignore.md
Created August 17, 2023 07:23 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@hozgan
hozgan / container security talks.txt
Created January 8, 2024 16:46
container security talks
# syscalls
https://www.youtube.com/watch?v=8g-NUUmCeGI
# AppArmor, SELinux Introduction
https://www.youtube.com/watch?v=JFjXvIwAeVI
# Container Runtime Landscape
https://www.youtube.com/watch?v=RyXL1zOa8Bw
# Gvisor