Skip to content

Instantly share code, notes, and snippets.

View Uberi's full-sized avatar

Anthony Zhang Uberi

View GitHub Profile
@Uberi
Uberi / storage.sol
Created September 14, 2018 02:31
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=true&gist=
pragma solidity ^0.4.0;
contract Storage {
uint value;
function set(uint newValue) public {
value = newValue;
}
function get() public view returns (uint) {
@Uberi
Uberi / index.html
Last active September 15, 2018 06:16
Introduction to Web3 talk - sample dApp for setting/getting the value of a variable. https://hypotenuse.ca/intro-to-web3/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js"></script>
<script type="text/javascript" src="index.js"></script>
<title>Storage Smart Contract</title>
</head>
<body>
POINTS_PER_CHARACTER = 72.23 / 13
def row_col_offset_to_xy_points(row, col, offset_x, offset_y, col_widths, row_heights):
pos_x = sum(col_widths[i] for i in range(col)) * POINTS_PER_CHARACTER + offset_x
pos_y = sum(row_heights[j] for j in range(row)) + offset_y
return (pos_x, pos_y)
import bisect
CHECKBOX_ENTRIES = [
(0, 0, 'One'),
(4, 0, 'Two'),
(8, 0, 'Three'),
(0, 10, 'Red'),
(4, 10, 'Green'),
(8, 10, 'Blue'),
(0, 20, 'A'),
import shutil, subprocess, tempfile, os
import openpyxl
def load_workbook_xls(filename, **kwargs):
"""Same as openpyxl.load_workbook, but supports XLS files instead of XLSX files."""
soffice_path = shutil.which("soffice")
if soffice_path is None:
raise EnvironmentError("Can't find `soffice` executable - ensure Libreoffice Calc is installed correctly")
with tempfile.TemporaryDirectory() as temp_xlsx_directory:
@Uberi
Uberi / cuda_11.8_installation_on_Ubuntu_22.04
Last active June 21, 2023 20:21 — forked from MihailCosmin/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check