Skip to content

Instantly share code, notes, and snippets.

View jvik's full-sized avatar
👨‍🔬

Jørgen Vik jvik

👨‍🔬
View GitHub Profile
blueprint:
name: ZHA - Moes Smart Knob for lights
description: 'Control lights with a Moes Smart Knob.
You can set functions for a single press. This allows you to assign, e.g., a scene
or anything else.
Rotating left/right will change the brightness smoothly of the selected light.
Not all functionality of the device is available at time of writing, e.g. double
press, long press and press and rotate.
Original blueprint by seamus65 (https://gist.github.com/seamus65/939a147634942dd885c8704334627f93).
@jvik
jvik / low-battery-level-detection-notification-for-all-battery-sensors.yaml Home Assistant Blueprint: Low battery level detection & notification for all battery sensors
blueprint:
name: Low battery level detection & notification for all battery sensors
description: Regularly test all sensors with 'battery' device-class for crossing
a certain battery level threshold and if so execute an action.
domain: automation
input:
threshold:
name: Battery warning level threshold
description: Battery sensors below threshold are assumed to be low-battery (as
well as binary battery sensors with value 'on').
@jvik
jvik / vmdk_vhdx.md
Created February 14, 2021 02:34 — forked from rahilwazir/vmdk_vhdx.md
Convert VMWare to Hyper-V (vmdk to vhdx)
import Vue from "vue";
import VueApollo from "vue-apollo";
import {
createApolloClient,
restartWebsockets
} from "vue-cli-plugin-apollo/graphql-client";
// Install the vue plugin
Vue.use(VueApollo);
@jvik
jvik / app.js
Created October 21, 2019 12:10 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@jvik
jvik / app.ts
Created June 25, 2019 07:43
problem with webpack-hot-middleware
import express from 'express';
import webpack from 'webpack';
import webpackConfig from '../webpack.config.js';
import * as webpackDevMiddleware from 'webpack-dev-middleware';
import * as webpackHotMiddleware from 'webpack-hot-middleware';
const app = express();
const port = 8080; // default port to listen
const compiler = webpack(webpackConfig as any);
@jvik
jvik / webpack.config.js
Created June 25, 2019 07:42
Problem with webpack-hot-middleware
var fs = require('fs');
var webpack = require('webpack');
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function(x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function(mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
listening() {
if [ $# -eq 0 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P
elif [ $# -eq 1 ]; then
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep -i --color $1
else
echo "Usage: listening [pattern]"
fi
}
// Config for server
sv_cheats 1
sv_infinite_ammo 1
ammo_grenade_limit_total 5
mp_warmup_end
mp_freezetime 0
mp_roundtime 60
mp_roundtime_defuse 60
sv_grenade_trajectory 1
sv_grenade_trajectory_time 10
{
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "Source Code Pro",
"terminal.integrated.fontSize": 13,
"workbench.startupEditor": "newUntitledFile",
"git.autofetch": true,
"scssFormatter.tabWidth": 4,
"scssFormatter.useTabs": true,
"files.associations": {