This file contains hidden or 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
esphome: | |
name: livingroom | |
esp8266: | |
board: esp01_1m | |
# Enable logging | |
logger: | |
# Enable Home Assistant API |
This file contains hidden or 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/bash | |
ARTIFACT="PocketMine-MP.phar" | |
ACCOUNT="pmmp" | |
PROJECT="PocketMine-MP" | |
LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/${ACCOUNT}/${PROJECT}/releases/latest) | |
LATEST_VERSION=$(echo ${LATEST_RELEASE} | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') | |
ARTIFACT_URL="https://github.com/${ACCOUNT}/${PROJECT}/releases/download/${LATEST_VERSION}/${ARTIFACT}" | |
if [ -f version.txt ]; then | |
CURRENT_VERSION=$(<version.txt) | |
else |
This file contains hidden or 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
# You have the numbers 1 - 9, arrange them to make a third | |
from itertools import permutations | |
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9] | |
top = permutations(nums, 4) | |
bottom = permutations(nums, 5) | |
top_vals = list(top) | |
bottom_vals = list(bottom) | |
count = 0 |
This file contains hidden or 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 sys, time, random, string | |
name = "Daniel Michael Blake Day-Lewis" | |
length = len(name) | |
output = "" | |
def randomString(stringLength=10): | |
"""Generate a random string of fixed length """ | |
letters = string.ascii_lowercase |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a ="http://microsoft.com/schemas/VisualStudio/TeamTest/2006" xmlns:b ="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" > | |
<xsl:output method="xml" indent="yes" /> | |
<xsl:template match="/"> | |
<testsuites> | |
<xsl:variable name="buildName" select="//a:TestRun/@name"/> | |
<xsl:variable name="numberOfTests" select="count(//a:UnitTestResult/@testId) + count(//b:UnitTestResult/@testId)"/> | |
<xsl:variable name="numberOfFailures" select="count(//a:UnitTestResult/@outcome[.='Failed']) + count(//b:UnitTestResult/@outcome[.='Failed'])" /> | |
<xsl:variable name="numberOfErrors" select="count(//a:UnitTestResult[not(@outcome)]) + count(//b:UnitTestResult[not(@outcome)])" /> | |
<xsl:variable name="numberSkipped" select="count(//a:UnitTestResult/@outcome[.!='Passed' and .!='Failed']) + count(//b:UnitTestResult/@outcome[.!='Passed' and .!='Failed'])" /> |
This file contains hidden or 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
# Connect to vCenter | |
Connect-VIServer -Server 192.168.0.10 -user administrator@vsphere.local -password <password> | |
# Get the HostId of the VM Host entering maintenance mode - assuming only one Host in a Data Center at a time | |
$hostid = Get-Task Running | where {$_.name -eq "EnterMaintenanceMode_Task"} | select ObjectId | |
# If there is a result then shutdown all the VMs that match the name given | |
if (-not ([string]::IsNullOrEmpty($hostid))) | |
{ | |
# Get the VM Host name by the ObjectId | |
$esxhost = Get-VMHost | where {$_.Id -eq $hostid.ObjectId} | |
# Shutdown the VM given by the wildcard - in this case any machine begninning with Gluster running on that host |
This file contains hidden or 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/bash | |
# /usr/lib/update-notifier/apt-check | |
val=$(yum check-update --quiet | grep '^[a-Z0-9]' | wc -l) | |
echo "${val};${val}" |
This file contains hidden or 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
#!/usr/bin/env python | |
import datetime | |
import holidays | |
import calendar | |
workingdays_year = 0 | |
uk_holidays=holidays.UK() | |
this_year=datetime.datetime.now().year | |
for month in range (1, 13): | |
weekdays = [] |
This file contains hidden or 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
apt-get install build-essential libssl-dev | |
wget "https://downloads.sourceforge.net/project/ibmtpm20tss/ibmtss1119.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fibmtpm20tss%2Ffiles%2Flatest%2Fdownload&ts=1527166281" | |
mv ibmtss1119.tar.gz\?r\=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fibmtpm20tss%2Ffiles%2Flatest%2Fdownload\&ts\=1527166281 ibmtss1119.tar.gz | |
mkdir ibm-tss | |
cd ibm-tss | |
cp ../ibmtss1119.tar.gz . | |
tar -zxvf ibmtss1119.tar.gz | |
cd utils | |
make | |
find . -newermt `date +"%Y-%m-%d"` -print0 | xargs -0 -I {} mv {} /usr/local/sbin |
This file contains hidden or 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
#!/usr/bin/env python | |
import random | |
import time | |
import datetime | |
def strTimeProp(format, prop): | |
stime = time.mktime(time.strptime((datetime.datetime.now()+datetime.timedelta(-3650)).strftime(format), format)) | |
etime = time.mktime(time.strptime(datetime.datetime.now().strftime(format), format)) | |
ptime = stime + prop * (etime - stime) | |
return time.strftime(format, time.localtime(ptime)) |