Skip to content

Instantly share code, notes, and snippets.

View artemnikitin's full-sized avatar
🍵

Artem Nikitin artemnikitin

🍵
View GitHub Profile
@artemnikitin
artemnikitin / enum_proposal.md
Last active July 7, 2018 23:37
Proposal for enum support in Go implementation of Flatdata

First of all, in Go there are no enums. The common way of implementing enum-like functionality is via constants:

const(
	ConstantText = ""
	ConstantInt int64 = 2342423324
)
@artemnikitin
artemnikitin / go
Created September 11, 2018 09:36
Test example
func TestReaderBlaBlaBla1(t *testing.T) {
descriptor := &TestMemoryDescriptor{Array: bytes} //input
result := Read(descriptor, 1, 1, false)
assert.Equal(t, 5, result,
"Result expected: %v, actual: %v, for test data: %v", v.expected, result, v)
}
func TestReaderBlaBlaBla2(t *testing.T) {
descriptor := &TestMemoryDescriptor{Array: bytes} //input
result := Read(descriptor, 1, 2, false)

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@artemnikitin
artemnikitin / example.go
Created October 30, 2019 18:02
Cleanup test output
// Replacement for https://github.com/elastic/cloud-on-k8s/blob/master/test/e2e/cmd/run/run.go#L346-L365
var f *os.File
if h.logToFile {
f, err = os.Create(testsLogFile)
if err != nil {
log.Error(err, "Can't create file for test output")
return
}
defer f.Close()
@artemnikitin
artemnikitin / gist:ee3f91516fb05468d226
Created July 7, 2014 12:18
Generate Hmac SHA-1 signature via Python 2.7
#!/usr/bin/env python
import base64
import hmac
import hashlib
string = raw_input("Enter string to encode: ")
key = raw_input("Enter key: ")
hash = hmac.new(key, string, hashlib.sha1).digest()
@artemnikitin
artemnikitin / keybase.md
Last active June 27, 2022 08:14
Keybase proof

Keybase proof

I hereby claim:

  • I am artemnikitin on github.
  • I am artemnikitin (https://keybase.io/artemnikitin) on keybase.
  • I have a public key ASDfjxaR2b4qyT5G_1Cu0oGodoK9tnk8JSvv0nsVLvEDJgo

To claim this, I am signing this object: