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 os | |
import pydicom | |
from PIL import Image | |
import sys | |
def save_image(pixel_array, output_path): | |
if pixel_array.dtype != 'uint8': | |
pixel_array = ((pixel_array - pixel_array.min()) / (pixel_array.max() - pixel_array.min()) * 255).astype('uint8') | |
img = Image.fromarray(pixel_array) |
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/sh | |
# replace ${VM} with your VM name (ex: MacOSX Monterey) | |
# replace $RES with your resolution (ex: 1920x1080) | |
VBoxManage modifyvm "${VM}" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff | |
VBoxManage setextradata "${VM}" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac19,1" | |
VBoxManage setextradata "${VM}" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0" | |
VBoxManage setextradata "${VM}" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Mac-AA95B1DDAB278B95" | |
VBoxManage setextradata "${VM}" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" |
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 torch | |
import matplotlib.pyplot as plt | |
from torch.autograd import Variable | |
class Model: | |
def __init__(self): | |
self.W = Variable(torch.as_tensor(16.), requires_grad=True) | |
self.b = Variable(torch.as_tensor(10.), requires_grad=True) |
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
const web3 = new Web3(config.PROVIDER_URL) | |
const balance = parseInt(await web3.eth.getBalance(config.ETH_ADDRESS)) | |
const canvas = createCanvas(200, 270) | |
const ctx = canvas.getContext('2d') | |
ctx.fillStyle = "#aaaaaa" | |
ctx.fillRect(0, 0, canvas.width, canvas.height) | |
let qrcode = new Image() | |
qrcode.src = await QRCode.toDataURL(config.ETH_ADDRESS) |
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
<template> | |
<div> | |
<p>Your peerId: {{ myPeerId }}</p> | |
<p> | |
Other peerId: | |
<input type="text" style="width: 420px" v-model="otherPeerId" /><button | |
@click="findOtherPeer" | |
> | |
Find | |
</button> |
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
<template> | |
<main role="main" class="container"> | |
<div class="card"> | |
<div class="card-body"> | |
<h5 class="card-title">Todo example</h5> | |
<p class="card-text">Simple TODO app using Bootstrap and Vue.</p> | |
</div> | |
<ul class="list-group list-group-flush"> | |
<li class="list-group-item" v-for="(todo, idx) in todos" :key="idx"> | |
{{ todo }} |
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
# Docker compose file for a simple WordPress with MySQL | |
# source: https://docs.docker.com/samples/wordpress/ | |
version: "3.3" | |
services: | |
db: | |
image: mysql:5.7 | |
volumes: | |
- db_data:/var/lib/mysql |
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 React, { useState, useEffect } from 'react'; | |
import { StyleSheet, Text, View, Platform, Keyboard, Button, FlatList, TextInput } from 'react-native'; | |
const isAndroid = Platform.OS == "android"; | |
export default function App() { | |
const [text, setText] = useState(''); | |
const [tasks, setTasks] = useState([{ key: '0', text: "First task" }]); | |
const [viewPadding, setViewPadding] = useState(0); |
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: Apache-2.0 | |
pragma solidity ^0.8.4; | |
contract NFTToken { | |
event Mint(address indexed _to, uint256 indexed _tokenId, bytes32 _ipfsHash); | |
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId); | |
uint256 tokenCounter = 1; | |
mapping(uint256 => address) internal idToOwner; |
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 time | |
import gym | |
import numpy as np | |
import pygad.torchga | |
import pygad | |
import torch | |
import torch.nn as nn | |
from multiprocessing import Pool |
NewerOlder