Skip to content

Instantly share code, notes, and snippets.

@viktoschi
viktoschi / README.md
Created March 31, 2021 19:18 — forked from snormore/README.md
Deploying a web app to Kubernetes with SSL using Let's Encrypt via cert-manager and nginx-ingress.

Deploying a web app to Kubernetes with SSL using Let's Encrypt via cert-manager and nginx-ingress

Spin up a Kubernetes cluster

You can do this with MiniKube for development and testing, or Google Cloud's GKE for the real thing.

MiniKube

# Make sure you have MiniKube installed and it's the latest
@viktoschi
viktoschi / inkbird.js
Created October 23, 2020 06:36 — forked from onderweg/inkbird.js
Read temperature and humidity data from Inkbird ibs-TH1.
const DATA_HND = 0x002d;
const parseData = (data) => {
const rawTemp = data.readInt16LE(0);
const rawHum = data.readInt16LE(2);
return {
temperature: rawTemp / 100,
humidity: rawHum / 100
}
}
@viktoschi
viktoschi / Set-WindowStyle.ps1
Created July 19, 2017 12:18 — forked from Nora-Ballard/Set-WindowState.ps1
Hide, Show, Minimize, Maximize, etc window from Powershell.
function Set-WindowStyle {
param(
[Parameter()]
[ValidateSet('FORCEMINIMIZE', 'HIDE', 'MAXIMIZE', 'MINIMIZE', 'RESTORE',
'SHOW', 'SHOWDEFAULT', 'SHOWMAXIMIZED', 'SHOWMINIMIZED',
'SHOWMINNOACTIVE', 'SHOWNA', 'SHOWNOACTIVATE', 'SHOWNORMAL')]
$Style = 'SHOW',
[Parameter()]
$MainWindowHandle = (Get-Process –id $pid).MainWindowHandle
@viktoschi
viktoschi / profile-cleanup.cmd
Created April 25, 2016 16:04 — forked from maciakl/profile-cleanup.cmd
A script to delete user data for those occasions where you just want to nuke all user data without reimaging machine.
@echo off
REM use this file to run the powershell script bypassing the policy restrictions
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dpn0.ps1'"
pause
@viktoschi
viktoschi / A_DATABASEWEAR.md
Created April 7, 2016 13:18 — forked from tajchert/A_DATABASEWEAR.md
Android Wear Realm Database Sync

This short code will show how to sync database file using Realm, but can be used for any file that you need to send to Wear (using Data API). It just takes any file, change it to Asset object and send it over to Wear device. Also it can be used Mobile->Wear, and Wear->Mobile.

When you need to sync database just call FileSender.syncRealm(context);, that is it!

DISCLAIMER "Proper" way would be to synchronize each transaction to DB, but it in most cases Wear is used very rarely comparing to mobile, so it would most likely cause a battery drain. My idea was to synchronize it only whene it is needed (so for example when app closes). If you want to make sure that you are using latest DB, just send trigger data using MessageAPI from Wear to Phone with ask of syncing over its database, or keep some timestapm of last edit and check it.

@viktoschi
viktoschi / mobile-AndroidManifest.xml
Created March 16, 2016 19:08 — forked from gabrielemariotti/mobile-AndroidManifest.xml
Android Wear: small gist to start an Activity on the mobile handheld from the Android Wear device.
<service android:name=".ListenerServiceFromWear">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>