Skip to content

Instantly share code, notes, and snippets.

View woehrl01's full-sized avatar
💡
Learn to be indifferent to what makes no difference.

Lukas Wöhrl woehrl01

💡
Learn to be indifferent to what makes no difference.
View GitHub Profile
@woehrl01
woehrl01 / nuget-github-config.yml
Last active July 21, 2021 11:23
GitHub Action Nuget restore configuration
# This gist demonstrated how you can configure NuGet source without storing the credentials in plaintext on the disc
# We enable this by only storing references to environment variables into the NuGet configuration (%NUGET_USERNAME%)
name: Configure NuGet source on private GitHub package repository
jobs:
build:
env:
NUGET_USERNAME: ${{ secrets.NUGET_USERNAME }} #Needs to be the user associated with the personal access token (PAT)
NUGET_PATTOKEN: ${{ secrets.NUGET_PATTOKEN }} #PAT only needs the read:packages scope
NUGET_GITHUB_ORGANISATION: ${{ github.repository_owner }} #Name of the organization where the feed is stored
@woehrl01
woehrl01 / rename_logitech_c930c.reg
Last active May 5, 2020 11:27
Changes the friendly name of the chinese version of the Logitech C930e (C930c) to a more western friendly name. 罗技高清网络摄像机 C930c to Logitech C930c. NO GAURANTEE. APPLY AT YOUR OWN RISK.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\SWD\MMDEVAPI\{0.0.1.00000000}.{f59573dc-ac67-4ee2-9437-b754d9648217}]
"FriendlyName"="Mikrofon (Logitech C930c)"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_046D&PID_0891&MI_00\9&1dbb0716&0&0000]
"FriendlyName"="Logitech C930c"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_046D&PID_0891&MI_02\9&1dbb0716&0&0002]
"FriendlyName"="Logitech C930c"
# based on https://gallery.technet.microsoft.com/scriptcenter/Get-FileMetaData-3a7ddea7
function Get-FileMetaData
{
<#
.SYNOPSIS
Get-FileMetaData returns metadata information about a single file.
.DESCRIPTION
This function will return all metadata information about a specific file. It can be used to access the information stored in the filesystem.
@woehrl01
woehrl01 / Convert-Video-To-Mp3.ps1
Last active January 28, 2022 16:32
Convert Video to Mp3 with Powershell and VLC Player
#based on http://www.andrewconnell.com/blog/Converting-all-your-non-MP3-files-to-MP3s-with-VLC-PowerShell-and-TagLib
#don't worry if there are errors shown in VLC this is perfectly fine.
#there isn't any progress shown. Simply wait for completion.
function ConvertToMp3 ($inputObject, [switch]$isRemoveOldFile = $false)
{
$vlc = "C:\Program Files\VideoLAN\VLC\vlc.exe"
$codec = 'mp3';
$oldFile = $inputObject;
insert into sym_load_filter (load_filter_id, load_filter_type, handle_error_script, source_node_group_id, target_node_group_id, create_time, last_update_time)
values
('unqiue_error_fixer', 'BSH', '', 'central', 'mobil', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
update sym_load_filter set last_update_time = CURRENT_TIMESTAMP, handle_error_script =
'
//this deletes the conflicting row, so that it can insert the incoming row
import java.util.regex.Pattern;
import java.util.regex.Matcher;
-- The following statements are from multiple sources
-- I'm not exactly sure where each one is coming from
-- Created it a few years ago, and refound it deep on my hd
-- Web sources must be:
-- blog.sqlauthority.com, www.brentozar.com
-- And books like:
-- "SQL Performance Explained", "SQL Server Query Performance Tuning Distilled"
-- "Professional SQL Server 2008 Internals and Troubleshooting", "SQL Tuning", etc.
with fragments as (SELECT dbschemas.[name] as 'Schema',
MIT Licence
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 
associated documentation files (the "Software"), to deal in the Software without restriction, including 
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to 
the following conditions: The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 
@woehrl01
woehrl01 / SequentialGUID_SqlServer.sql
Last active August 29, 2015 11:12
Generation of a sequential GUID on SqlServer
-- Sequential GUID generation for MS SqlServer (2005+)
-- Can be used in DEFAULT expression
-- idea based on http://www.codeproject.com/Articles/388157/GUIDs-as-fast-primary-keys-under-multiple-database
-- helper view required due to usage limitations of crypt_gen_random inside UDF
CREATE VIEW dbo.RandomBytesForSequentialGuidHelperView
AS
SELECT CRYPT_GEN_RANDOM(10) randomResult
GO
@woehrl01
woehrl01 / SequentialGUID_Sqlite.sql
Last active August 29, 2015 09:53
Generation of a sequential GUID on Sqlite
-- Sequential GUID generation for SQLite (3.8.3 or greater)
-- Can be used in DEFAULT expression (remember to suround with "()" )
-- see http://www.codeproject.com/Articles/388157/GUIDs-as-fast-primary-keys-under-multiple-database
select
substr(printf('%014X', (strftime('%s', 'now') * 1000 + substr(strftime('%f','now'), 4, 3))), 3, 8)
|| '-'
|| substr(printf('%014X', (strftime('%s', 'now') * 1000 + substr(strftime('%f','now'), 4, 3))), 11, 4)
|| '-'
@woehrl01
woehrl01 / gist:b4cbbe934e0b2f8f3b1d
Last active August 29, 2015 14:01
Servicestack Exception to SoapException
/* Small snipped to transform a ServiceException into a SoapException if called from a SoapClient.
* So you don't have to check the ReturnCode value of ResponseStatus for errors.
* Feel free to use, edit, share, improve this one.
*/
using System.ServiceModel;
public override void Configure(Funq.Container funq)
{