Skip to content

Instantly share code, notes, and snippets.

@Matthias247
Matthias247 / async_await_cancellation.md
Created May 28, 2019 06:09
Async/Await - The challenges besides syntax - Cancellation

Async/Await - The challenges besides syntax - Cancellation

This is the second article in a series of articles around Rusts new async/await feature. The first article about interfaces can be found here.

In this part of the series we want to a look at a mechanism which behaves very different in Rust than in all other languages which feature async/await support. This mechanism is Cancellation.

@jonperron
jonperron / gist:733c3ead188f72f0a8a6f39e3d89295d
Last active November 30, 2023 17:29
Serve pandas dataframe as csv with Django
from django.http import HttpResponse
import pandas as pd
def foo():
results = pd.Dataframe()
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=filename.csv'
results.to_csv(path_or_buf=response,sep=';',float_format='%.2f',index=False,decimal=",")