Skip to content

Instantly share code, notes, and snippets.

View pellared's full-sized avatar

Robert Pająk pellared

View GitHub Profile
@pellared
pellared / dotnet.Dockerfile
Last active February 3, 2021 14:17
.NET 5 SDK Docker container with more runtimes
FROM mcr.microsoft.com/dotnet/sdk:5.0
# Install Mono slim verion
# https://github.com/mono/docker
ENV MONO_VERSION 6.12.0.107
RUN apt-get update \
&& apt-get install -y --no-install-recommends gnupg dirmngr \
&& rm -rf /var/lib/apt/lists/* \
&& export GNUPGHOME="$(mktemp -d)" \
@pellared
pellared / .bash_aliases
Last active May 7, 2021 09:50
Ubuntu settings
alias sa='eval `ssh-agent -s` && ssh-add ~/.ssh/id_rsa'
alias gm='B=`git branch --show-current` ; git checkout master ; git branch -D $B ; git pull -p'
alias gc='git checkout -b '
alias gsync='git checkout main && git fetch -p upstream && git rebase upstream/main && git push'
alias gake='go run ./build'
@pellared
pellared / grpctest.go
Last active April 11, 2024 20:37
grpctest
import (
"net"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
)
// NewGRPCTestServer starts a gRPC server for testing purposes.
# install radovskyb/watcher
cd ~ && GO111MODULE=on go get github.com/radovskyb/watcher/cmd/watcher && cd -
# run watcher to run make when something changes
watcher -dotfiles=false -cmd="make all"
@pellared
pellared / gitBash_windows.md
Created May 3, 2020 08:28 — forked from evanwill/gitBash_windows.md
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@pellared
pellared / chilogrus,go
Last active October 31, 2019 14:05
Go: Contextual logging with logrus, chi
package chilogrus
import (
"context"
"fmt"
"net/http"
"time"
"github.com/go-chi/chi/middleware"
"github.com/sirupsen/logrus"
@pellared
pellared / settings.json
Created March 21, 2019 08:49
My VSCode settings
{
"window.zoomLevel": 0,
"vim.easymotion": true,
"vim.useSystemClipboard": true,
"vim.leader": " ",
"vim.normalModeKeyBindings": [
{
"before": ["\\"],
"after": ["leader", "leader", "leader", "b", "d", "w"]
}
@pellared
pellared / keybase.md
Created March 13, 2019 23:17
keybase.md

Keybase proof

I hereby claim:

  • I am pellared on github.
  • I am pellared (https://keybase.io/pellared) on keybase.
  • I have a public key ASCcnhPXThQH9Q-MzC_CVK8GoQLcR3Wsyu4JdQtk_tD8Cgo

To claim this, I am signing this object:

@pellared
pellared / AddressObjectMother.cs
Last active April 20, 2020 18:27
Parameterized Object Mother in C# as an alternative to Test Data Builder pattern (thanks to named arguments with default values)
public static class AddressObjectMother
{
public static Address Create(string street = "", string city = "", PostCode postCode = null)
{
if (postCode == null)
{
postCode = PostCodeObjectMother.Create();
}
return new Address(street, city, postCode);
@pellared
pellared / BitUtils.cs
Last active April 11, 2023 08:10
BitUtils in C#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
namespace Pellared.Common
{
public static class BitUtils
{
public static byte DecimalToBcd(int dec)