Skip to content

Instantly share code, notes, and snippets.

@nkcr
nkcr / steps.sh
Last active February 22, 2021 08:24
Create a simple chain with Byzcoin
# clone the Cothority repo, install bcadmin
mkdir chain
cd chain
git clone https://github.com/dedis/cothority.git
cd cothority/byzcoin/bcadmin
# will install in GOPATH/bin/
go install
# run some conodes
cd ../../conode
@nkcr
nkcr / hash-to-image.go
Created October 7, 2020 15:13
A simple way to render an icon based on a hash
/*
Copyright (c) 2013, Damian Gryski <damian@gryski.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
@nkcr
nkcr / quotes.txt
Created June 30, 2020 08:41
My favorites quotes
Some random quotes that I like.
"Technology is a useful servant, but a dangerous master"
"Code documentation is a love-letter to your future self"
"If you can't implement it, you don't understand it"
"Vision without execution is alucination"
EPFL / DEDIS / Lausanne / CH
Individual Contributor License Agreement ("Agreement") V2.0
http://www.apache.org/licenses/
Thank you for your interest in software from EPFL/DEDIS (Lab).
In order to clarify the intellectual property license
granted with Contributions from any person or entity, the Lab
must have a Contributor License Agreement ("CLA") on file that has
been signed by each Contributor, indicating agreement to the license
terms below. This license is for your protection as a Contributor as
@nkcr
nkcr / note.md
Last active December 16, 2021 12:35
DLTs, Blockchains, crypto stuff and friends

Bitcoin

  • proof of work
  • uses UTXOs

Ethereum

  • proof of work, looks to change in 2.0 for proof of stake (the network is secured by the owners of tokens)
  • uses a global state for "externaly owned" accounts, and a storage for each smart contract (state acount)
@nkcr
nkcr / emohex.go
Last active July 10, 2019 11:52
Hash to emoji in go
var emap = getEmap()
// EmoHex returns the 8 bits emoji representation of a byte slice
func EmoHex(in []byte) string {
if os.Getenv("EMOJI") != "true" {
return fmt.Sprintf("%x", in)
}
res := ""
for _, el := range in {
for f in ./*.jpg; do
        /Users/nkcr/Downloads/libwebp-1.0.2-rc1-mac-10.14/bin/cwebp -q 80 $f -o $f.webp
done
#!/bin/bash
DEST_DIR=~/picam
SHM_DIR=/run/shm
mkdir -p $SHM_DIR/rec
mkdir -p $SHM_DIR/hooks
mkdir -p $SHM_DIR/state
mkdir -p $DEST_DIR/archive
ln -sfn $DEST_DIR/archive $SHM_DIR/rec/archive
@nkcr
nkcr / image-from-pattern.md
Last active June 8, 2018 09:13
Generate big image from a pattern
$ docker run -v ${PWD}:/images --rm -it v4tech/imagemagick /bin/sh
/ # convert -size 2970x2100 tile:images/pattern.png images/big.png
@nkcr
nkcr / implementing-a-cnn-for-text-classification.ipynb
Last active May 28, 2018 11:20
Implementing a CNN for Text Classification.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.