For signed cookies, refer here
from cloudfront_signed_url import generate_cloudfront_signed_url
generate_cloudfront_signed_url("https://your-cf-domain.com/path/to/file.txt", 3600)| #!/usr/bin/env python3 | |
| # | |
| # Falcon + zipfile streaming content using os.pipe() to minimize RAM usage to a | |
| # pipes worth of data. | |
| # | |
| # This test program generated a nearly 500 MB zip file with various compression | |
| # arguments supported by the python3 standard library. | |
| # | |
| # Usage for debug webserver: | |
| # $ ./app.py |
For signed cookies, refer here
from cloudfront_signed_url import generate_cloudfront_signed_url
generate_cloudfront_signed_url("https://your-cf-domain.com/path/to/file.txt", 3600)| import boto3 | |
| import time | |
| region = 'eu-west-1' | |
| user_data_script = """#!/bin/bash | |
| instanceid=$(curl http://169.254.169.254/latest/meta-data/instance-id) | |
| cd / | |
| mkdir moodledata | |
| mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-xxxxxxxxxxc.efs.eu-west-1.amazonaws.com:/ moodledata | |
| tar czf mooodledata-backup-$(date +%d-%m-%Y_%H-%M).tar.gz /moodledata | |
| aws s3 mv mooodledata-backup-*.tar.gz s3://xxxxxxxxx/ |
| '''Demonstrate the "prime number conspiracy" as described at | |
| https://www.quantamagazine.org/20160313-mathematicians-discover-prime-conspiracy/ | |
| "Among the first billion prime numbers, for instance, a prime ending in | |
| 9 is almost 65 percent more likely to be followed by a prime ending in 1 | |
| than another prime ending in 9. In a paper posted online today, Kannan | |
| Soundararajan and Robert Lemke Oliver of Stanford University present | |
| both numerical and theoretical evidence that prime numbers repel other | |
| would-be primes that end in the same digit, and have varied | |
| predilections for being followed by primes ending in the other possibl |
| # -*- coding: utf-8 -*- | |
| from __future__ import print_function | |
| import json | |
| import redis | |
| r = redis.StrictRedis(host='localhost', port=6379, db=1) | |
| # List of permissions that gives us this permission | |
| PERMISSIONS_INHERITANCE = { | |
| 'bucket:write': { |
| """Demo of streaming requests with Tornado. | |
| This script features a client using AsyncHTTPClient's body_producer | |
| feature to slowly produce a large request body, and two server | |
| handlers to receive this body (one is a proxy that forwards to the | |
| other, also using body_producer). | |
| It also demonstrates flow control: if --client_delay is smaller than | |
| --server_delay, the client will eventually be suspended to allow the | |
| server to catch up. You can see this in the logs, as the "client |
| #!/usr/bin/env bash | |
| # This script prints out all of your Redis keys and their size in a human readable format | |
| # Copyright 2013 Brent O'Connor | |
| # License: http://www.apache.org/licenses/LICENSE-2.0 | |
| human_size() { | |
| awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
| } |
| ;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY | |
| ;by doppelganger (doppelheathen@gmail.com) | |
| ;This file is provided for your own use as-is. It will require the character rom data | |
| ;and an iNES file header to get it to work. | |
| ;There are so many people I have to thank for this, that taking all the credit for | |
| ;myself would be an unforgivable act of arrogance. Without their help this would | |
| ;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into | |
| ;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no |
| #!/usr/bin/env python | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may | |
| # not use this file except in compliance with the License. You may obtain | |
| # a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |