"easeInSine": cubic-bezier(0.12, 0, 0.39, 0),
"easeOutSine": cubic-bezier(0.61, 1, 0.88, 1),
"easeInOutSine": cubic-bezier(0.37, 0, 0.63, 1),
"easeInQuad": cubic-bezier(0.11, 0, 0.5, 0),
"easeOutQuad": cubic-bezier(0.5, 1, 0.89, 1),
"easeInOutQuad": cubic-bezier(0.45, 0, 0.55, 1),
"easeInCubic": cubic-bezier(0.32, 0, 0.67, 0),| cat access.log | grep 404 | awk '{print $7}' | sort | uniq -c | sort -nr | head -n 100 |
| find . -type d -name "node_modules" -prune -exec du -sh {} \; | sort -nrk1 | |
| # find directories matching the name `node_modules` | |
| # prune out unnecessary entries from within top-level `node_modules` results | |
| # run `du` against the results to calculate size | |
| # pipe to sort, first column as key, reverse natural |
This provides a new site with a unique IAM access key/secret that allows read/write access to a single S3 bucket, e.g. to allow a Django site to upload media files. This assumes the bucket itself has already been created.
Note: I originally created this gist as a note-to-self so conventions shown here are particular to my setup; YMMV.
- Log in to the AWS Console and head to the IAM section
- Click Users to access the IAM user list
- Click Add User
- Enter username in the format of
sitename-s3(replacingsitename)
| from django.conf import settings | |
| from django.core.management.base import BaseCommand, CommandError | |
| from os.path import join | |
| from urllib import urlretrieve | |
| class Command(BaseCommand): | |
| help = 'Imports translations from Loco' | |
| def handle(self, *args, **options): |
I hereby claim:
- I am BigglesZX on github.
- I am biggleszx (https://keybase.io/biggleszx) on keybase.
- I have a public key whose fingerprint is 0361 EC11 E816 C0A0 C151 859B 36CB 1F0D BFFB 46BF
To claim this, I am signing this object:
| import os | |
| from PIL import Image | |
| ''' | |
| I searched high and low for solutions to the "extract animated GIF frames in Python" | |
| problem, and after much trial and error came up with the following solution based | |
| on several partial examples around the web (mostly Stack Overflow). | |
| There are two pitfalls that aren't often mentioned when dealing with animated GIFs - |
| import Image | |
| import ImageFont, ImageDraw | |
| from django.conf import settings | |
| from django.http import HttpResponse | |
| from os.path import join | |
| def emailshield(request): | |
| address = 'info@example.com' | |
| # change the path below to a TTF file you want to use | |
| font = ImageFont.truetype(join(settings.PROJECT_ROOT, 'static', 'Vera.ttf'), 14) |
Dreamhost supplies a fairly old version of Python in their shared hosting environments. It recently became necessary for me to use a newer version, and since this involved a bit of juggling, and since I’m also likely to forget how I did it, I thought I’d detail the steps here. These instructions should work with any Dreamhost shared hosting user, but follow them at your own risk.
The end result of this process is being able to run a current version of Python from your shared hosting user’s shell. It requires compiling, installing and running Python from your home directory rather than the system bin directories.
1. Create a helpful working directory
I chose to install all Python-related stuff in a python/ directory under my user’s home directory.
$ mkdir ~/python
$ cd ~/python
| <?php | |
| // | |
| // some useful regular expressions and sample usage | |
| // | |
| // convert Twitter usernames into profile links | |
| // cred. Simon Granade (http://bit.ly/FihuS) | |
| $text = preg_replace('/(^|\s)@(\w+)/', | |
| '\1@<a href="http://twitter.com/\2">\2</a>', $text; |