Skip to content

Instantly share code, notes, and snippets.

hansschmucker

Block or report user

Report or block hansschmucker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hansschmucker
hansschmucker / c#.cmd
Last active Aug 29, 2015
Compiles C# code piped to it and runs it immediately without a temporary EXE. Prefix "@" if you want to describe a whole class, not just the content of main.
View c#.cmd
@PowerShell -command "$src=''+$input; if ( $src -match '^[\s]*@([\s\S]*)$' ){ $src=$matches[1]; }else{ $src='using System; public class App { public static void Main() { '+$src+' } } '; } $opt = New-Object System.CodeDom.Compiler.CompilerParameters; $opt.GenerateInMemory = $true; $cr = [System.CodeDom.Compiler.CodeDomProvider]::CreateProvider('CSharp').CompileAssemblyFromSource($opt, $src); if($cr.CompiledAssembly) {$obj = $cr.CompiledAssembly.CreateInstance('App'); $obj.GetType().GetMethod('Main').Invoke($obj, $null);}else{ $cr.errors; }"
@hansschmucker
hansschmucker / c#.ps1
Created Sep 4, 2014
Source for a minimal C# compiler for use in batch files see https://gist.github.com/hansschmucker/820d3bdeca34c665b77a
View c#.ps1
$opt = New-Object System.CodeDom.Compiler.CompilerParameters;
$opt.GenerateInMemory = $true;
$cr = [System.CodeDom.Compiler.CodeDomProvider]::CreateProvider("CSharp").CompileAssemblyFromSource($opt, "public class App { public static void Main() { "+ $input+" } }");
if($cr.CompiledAssembly){
$obj = $cr.CompiledAssembly.CreateInstance("App");
$obj.GetType().GetMethod("Main").Invoke($obj, $null);
}else{
$cr.errors;
}
View resolution.cmd
@ECHO OFF
SETLOCAL
SET RES_X=%1
SET RES_Y=%2
echo @^
using System.Runtime.InteropServices;^
[StructLayout(LayoutKind.Sequential)]^
public struct DispSet {^
[MarshalAs(UnmanagedType.ByValArray,SizeConst=106)]^
byte[] padding0;^
@hansschmucker
hansschmucker / swrplayer.user.js
Created Dec 11, 2014
Replace SWR error message at http://mp3-live.swr.de/ with player links.
View swrplayer.user.js
// ==UserScript==
// @name SWR Radio M3U
// @namespace de.schmucker-partner.swr.m3u
// @include http://mp3-live.swr.de/
// @version 1
// @grant none
// ==/UserScript==
var urls = [
'http://mp3-live.swr.de/swr1bw_m.m3u',
'http://mp3-live.swr.de/swr1rp_m.m3u',
View userChrome.css
#navigator-toolbox{
background:transparent;
}
#navigator-toolbox > *{
background:#999;
}
#navigator-toolbox {
position: relative;
You can’t perform that action at this time.