Skip to content

Instantly share code, notes, and snippets.

@stettix
stettix / things-i-believe.md
Last active March 20, 2024 17:45
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

@HarryR
HarryR / poseidon.py
Last active May 22, 2022 08:32
Starkad and Poseidon: New Hash Functions for Zero Knowledge Proof Systems
#!/usr/bin/env python
"""
Implements the Poseidon permutation:
Starkad and Poseidon: New Hash Functions for Zero Knowledge Proof Systems
- Lorenzo Grassi, Daniel Kales, Dmitry Khovratovich, Arnab Roy, Christian Rechberger, and Markus Schofnegger
- https://eprint.iacr.org/2019/458.pdf
Other implementations:
@bxcodec
bxcodec / _struct_to_map.go
Last active October 6, 2023 06:22
Golang Struct To Map Example By JSON tag
/*
This function will help you to convert your object from struct to map[string]interface{} based on your JSON tag in your structs.
Example how to use posted in sample_test.go file.
*/
func structToMap(item interface{}) map[string]interface{} {
res := map[string]interface{}{}
if item == nil {
return res
}
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@chriseth
chriseth / async.md
Last active December 26, 2023 09:13
Async Solidity Contracts

Having seen @pirapira's sketch of Bamboo ( https://github.com/pirapira/bamboo/ ), which proposed to add better control about the "smart contract program flow", even across calls, I thought that this should certainly be added to Solidity, and actually, it might even be possible now to a certain degree using inline assembly.

The problem is that with many functions in a contract, it is not always clear which can be called at which stage in the contract's lifetime. Certain smart contracts would be easier to understand if written as follows:

@tomrunia
tomrunia / test_queue.py
Created June 24, 2016 08:57
Testing the performance of the TensorFlow FIFOQueue
import time
import numpy as np
import threading
import tensorflow as tf
from tensorflow.python.client import timeline
def test_queue():
@zg
zg / freebsd-qemu-xhyve-mac-os-x-virtual-machine.md
Last active April 1, 2024 21:47
Create FreeBSD virtual machine using qemu. Run the VM using xhyve.

TL;DR

  • Create 10GB FreeBSD image using QEMU.
  • Run the VM using xhyve.
  • Mount host directory.
  • Resize the image.

Requisites

@soardex
soardex / gist:e95cdc230d1ac5b824b3
Created May 9, 2015 01:15
Install rbenv in CentOS 7
# install build dependencies
sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel
# clone and install rbenv environment
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
@willurd
willurd / web-servers.md
Last active April 18, 2024 14:15
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@audreyt
audreyt / posa.mkdn
Last active November 28, 2022 21:24
EtherCalc.tw

從 SocialCalc 到 EtherCalc

先前在《開源應用程式架構》 一書中,我介紹了 SocialCalc 這個在瀏覽器中運行的試算表編輯器,以取代伺服器為中心的 WikiCalc 架構。SocialCalc 在瀏覽器中執行所有的運算,只有在載入和儲存試算表時才會使用伺服器。

追求效能是 Socialtext 團隊在 2006 年時設計 SocialCalc 的主要目的。重點在於:在 JavaScript 環境下執行客戶端運算,儘管在當年的速度僅有伺服器端 Perl 運算的十分之一,但仍然勝過 AJAX 來回傳輸資料造成的網路延遲:


WikiCalc 與 SocialCalc 架構比較

******