Skip to content

Instantly share code, notes, and snippets.

View Goldziher's full-sized avatar
🐙
Codoctupus

Na'aman Hirschfeld Goldziher

🐙
Codoctupus
  • Philipps & Byrne GmbH
  • Berlin
  • 13:13 (UTC +02:00)
  • LinkedIn in/nhirschfeld
View GitHub Profile
@bruno-uy
bruno-uy / git_good_practices.md
Last active October 18, 2022 14:59
Git good practices

Git good practices

  1. Write meaningful and concise commit message:
    • ❌ "Add new feature"
    • ✅ Changing X and Y because of Z
  2. Follow a pattern / convention for commit messages. You can check a good reference here.
  3. Squash commits you did for testing / adding small changes. You can check how to do that here.
  4. Separate your commits into isolated units of "atomic" changes. Examples:
    • Changes in one class / file
    • Refactor previous to the actual change you'll be doing
  • Changes in one function if the change is considerable
@palewire
palewire / README.md
Last active April 15, 2024 20:38
How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

Here's how I configured a GitHub Action so that a new version issued by GitHub's release interface will build a Dockerfile, tag it with the version number and upload it to Google Artifact Registry.

Before you attempt the steps below, you need the following:

  • A GitHub repository that contains a working Dockerfile
  • The Google Cloud SDK tool gcloud installed and authenticated

Create a Workload Identity Federation

@Goldziher
Goldziher / Dockerfile
Last active February 10, 2023 08:41
fastAPI Poetry Docker image
FROM python:3.9-slim AS install
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends curl \
&& apt-get autoremove -y
RUN pip install --upgrade pip
WORKDIR /app/
# install poetry and keep the get-poetry script so it can be reused later.
ENV POETRY_HOME="/opt/poetry"
RUN curl https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py > get-poetry.py
@Haraldson
Haraldson / usage.js
Last active March 11, 2023 13:53
Lodash useDebounce React Hook
import React, { useState, useEffect } from 'react'
import { useDebounce } from './use-debounce'
const MySearchComponent = props => {
const [search, setSearch, {
signal,
debouncing
}] = useDebounce('')
const [results, setResults] = useState([])

CockroachDB and Docker Compose

This is the first in a series of tutorials on CockroachDB and Docker Compose

  • Information on CockroachDB can be found here.
  • Information on Docker Compose can be found here
  1. Install Docker Desktop

Because we already have an official CockroachDB docker image, we will use that in our docker-compose.yml file. We recommend you use one of the current tags instead of latest.

@dopey
dopey / main.go
Last active April 30, 2024 15:59 — forked from denisbrodbeck/main.go
How to generate secure random strings in golang with crypto/rand.
package main
import (
"crypto/rand"
"encoding/base64"
"fmt"
"io"
"math/big"
)
@kissgyorgy
kissgyorgy / sqlalchemy_conftest.py
Last active March 5, 2024 23:05
Python: py.test fixture for SQLAlchemy test in a transaction, create tables only once!
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from myapp.models import BaseModel
import pytest
@pytest.fixture(scope="session")
def engine():
return create_engine("postgresql://localhost/test_database")
@mnot
mnot / iri_to_uri.py
Created January 20, 2013 03:15
Convert an IRI to a URI
import urllib
import urlparse
def iri_to_uri(iri, encoding='Latin-1'):
"Takes a Unicode string that can contain an IRI and emits a URI."
scheme, authority, path, query, frag = urlparse.urlsplit(iri)
scheme = scheme.encode(encoding)
if ":" in authority:
host, port = authority.split(":", 1)
authority = host.encode('idna') + ":%s" % port