This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/sha256" | |
"encoding/json" | |
"fmt" | |
"strconv" | |
"strings" | |
"time" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Rise base to power of. | |
* | |
* From: http://bbs.espressif.com/viewtopic.php?t=246 | |
* | |
* @param base The number. | |
* @param exp The exponent. | |
* | |
* @return Product. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------------------------- | |
/* 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |