Skip to content

Instantly share code, notes, and snippets.

@hbshrestha
hbshrestha / tree of Hamilton paths
Last active June 23, 2022 04:53
Return the tree structure of Hamilton paths
import networkx as nx
import matplotlib.pyplot as plt
cities = ["Berlin","Dusseldorf","Hamburg","Munich","Berlin"]
def make_tsp_tree(cities):
"""
Create all Hamilton paths from start to end city from a list of cities.
Creates a directed prefix tree from a list of the created paths.
Remove the root node and nil node.
@adilanchian
adilanchian / WavePortal.sol
Last active November 2, 2023 06:07
Section 2: Write and deploy your WavePortal smart contract to a local Ethereum network
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "hardhat/console.sol";
contract WavePortal {
uint256 totalWaves;
constructor() {
@coinsandsteeldev
coinsandsteeldev / dialog.html
Last active July 19, 2024 05:46 — forked from arthurattwell/dialog.html
Google Sheets script to allow multi-select in cells with data-validation (adapted from https://www.youtube.com/watch?v=dm4z9l26O0I)
<!DOCTYPE html>
<html>
<head>
<script>
var data
var formId = 'form'
function drawForm() {
if (!data) return
var outputEl = document.getElementById(formId);
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();