Skip to content

Instantly share code, notes, and snippets.

View rzajac's full-sized avatar
🇵🇱
Amor Patriae Nostra Lex

Rafal Zajac rzajac

🇵🇱
Amor Patriae Nostra Lex
View GitHub Profile
@rzajac
rzajac / code.go
Last active April 4, 2025 12:01
Test
type T struct {
Int int
Next *T
}
have := T{1, &T{2, &T{3, &T{42, nil}}}}
want := T{1, &T{2, &T{8, &T{42, nil}}}}
trails := make([]string, 0)
assert.Equal(
@rzajac
rzajac / blockchain.go
Created December 30, 2021 19:50 — forked from LordGhostX/blockchain.go
Blockchain POC with Golang
package main
import (
"crypto/sha256"
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
)
@rzajac
rzajac / bump_version
Last active October 12, 2021 14:17
bump version
#!/bin/bash
# Thanks goes to @pete-otaqui for the initial gist:
# https://gist.github.com/pete-otaqui/4188238
#
# Original version modified by Rafal Zajac
#
# Works with a file called VER in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3" or even "1.2.3-beta+001.ab"
@rzajac
rzajac / Makefile
Created October 5, 2021 14:11 — forked from developer-guy/Makefile
makefile kink goreleaser
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
# Set version variables for LDFLAGS
GIT_TAG ?= dirty-tag
GIT_VERSION ?= $(shell git describe --tags --always --dirty)
@rzajac
rzajac / ftoa
Created October 21, 2017 13:47
float to ASCII for ESP8266
/**
* Rise base to power of.
*
* From: http://bbs.espressif.com/viewtopic.php?t=246
*
* @param base The number.
* @param exp The exponent.
*
* @return Product.
*/
@rzajac
rzajac / dump_bin
Last active October 22, 2017 12:09
void ICACHE_FLASH_ATTR
dump_binary(uint16_t data)
{
uint16_t mask;
for (mask = 0x8000; mask != 0; mask >>= 1) {
os_printf("%d", (data & mask) > 0);
if ((mask == 0x1000) || (mask == 0x100) || (mask == 0x10)) os_printf(" ");
}
os_printf("\n");
@rzajac
rzajac / crc8
Created October 16, 2017 09:59
//--------------------------------------------------------------------------
/* Compute the CRC8 value of a data set.
* Full Software Method
*
* This function will compute the CRC8 or DOW-CRC of inData using seed
* as inital value for the CRC.
*
* \param inData One byte of data to compute CRC from.
*
* \param seed The starting value of the CRC.
@rzajac
rzajac / vimrc
Last active August 29, 2015 14:10
if has('autocmd')
filetype plugin indent on
endif
if has('syntax') && !exists('g:syntax_on')
syntax enable
endif
set autoindent
set backspace=indent,eol,start
set complete-=i