Skip to content

Instantly share code, notes, and snippets.

View janmalec's full-sized avatar

Jan Malec janmalec

  • Jožef Stefan Institute
  • Koper
View GitHub Profile
blueprint:
name: Motion-activated Light
description: Turn on a light when motion is detected.
domain: automation
based on: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
source_url: https://gist.github.com/janmalec/19c67c0483b2331a28d082f046df7d32
author: Jan Malec (based on HA)
input:
motion_entity:
name: Motion Sensor
@janmalec
janmalec / bat2sh.sh
Last active January 5, 2023 09:45 — forked from markus2610/bat2sh.sh
Simple converter from batch (.bat) files to shell script (.sh)
#!/usr/bin/env bash
#
# Converts Windows batch script to Linux shell script
#
# Invocation:
# ./bat2sh script.bat
#
OUTFILE=${2:-${1%%.bat}.sh}
@janmalec
janmalec / serpent_openmc_mat_converter.py
Last active January 2, 2021 07:11
Reads a serpent input file and writes an OpenMC input file for materials. Usage: `python3 serpent_openmc_mat_converter.py -i <inputfile> -o <outputfile>`
import sys, getopt
elements = ['H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg',
'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr',
'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br',
'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd',
'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 'I', 'Xe', 'Cs', 'Ba', 'La',
'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er',
'Tm', 'Yb', 'Lu', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au',
'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', 'Ra', 'Ac', 'Th',
@janmalec
janmalec / HowToOpenAnotherTerminal-BashInstanceInARunningDockerContainer.md How To Open Another Terminal/Bash Instance In A Running Docker Container as current user #gistblog #bash #docker

How To Open Another Terminal/Bash Instance In A Running Docker Container as current user

Add the following to your bashrc.

#Add another docker window
function dock()
{
  if [ "$1" == "-h" ]
 then