Skip to content

Instantly share code, notes, and snippets.

View mastersign's full-sized avatar

Tobias Kiertscher mastersign

View GitHub Profile
@mastersign
mastersign / excel_time.sql
Created March 23, 2024 08:39
PostgreSQL function for converting timestamps into OLE Dates
CREATE OR REPLACE FUNCTION excel_time(in timestamp, out double precision)
AS $$
SELECT (EXTRACT(epoch FROM $1) / 86400) + 25569
$$
LANGUAGE SQL IMMUTABLE PARALLEL SAFE;
CREATE OR REPLACE FUNCTION excel_time(in timestamptz, out double precision)
AS $$
SELECT (EXTRACT(epoch FROM $1) / 86400) + 25569
$$
@mastersign
mastersign / XTerm.jsx
Created December 1, 2023 11:34
XTermJS for React 18
import { useEffect, useRef } from 'react'
import PropTypes from 'prop-types'
import { Terminal } from 'xterm'
import { Unicode11Addon } from 'xterm-addon-unicode11'
import { CanvasAddon } from 'xterm-addon-canvas'
import { WebglAddon } from 'xterm-addon-webgl';
import { WebLinksAddon } from 'xterm-addon-web-links'
import FontFaceObserver from 'fontfaceobserver'
import 'xterm/css/xterm.css'
@mastersign
mastersign / dewpoint.js
Created October 16, 2022 09:12
Dewpoint
function dewpoint(tempCelsius, relHumidity) {
const a = tempCelsius < 0 ? 7.6 : 7.5
const b = tempCelsius < 0 ? 240.7 : 237.3
const sdd = 6.1078 * Math.pow(10, (a * tempCelsius) / (b + tempCelsius))
const dd = relHumidity / 100 * sdd
const v = Math.log10(dd / 6.1078)
const dewPointCelsius = b * v / (a - v)
return dewPointCelsius
}
@mastersign
mastersign / YAML-Mode.xshd
Created February 21, 2022 08:10
YAML syntax grammar for AvalonEdit
<?xml version="1.0"?>
<!-- Imperfect syntax grammar for YAML by Tobias Kiertscher <[email protected]> -->
<SyntaxDefinition xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008"
name="YAML" extensions=".yaml,.yml">
<Color name="Comment" foreground="LightSlateGray" fontStyle="italic" />
<Color name="String" foreground="DarkGreen" fontWeight="normal" />
<Color name="Array" foreground="DarkMagenta" fontWeight="bold" />
<Color name="MultilineStringIndicator" foreground="DarkMagenta" fontWeight="bold" />
<Color name="MapKey" foreground="Firebrick" />
@mastersign
mastersign / restart-remote-service.ps1
Created May 30, 2021 10:41
Restart Windows Service on Remote Host
param (
$Host,
$User = "Administrator",
$Service
)
$driveName = "tmpRemoteConnDrive"
$cred = Get-Credential -Credential "$Host\$User"
New-PSDrive -Name $driveName -PSProvider FileSystem -Root "\\$Host\c`$" -Credential $cred
Get-Service -ComputerName $Host $Service | Restart-Service
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace Mastersign.Playground.Hosted.Cli
{
public class CliService : IHostedService
{
private ILogger Log { get; }
@mastersign
mastersign / FiveThree.json
Created November 6, 2020 13:35
PowerToys - Fancy Zones
{
"uuid": "{B5D3F76E-9611-4BD5-83A5-3778BEFDDE0C}",
"name": "FiveThree",
"type": "grid",
"info":
{
"rows": 4,
"columns": 6,
"rows-percentage": [3300, 1700, 1600, 3400],
"columns-percentage": [2000, 2000, 1000, 1000, 2000, 2000],
@mastersign
mastersign / generate-cert.cmd
Created June 25, 2019 09:13
NGiNX reverse proxy
@ECHO OFF
SETLOCAL
SET COUNTRY=DE
SET STATE=Bundesland
SET LOCATION=Stadtname
SET ORG=Unternehmen
SET ORG_UNIT=Abteilung
SET COMMON_NAME=servername.unternehmen.de
@mastersign
mastersign / ConvertTo-BatchFile.cmd
Last active September 7, 2023 21:26
Wrapping PowerShell script into Batch file
<#
.SYNOPSIS
Konvertiert ein PowerShell-Skript in eine Batch-Datei
.DESCRIPTION
Dieses Skript nimmt eine PowerShell-Datei entgegen und kopiert sie in eine
Batch-Datei. Die Kopie wird dabei um einen Header ergänzt, der, als Batch
aufgerufen, das ursprüngliche Skript wieder in eine temporäre Datei
extrahiert und per PowerShell ausführt.

After Upgrade

  • Switch to window manager Ubuntu (Gnome 3 on Xorg) during login
  • Uninstall Unity: sudo apt purge unity -y && sudo apt autoremove -y

Disable Desktop Animations in Gnome 3

sudo apt install dconf-editor
dconf-editor # /org/gnome/desktop/interface/enable-animations