Skip to content

Instantly share code, notes, and snippets.

scalahub /
Last active Aug 10, 2020
Rock-paper-scissors in Ergo
/** RPS game:
Alice creates a RPS game of "playAmount" ergs by creating a Half-game UTXO called the "halfGameOutput" output below.
Another player (Bob) then sends a transaction spending Alice's UTXO and creating two outputs called "fullGameOutputs" ("Full game" UTXOs).
After Alice opens her commitment (see below), the fullGameOutputs can be spent by the winner.
The transactions encode the following protocol.
Step 1: Alice commits to secret number a in {0, 1, 2} as follows:
Generate random s and compute h = Hash(s||a)
h is the commitment to a
Alice also selects the "play amount", the amount each player must spend to participate.
scalahub / RPS.sol
Created Aug 10, 2020
Rock-paper-scissors in Ethereum
View RPS.sol
pragma solidity ^0.4.9;
contract RPS {
address public house;
uint public numTokens;
mapping(address => uint) public tokenBalance;
function getContractBalance() returns (uint) {
return (this.balance);
function RPS(uint startTokens) {
if (startTokens < 1000 ether) throw;
scalahub / ConsumerExample.scala
Created Apr 30, 2020 — forked from fancellu/ConsumerExample.scala
Kafka Producer/Consumer Example in Scala
View ConsumerExample.scala
import java.util
import org.apache.kafka.clients.consumer.KafkaConsumer
import scala.collection.JavaConverters._
object ConsumerExample extends App {
import java.util.Properties
View Output of send
Request body
See description of /wallet/transaction/generate
scalahub /
Created Jul 18, 2019 — forked from Garoe/
Sign kernel modules on Ubuntu, useful for Nvidia drivers in UEFI system
# VERY IMPORTANT! After each kernel update or dkms rebuild the modules must be signed again with the script
# ~/.ssl/
# Place all files in ~/.ssl folder
mkdir ~/.ssl
cd ~/.ssl
# Generate custom keys with openssl
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -subj "/CN=Owner/"
scalahub /
Created Jun 8, 2019 — forked from lukas-h/
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.


scalahub /
Last active May 7, 2019 — forked from benstr/
Gist Markdown Cheatsheet

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6


scalahub /
Created Jan 30, 2018 — forked from Brainiarc7/
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running: