This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity >=0.7.0 <0.9.0; | |
contract KV { | |
bytes32[] private reservedKeys; | |
mapping(bytes32 => string) private values; | |
constructor(bytes32[] memory _reservedKeys) { | |
reservedKeys = _reservedKeys; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eyed3 | |
import io | |
import os | |
from PIL import Image | |
def is_progressive(img): | |
return "progression" in img.info or "progressive" in img.info | |
def deprogressify(filename): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Use this file to configure your truffle project. It's seeded with some | |
* common settings for different networks and features like migrations, | |
* compilation and testing. Uncomment the ones you need or modify | |
* them to suit your project as necessary. | |
* | |
* More information about configuration can be found at: | |
* | |
* truffleframework.com/docs/advanced/configuration | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Based on https://medium.com/@chim/ethereum-how-to-setup-a-local-test-node-with-initial-ether-balance-using-geth-974511ce712 | |
# Initialise a local geth testnet with automine | |
CHAIN_DIRECTORY=~/.testnet; | |
STARTING_BALANCE="0x5337000000000000000000" | |
if [ -d "$CHAIN_DIRECTORY" ]; then | |
rm -r ${CHAIN_DIRECTORY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given an array of visited vertices, where each element represents the parent of the vertex, | |
// fill the path array with the route between src and dest. | |
int reconstructShortestPath(Vertex src, Vertex dest, int *visited, int nV, int *path) { | |
// Based on the suggestion here: https://stackoverflow.com/questions/8379785/how-does-a-breadth-first-search-work-when-looking-for-shortest-path#comment27820665_8379892 | |
// Record the route in a queue. | |
Queue route = newQueue(); | |
// Backtrack through the visited array, recording each vertex in the queue. | |
int current = dest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Web3 from "web3"; | |
import { getWeb3 } from "./utils/web3"; | |
const Contract = require("truffle-contract"); | |
import * as SaleABI from "../../build/contracts/YabbySale.json"; | |
import * as CoinABI from "../../build/contracts/YabbyCoin.json"; | |
function showWeb3(divName: string, web3: Web3) { | |
const elt = document.getElementById(divName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
make | |
./vmsim lru 5 4 < trace1 > my-out-lru-5-4-trace1.txt | |
diff my-out-lru-5-4-trace1.txt out-lru-5-4-trace1.txt | |
./vmsim fifo 5 4 < trace1 > my-out-fifo-5-4-trace1.txt | |
diff my-out-fifo-5-4-trace1.txt out-fifo-5-4-trace1.txt | |
./vmsim lru 8 4 < trace2 > my-out-lru-8-4-trace2.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include "List.h" | |
List makeList(void) { | |
List l = calloc(1, sizeof(list)); | |
return l; | |
} | |
List addAtHead(List l, int value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
struct node { | |
int data; | |
struct node *next; | |
}; | |
struct node *new_node(int data, struct node *next); | |
void print_list(struct node *head); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mouseDeadZone = 50; | |
if (this.game.getMouseX() > this.getXPosition() + mouseDeadZone) | |
{ | |
this.setXSpeed(100); | |
this.setYSpeed(0); | |
this.playAnimation('Right'); | |
} | |
else if (this.game.getMouseX() < this.getXPosition() - mouseDeadZone) | |
{ | |
this.setXSpeed(-100); |
NewerOlder