Skip to content

Instantly share code, notes, and snippets.

View SeriousM's full-sized avatar
🌟
Focusing

Bernhard Millauer SeriousM

🌟
Focusing
View GitHub Profile
@SeriousM
SeriousM / gist:fd6091ac72501405fb2ed82b4cc0d421
Created April 2, 2016 17:54
Kill steam.exe on Windows Shutdown/Restart
Task Scheduler
Name: Kill SteamApp on Shutdown or Restart
Trigger:
When: On an Event
Log: System
Source: USER32
EventID: 1074
Start a program:
Program/Script: taskkill
Arguments: /f /t /im Steam.exe
using System;
using System.Runtime.InteropServices;
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable InconsistentNaming
namespace VideoPlayerController
{
/// <summary>
/// Controls audio using the Windows CoreAudio API
/// from: http://stackoverflow.com/questions/14306048/controling-volume-mixer
@SeriousM
SeriousM / introrx.md
Created January 26, 2016 17:49 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
To catch errors during script execution:
WHENEVER SQLERROR EXIT FAILURE
@SeriousM
SeriousM / .md
Last active February 14, 2022 14:39
Logout all users from meteor application
@SeriousM
SeriousM / gist:28c8142fe38a3550f76c
Created April 16, 2015 21:56
Installing ungit on ubuntu (-like) os
nodejs is called differently on ubunto (for whatever reason) - https://github.com/FredrikNoren/ungit/issues/401
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo -H npm install -g ungit
@SeriousM
SeriousM / gist:ed5a0dc0ed5d9a8e09b9
Created April 14, 2015 12:51
VS2013+ magic/pseudo variables
in the watch window or quickwatch:
"$exception": the current exception that is currently available. it has a much better debug experience in the quickwatch because it can look into the exception's type
"{num}#": eg "1#". this is a reference to an object with ObjectId. it acts as a weak-reference and does not affect the GC'ability of the object. http://blogs.msdn.com/b/zainnab/archive/2010/03/04/make-objectid-vstipdebug0015.aspx
"$ReturnValue": contains the return value from the last exited method. The autos-window contains a much better display of that. http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/27/seeing-function-return-values-in-the-debugger-in-visual-studio-2013.aspx
"$user": displays the information about the current user - eg to check for permissions, impersonations, etc
"{number-variable},h": displays the variable as hex
"{number-variable},d": displays the variable as decimal/number
@SeriousM
SeriousM / 2012-and-later.sql
Created August 13, 2014 13:37
TSQL Rethrow Exception
BEGIN TRY
...
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
THROW;
END CATCH
@SeriousM
SeriousM / readme.md
Created August 8, 2014 11:28
Extract Generic Type Definition in C#
void Main()
{
	GetTypeFromList(new List<string>()).Dump();
	GetTypeFromFunc((string s, int i) => true).Dump();
}

public Type GetTypeFromList<TType>(IEnumerable<TType> dummy)
{
	return typeof(TType);