This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
| #coding:utf-8 | |
| ''' | |
| python图片处理 | |
| @author:fc_lamp | |
| @blog:http://fc-lamp.blog.163.com/ | |
| ''' | |
| import Image as image | |
| #等比例压缩图片 | |
| def resizeImg(**args): |
| -server | |
| -Xms2048m | |
| -Xmx2048m | |
| -XX:NewSize=512m | |
| -XX:MaxNewSize=512m | |
| -XX:PermSize=512m | |
| -XX:MaxPermSize=512m | |
| -XX:+UseParNewGC | |
| -XX:ParallelGCThreads=4 | |
| -XX:MaxTenuringThreshold=1 |
| # Set up a new VPS for Framework (Ubuntu 12.04) | |
| 1. Add personal user | |
| * Add user to 'admin/sudo' and 'www-data' groups | |
| sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install python-software-properties -y && sudo add-apt-repository ppa:keithw/mosh -y && sudo apt-get update && sudo apt-get install mosh -y && sudo tasksel && sudo apt-get install php5 php5-gd php5-mysql php5-curl php5-cli php5-cgi php5-dev -y && sudo a2enmod rewrite expires headers mime deflate filter && sudo service apache2 restart && sudo apt-get install phpmyadmin -y && sudo apt-get install vim -y && sudo apt-get install git-core git-gui git-doc -y && cd ~ && mkdir ~/.ssh | |
| cd ~/.ssh && ssh-keygen -t rsa -C "[email protected]" && git config --global user.name "Ryan Frankel" && git config --global user.email "[email protected]" | |
| sudo apt-add-repository ppa:chris-lea/node.js -y && sudo apt-get update && sudo apt-get install nodejs -y && sudo aptitude install npm -y && sudo npm install -g less && git clone https://gi |
| """ | |
| Use a Counter to find the most common words in "The Wonderful Wizard of Oz" by | |
| L. Frank Baum. | |
| Available in (mostly) plain text at: | |
| https://archive.org/stream/wonderfulwizardo00baumiala/wonderfulwizardo00baumiala_djvu.txt | |
| Note: This code also counts the words in the header, so it's not a *realistic* | |
| applicaton, but more of a demonstration of python's Counter. |
| #! /usr/bin/env python | |
| # coding=utf-8 | |
| __author__ = 'jszhou' | |
| from bottle import * | |
| import hashlib | |
| import xml.etree.ElementTree as ET | |
| import urllib2 | |
| # import requests | |
| import json |
| # Originally from http://sharebear.co.uk/blog/2009/09/17/very-simple-python-caching-proxy/ | |
| # | |
| # Usage: | |
| # A call to http://localhost:80000/example.com/foo.html will cache the file | |
| # at http://example.com/foo.html on disc and not redownload it again. | |
| # To clear the cache simply do a `rm *.cached`. To stop the server simply | |
| # send SIGINT (Ctrl-C). It does not handle any headers or post data. | |
| import BaseHTTPServer | |
| import hashlib |
| #!/usr/bin/env python | |
| #-*- coding: utf8 -*- | |
| # by c2249f8c70c4870ea670dc691ca4a64e | |
| import os | |
| import sys | |
| import tempfile | |
| import pickle | |
| import yaml | |
| from dropbox.client import DropboxClient |
Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.
If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.
Problem: When linking to the raw version of a gist, the link changes with each revision.
Solution:
To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/
To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]