Skip to content

Instantly share code, notes, and snippets.

View erkanzileli's full-sized avatar
:shipit:
what if

Erkan Zileli erkanzileli

:shipit:
what if
View GitHub Profile
@developer-guy
developer-guy / main.go
Created February 28, 2022 10:36
A code sample for storing Kyverno policy on OCI registry
package main
import (
"errors"
"fmt"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/empty"
"github.com/google/go-containerregistry/pkg/v1/mutate"
"github.com/google/go-containerregistry/pkg/v1/remote"
@developer-guy
developer-guy / demo.md
Last active January 3, 2022 18:29
Experimental Keyless Cosign verify-blob command to verify signature that is exported by the skopeo tool to the directory

Experimental Keyless Cosign verify-blob command to verify the signature that is exported by the skopeo tool to the directory

Let's assume that we have an image called devopps/busybox:glibc, we gain this image by copying the real busybox:glibc image from DockerHub by issuing the following command:

$ crane copy busybox:glibc devopps/busybox:glibc

crane is a tool for interacting with remote images and registries. https://github.com/google/go-containerregistry/tree/main/cmd/crane

@smartameer
smartameer / prepare-commit-msg
Created July 6, 2021 19:35
Git coauthor hook for pre-commit message
#!/bin/bash
function prompt_for_multiselect {
# little helpers for terminal print control and key input
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
RESTORE='\033[0m'
ESC=$( printf "\033")
cursor_blink_on() { printf "$ESC[?25h"; }
@Dentrax
Dentrax / main.go
Last active August 14, 2022 20:41
demo: delve-entrypoint-mutating
package main
import (
"archive/tar"
"bytes"
"fmt"
"github.com/google/go-containerregistry/pkg/crane"
"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/mutate"
@ahmadawais
ahmadawais / VSCode_Node_Babel_Recipe.md
Last active November 1, 2022 11:31
VSCode Node + Babel Recipe | Solves: vscode debug unexpected token import

VSCode Node + Babel Recipe

Debug Modern JavaScript with VSCode. Part of VSCode Course.

1. init a module:

npm init -y
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active April 26, 2024 02:03
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@zcaceres
zcaceres / Include-in-Sequelize.md
Last active January 8, 2024 07:14
using Include in sequelize

'Include' in Sequelize: The One Confusing Query That You Should Memorize

When querying your database in Sequelize, you'll often want data associated with a particular model which isn't in the model's table directly. This data is usually typically associated through join tables (e.g. a 'hasMany' or 'belongsToMany' association), or a foreign key (e.g. a 'hasOne' or 'belongsTo' association).

When you query, you'll receive just the rows you've looked for. With eager loading, you'll also get any associated data. For some reason, I can never remember the proper way to do eager loading when writing my Sequelize queries. I've seen others struggle with the same thing.

Eager loading is confusing because the 'include' that is uses has unfamiliar fields is set in an array rather than just an object.

So let's go through the one query that's worth memorizing to handle your eager loading.

The Basic Query

@wojteklu
wojteklu / clean_code.md
Last active April 26, 2024 05:52
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@kylemanna
kylemanna / README-python-service-on-systemd-activated-socket.md
Last active February 7, 2024 16:26 — forked from drmalex07/README-python-service-on-systemd-activated-socket.md
An example network service with systemd-activated socket in Python. #systemd #python #socket #socket-activation

README

The example below creates a TCP server listening on a stream (i.e. SOCK_STREAM) socket. A similar approach can be followed to create a UDP server on a datagram (i.e. SOCK_DGRAM) socket. See man systemd.socket for details.

An example server

Create an simple echo server at ~/tmp/foo/serve.py.

@taoyuan
taoyuan / npm-using-https-for-git.sh
Last active April 19, 2024 18:20
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://