from django.http import HttpResponse
from .utils import queryset_to_workbook
def download_workbook(request):
queryset = User.objects.all()
columns = (
'first_name',
'last_name',
'email',
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Source code from this gist: https://gist.github.com/javilobo8/097c30a233786be52070986d8cdb1743 | |
Thanks also and other contributors with their comments. | |
https://medium.com/@drevets/you-cant-prompt-a-file-download-with-the-content-disposition-header-using-axios-xhr-sorry-56577aa706d6 | |
https://stackoverflow.com/questions/41938718/how-to-download-files-using-axios | |
*/ | |
/************************ |
Say you're running a virtual machine on your work computer. Say this machine, for whatever reason, can only connect to the internet over NAT - as in, it does not get it's own IP address. Say this VM is running a webserver, and you need a device outside of your computer to connect to it.
If only there was a way to get your work computer to 'share' it's network, so that you could get at that VM… Here's how you do it!
For all instructions, I assume your work computer is a mac
- Get your computer's IP address:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var kkeys = [], | |
konami = "38,38,40,40,37,39,37,39,66,65"; | |
easterEgg = function (e) { | |
kkeys.push(e.keyCode); | |
if (kkeys.toString().indexOf(konami) == 0) { | |
var ee = $('<div id="ee">TROLOLOL</div>'); | |
ee.css({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
font-size: calc(60% + 0.8vmin); | |
} | |
main { | |
max-width: 40rem; | |
margin: 0 auto; | |
} | |
* { | |
font-size: 1rem; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ZDOCKER_IMAGE=zuppalalambda | |
ZCOMMAND=$1 | |
ZENV=$2 | |
if [ $# -eq 0 ] ; then | |
echo -e "\033[0;31mNo arguments supplied\033[0m" | |
echo "Usage: ./zuppa <zappa command> <zappa environment>" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attrs = {'some_property': 'some_value'} | |
Obj = type('ObjectClassName', (object,), attrs) | |
obj = Obj() | |
print(obj.some_property) | |
# >>> some_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sh <(curl -sL https://gist.githubusercontent.com/cstrap/39459fdc0ffab9405166596c8969d3be/raw/e5932f9923e57dcb41db32fe5bed9acc6d584be4/fix_virtualenv) |
NewerOlder