Skip to content

Instantly share code, notes, and snippets.

@scalahub
scalahub / RPS.es
Last active Aug 10, 2020
Rock-paper-scissors in Ergo
View RPS.es
/** 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.
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
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
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 learning_scala.org
View Output of send
Request body
See description of /wallet/transaction/generate
Examples:
{"requests":[{"address":"4MQyML64GnzMxZgm","value":123456,"assets":[],"registers":{"R4":"0e20f091616c10378d94b04ed7afb6e7e8da3ec8dd2a9be4a343f886dd520f688563","R5":"061913aaf504e4bc1e62173f87a4378c37b49c8ccff196ce3f0ad2","R6":"0e061a2b3c4d5e6f"}},{"address":"7g5LhysK7mxX8xmZdPLtFE42wwxGFjpp8VofStb","value":123456,"assets":[],"registers":{"R4":"0e20f091616c10378d94b04ed7afb6e7e8da3ec8dd2a9be4a343f886dd520f688563","R5":"061913aaf504e4bc1e62173f87a4378c37b49c8ccff196ce3f0ad2","R6":"0e061a2b3c4d5e6f"}}],"fee":1000000,"inputsRaw":[]}
Execute
Clear
Responses
@scalahub
scalahub / create-efi-keys.sh
Created Jul 18, 2019 — forked from Garoe/create-efi-keys.sh
Sign kernel modules on Ubuntu, useful for Nvidia drivers in UEFI system
View create-efi-keys.sh
# VERY IMPORTANT! After each kernel update or dkms rebuild the modules must be signed again with the script
# ~/.ssl/sign-all-modules.sh
# 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
scalahub / license-badges.md
Created Jun 8, 2019 — forked from lukas-h/license-badges.md
Markdown License Badges for your Project
View license-badges.md

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.

Notes

@scalahub
scalahub / readme.md
Last active May 7, 2019 — forked from benstr/readme.md
Gist Markdown Cheatsheet
View readme.md

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Paragraph

@scalahub
scalahub / skylake-tuning-linux.md
Created Jan 30, 2018 — forked from Brainiarc7/skylake-tuning-linux.md
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.
View skylake-tuning-linux.md

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: