Skip to content

Instantly share code, notes, and snippets.

View eivl's full-sized avatar

Eivind Teig eivl

  • Amedia
  • Sarpsborg, Norway
  • X @eivl
View GitHub Profile
import unicodedata
def is_number(s):
try:
float(s)
return True
except ValueError:
pass
try:
@eivl
eivl / tutorial.md
Created June 27, 2018 11:21 — forked from Hengjie/tutorial.md
How to passthrough SATA drives directly on VMWare ESXI 6.5 as RDMs

How to passthrough SATA drives directly on VMWare EXSI 6.5 as RDMs

There aren't many tutorials about this, the only tutorials I've found were about passing through entire PCIe cards to VMs, or refered to old ESXI versions (below 6.5) that used a more comprehensive desktop client instead of the web app. In v6.5, the web app was introduced and the desktop client was deprecated. You used to be able to setup RDMs in the desktop client, but with the introduction of the web console, this is no longer the case. This tutorial shows you how to pass SATA HDDs to the virtual machine on VMWare ESXI 6.5. This tutorial is partially based on VMWare's own KB and the now deprecated Forza IT blog post.

Summary

We attach the SATA HDDs as a RDM (Raw Device Mapper) into an existing virtual disk in the command line, then on the web app

from math import gcd, sqrt, pi
from statistics import mean
import random
UPPER_BOUND = 10000 # the upper bound of the random number generator
ITERATIONS = 5000 # the number of iterations when calculating Pi
RUN_NUMBER_OF_TIMES = 100 # the number of times the calculation of Pi
# function to yield two random numbers
######################################################################
from tkinter import *
import random
import string
class Boggle():
F = {}
T = {}
postion_dict = {}
@eivl
eivl / hangman_1.py
Created November 29, 2017 11:14 — forked from DevDarren/hangman_1.py
A simple hangman game made with Python 2.7.3
class Hangman():
def __init__(self):
print "Welcome to 'Hangman', are you ready to die?"
print "(1)Yes, for I am already dead.\n(2)No, get me outta here!"
user_choice_1 = raw_input("->")
if user_choice_1 == '1':
print "Loading nooses, murderers, rapists, thiefs, lunatics..."
self.start_game()
elif user_choice_1 == '2':
import random
from collections import Counter
NUMBER_OF_DICE = 4
def check_run_of_all(c):
if sorted(c.keys()) == list(range(min(c.keys()), max(c.keys())+1)):
if len(c.keys()) == NUMBER_OF_DICE:
return True
import random
def newCard(val, suit):
if not (type(val) == type(1) and 0 < val <= 13):
return None
if type(suit) == type('a') and len(suit) == 1:
suit = suit.upper()
else:
return None
@eivl
eivl / random_ellipse.py
Created October 16, 2017 08:33
draw random ellipses
# https://stackoverflow.com/questions/34284958/how-to-draw-an-ellipse-in-python-turtle-graphics-other-than-stamping
# go to stackoverflow to see more comments
import turtle
import math
def ellipse(self, x_radius, y_radius, steps=60):
down = self.isdown() # record pen state for restoration later
import urllib.request
from docx import Document
from docx.shared import Inches
document = Document()
document.add_heading('Document Title', 0)
p = document.add_paragraph('A plain paragraph having some ')
p.add_run('bold').bold = True
var Combat_Begins = Combat_Begins || {};
Combat_Begins.fourth_ed = false; //If using 4th edition, it takes 1/2 'Level' and adds it for initiative
Combat_Begins.statName = "Dexterity"; //Stat to be added to roll
Combat_Begins.Modifier = "Initmod";
Combat_Begins.rollValue = 20; //rolling 1d20, change if you roll 1dXX
Combat_Begins.sendChat = false //true if you want you initiative rolls sent to chat
on("chat:message", function(msg) {
if (msg.type == "api" && msg.content.indexOf("!CombatBegins") !== -1) {
//Start with an empty initiative