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',
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:
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({ |
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 |
#!/bin/bash | |
sh <(curl -sL https://gist.githubusercontent.com/cstrap/39459fdc0ffab9405166596c8969d3be/raw/e5932f9923e57dcb41db32fe5bed9acc6d584be4/fix_virtualenv) |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
/* | |
== Adapted from the code over at https://gist.github.com/graymouser/a33fbb75f94f08af7e36 == | |
Log into your account at packtpub.com and save the cookies with the "cookies.txt" Chrome extension or the "Export cookies" Firefox extension into the file cookies.txt. | |
Then open the console in your browsers dev tools and paste the following code. | |
You will get a list of wget commands that you can copy and paste as a whole into a terminal to download all books. | |
Example: wget --load-cookies=cookies.txt --content-disposition "https://packtpub.com//ebook_download/20217/mobi" -O "R Data Visualization Cookbook.mobi" | |
If you only want some filetypes, edit the "pattern" vaiable accordingly. |
#!/bin/bash | |
# | |
# Copy data from a Time Machine volume mounted on a Linux box. | |
# | |
# Usage: copy-from-time-machine.sh <source> <target> | |
# | |
# source: the source directory inside a time machine backup | |
# target: the target directory in which to copy the reconstructed | |
# directory trees. Created if it does not exists. | |
# |