Skip to content

Instantly share code, notes, and snippets.

Tim Regan dumbledad

Block or report user

Report or block dumbledad

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
@dumbledad
dumbledad / NuniqueGroupbyOverwrite.py
Last active Jul 15, 2019
Why does nunique overwrite the grouping column in pandas
View NuniqueGroupbyOverwrite.py
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 / gist:bf1e4e59c87ea261182059a9d0c7d0a9
Last active Aug 26, 2018
print function seems to ignore parameter
View gist:bf1e4e59c87ea261182059a9d0c7d0a9
word = '1066AndAllTh@t'
hint = word[0:3]
print("Ah I see, you're stuck. \n"
"Have a hint.\n"
"The first three letters are", hint, ".")
@dumbledad
dumbledad / ResponseComparison.txt
Created Jul 28, 2016
Comparing the response written in ASP.Net Core with the one actually received
View ResponseComparison.txt
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 Sep 24, 2018
Debugging CGI error on swapping from ASP .Net Core 1.0.0-rc2-final to 1.0.0 causes
View Startup.cs
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 Dec 27, 2013
Problematic VC++ project file that I am asking about on SO http://stackoverflow.com/q/20526080/575530
View DXAML2.vcxproj
<?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>
You can’t perform that action at this time.