Skip to content

Instantly share code, notes, and snippets.

@jhines2k7
jhines2k7 / rps.sol
Created November 10, 2023 17:32 — forked from ethanppl/rps.sol
Solidity smart contract of rock, paper, scissors.
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.7.0 <0.9.0;
contract rps {
uint256 public startBlock = block.number;
address constant alice = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4;
address constant bob = 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2;
bytes32 aliceHash;
@jhines2k7
jhines2k7 / LLM.md
Created October 5, 2023 13:31 — forked from rain-1/LLM.md
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@jhines2k7
jhines2k7 / split_tmux.sh
Created August 8, 2023 21:48
Short script to split terminal into 4 panes
#!/bin/bash
# Create a new tmux session without attaching to it
tmux new-session -d -s informed-observer
# Split the first pane vertically
tmux split-window -v
# Select pane 0
tmux select-pane -t 0
@jhines2k7
jhines2k7 / NewYearsChaos.java
Last active November 11, 2019 13:49
Working on a Hackerrank solution
// int[] q = new int[]{1, 2, 5, 3, 7, 8, 6, 4}; {1, 2, 3, 4, 5, 6, 7, 8}
int[] q = new int[]{2, 1, 5, 3, 4}; //-> 3
// int[] q = new int[]{2, 5, 1, 3, 4}; //-> too chaotic
int[] r = new int[q.length];
boolean inFinalPos = false;
boolean tooChaotic = false;
int numBribes;
int totalBribes = 0;
int finalPos;
@jhines2k7
jhines2k7 / git-commands.sh
Created October 14, 2019 00:59
99% of the Git commands you'll need at work, demonstrated in a single script
#!/bin/bash
##########
# contents
##########
# contents
# notes
# script setup
# git config files
@jhines2k7
jhines2k7 / simple-test-runner.js
Created May 14, 2018 13:01
World's simplest JavaScript test runner
function assertEqual(a, b, desc) {
if (a === b) {
console.log(`${desc} ... PASS`);
} else {
console.log(`${desc} ... FAIL: ${a} != ${b}`)
}
}
function assertThrowsError(func, desc) {
try {

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@jhines2k7
jhines2k7 / results-of-docker-service-ls.txt
Created March 12, 2018 21:48
Results of running docker service ls
$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
dl3fi348sznu kafka1 replicated 1/1 confluentinc/cp-kafka:4.0.0
01twklttmm9l kafka2 replicated 1/1 confluentinc/cp-kafka:4.0.0
jlppikeem3ay kafka3 replicated 1/1 confluentinc/cp-kafka:4.0.0
xl3ota9jdeax kafka-rest replicated 1/1 confluentinc/cp-kafka-rest:4.0.0
jr8ysqiymply schema-registry replicated 1/1 confluentinc/cp-schema-registry:4.0.0
oi4jxf500cza zk1 replicated 1/1 confluentinc/cp-zookeeper:4.0.0
aqfon18x9cse zk2 replicated 1/1 confluentinc/cp-zookeeper:4.0.0
to3dse7ov67y zk3 replicated 1/1 confluentinc/cp-zoo
@jhines2k7
jhines2k7 / docker-service-create-commands.txt
Last active March 12, 2018 21:44
Docker service create commands
docker service create \
--network kafka-net \
--name zk1 \
-e ZOOKEEPER_SERVER_ID=1 \
-e ZOOKEEPER_CLIENT_PORT=22181 \
-e ZOOKEEPER_TICK_TIME=2000 \
-e ZOOKEEPER_INIT_LIMIT=5 \
-e ZOOKEEPER_SYNC_LIMIT=2 \
-e ZOOKEEPER_SERVERS="0.0.0.0:22888:23888;zk2:32888:33888;zk3:42888:43888" \
--constraint "engine.labels.node.type==kafka-node-1" \