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
function getUserByToken($token) | |
{ | |
$data = array("idToken" => $token); | |
$data_string = json_encode($data); | |
$ch = curl_init('https://identitytoolkit.googleapis.com/v1/accounts:lookup?key=' . API_KEY); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt( |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 time | |
import gym | |
import numpy as np | |
import pygad.torchga | |
import pygad | |
import torch | |
import torch.nn as nn | |
from multiprocessing import Pool | |
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
import gym | |
import numpy as np | |
from tensorflow.keras.models import Sequential | |
from tensorflow.keras.layers import Dense | |
import pygad.kerasga | |
import pygad | |
def fitness_func(solution, sol_idx): | |
global keras_ga, model, observation_space_size, env |
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
// Simple TODO react native app | |
// based on https://codeburst.io/todo-app-with-react-native-f889e97e398e | |
import React, { Component } from 'react'; | |
import { StyleSheet, Text, View, FlatList, TextInput, Keyboard, Button } from 'react-native'; | |
const isAndroid = Platform.OS == "android"; | |
export default class App extends Component { |
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
# TensorFlow CNN model training example | |
# based on https://www.tensorflow.org/tutorials/images/cnn | |
from __future__ import absolute_import, division, print_function, unicode_literals | |
import tensorflow as tf | |
from tensorflow.keras import datasets, layers, models | |
import matplotlib.pyplot as plt |
NewerOlder