Skip to content

Instantly share code, notes, and snippets.

View dumbledad's full-sized avatar

Tim Regan dumbledad

View GitHub Profile
@dumbledad
dumbledad / NuniqueGroupbyOverwrite.py
Last active July 15, 2019 16:40
Why does nunique overwrite the grouping column in pandas
import pandas as pd
import numpy as np
df = pd.DataFrame({'user_id':[1,1,1,2,2,2],'module_id':[1,2,3,1,1,2]})
print(df)
print(df.groupby('user_id', as_index=False).sum())
print(df.groupby('user_id', as_index=False).nunique())
@dumbledad
dumbledad / ResponseComparison.txt
Created July 28, 2016 14:33
Comparing the response written in ASP.Net Core with the one actually received
Startup.cs
var responseText = new ExceptionResponse(statusCode, ex).ToString();
await context.Response.WriteAsync(responseText);
responseText is set to:
"{\"ExceptionType\":\"SecurityTokenExpiredException\",\"Message\":\"IDX10223: Lifetime validation failed. The token is expired.\\nValidTo: '07\\/23\\/2016 02:03:48'\\nCurrent time: '07\\/28\\/2016 14:20:17'.\",\"StackTrace\":\" at Blah.Startup.<>c.<Configure>b__6_1(AuthenticationFailedContext context) in D:\\\\Users\\\\me\\\\Source\\\\Repos\\\\ServerSideCode\\\\Blah\\\\Startup.cs:line 118\\r\\n at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.<HandleAuthenticateAsync>d__1.MoveNext()\\r\\n--- End of stack trace from previous location where exception was thrown ---\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\\r\\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.<Initia
@dumbledad
dumbledad / Startup.cs
Last active September 24, 2018 01:23
Debugging CGI error on swapping from ASP .Net Core 1.0.0-rc2-final to 1.0.0 causes
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using ThingaMeASPy8s.Settings;
using ThingaMeASPy8s.Exceptions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Http;
using Microsoft.ApplicationInsights.AspNetCore;
@dumbledad
dumbledad / DXAML2.vcxproj
Created December 27, 2013 14:23
Problematic VC++ project file that I am asking about on SO http://stackoverflow.com/q/20526080/575530
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Profile|ARM">
<Configuration>Profile</Configuration>
<Platform>ARM</Platform>