npm init -y
Create a folder called src and add an empty index.js file. The code that webpack compiles goes in here including any Javascript modules and the main Tailwind file.
| # Decrypt password-protected PDF in Python. | |
| # cleaned-up version of http://stackoverflow.com/a/26537710/329263 | |
| # | |
| # Requirements: | |
| # pip install PyPDF2 | |
| # | |
| # Usage: decrypt_pdf('encrypted.pdf', 'decrypted.pdf', 'secret_password') | |
| import sys | |
| from PyPDF2 import PdfFileReader, PdfFileWriter |
| sudo apt-get install jpegoptim optipng | |
| find . -type f -name "*.jpg" -exec jpegoptim {} \; | |
| find . -type f -name "*.png" -exec optipng {} \; | |
| find . -type f -name "*.jpeg" -exec jpegoptim {} \; | |
| --- | |
| sudo apt-get install imagemagick | |
| find . -type f -size +1000k -name "*.jpg" -exec convert {} -resize "2048>x2048>" {} \; | |
| find . -type f -size +1000k -name "*.jpeg" -exec convert {} -resize "2048>x2048>" {} \; | |
| find . -type f -size +1000k -name "*.png" -exec convert {} -resize "2048>x2048>" {} \; |
| #!/usr/bin/env zsh | |
| if [[ $# != 1 ]]; then | |
| cat - << USAGE | |
| Usage: `basename $0` <branch> | |
| USAGE | |
| return 1 | |
| fi | |
| local old_branch=$(git rev-parse --abbrev-ref HEAD) |
| from PIL import Image | |
| backgroundColor = (0,)*3 | |
| pixelSize = 9 | |
| image = Image.open('input.png') | |
| image = image.resize((image.size[0]/pixelSize, image.size[1]/pixelSize), Image.NEAREST) | |
| image = image.resize((image.size[0]*pixelSize, image.size[1]*pixelSize), Image.NEAREST) | |
| pixel = image.load() |
| #!/bin/sh | |
| wget -O xml/top_albums.xml http://itunes.apple.com/tw/rss/topalbums/limit=300/explicit=true/xml | |
| wget -O xml/new_releases.xml http://itunes.apple.com/WebObjects/MZStore.woa/wpa/MRSS/newreleases/sf=143470/limit=300/rss.xml | |
| wget -O xml/just_added.xml http://itunes.apple.com/WebObjects/MZStore.woa/wpa/MRSS/justadded/sf=143470/limit=300/rss.xml | |
| wget -O xml/featured_albums.xml http://itunes.apple.com/WebObjects/MZStore.woa/wpa/MRSS/featuredalbums/sf=143470/limit=300/rss.xml |
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)
Sister Document - Restore MySQL from Amazon S3 - read that next
this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc
| LOGGING = { | |
| 'version': 1, | |
| 'disable_existing_loggers': False, | |
| 'formatters': { | |
| 'verbose': { | |
| 'format': "%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]" | |
| }, | |
| }, | |
| 'handlers': { | |
| 'fluentinfo':{ |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!