Version: 1.9.8
Platform: x86_64
First, install or update to the latest system software.
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
#!/usr/bin/python | |
# Equivalent of "tail -f" as a webpage using websocket | |
# Usage: webtail.py PORT FILENAME | |
# Tested with tornado 2.1 | |
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket | |
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/ | |
import tornado.httpserver |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class UsernameValidator{ | |
private Pattern pattern; | |
private Matcher matcher; | |
private static final String USERNAME_PATTERN = "^[a-z0-9_-]{3,15}$"; | |
import socket | |
HOST = 'localhost' | |
PORT = 9876 | |
ADDR = (HOST,PORT) | |
BUFSIZE = 4096 | |
videofile = "videos/royalty-free_footage_wien_18_640x360.mp4" | |
bytes = open(videofile).read() |
import sys | |
from urllib import urlencode | |
import requests | |
from urlparse import urlparse, parse_qs | |
from random import choice | |
import re | |
self_id = None # your facebook id here | |
utc_bday = None # utc timestamp of your birthday |
#!/usr/bin/python | |
# demo from here: http://pymotw.com/2/urllib2/index.html#uploading-files | |
import itertools | |
import mimetools | |
import mimetypes | |
from cStringIO import StringIO | |
import urllib | |
import urllib2 |
serialize: function serialize(form) | |
{ | |
if (!form || form.nodeName !== "FORM") { | |
return; | |
} | |
var i, j, | |
obj = {}; | |
for (i = form.elements.length - 1; i >= 0; i = i - 1) { | |
if (form.elements[i].name === "") { | |
continue; |
import ebaysdk | |
from ebaysdk import finding | |
api = finding(siteid='EBAY-GB', appid='<REPLACE WITH YOUR OWN APPID>') | |
api.execute('findItemsAdvanced', { | |
'keywords': 'laptop', | |
'categoryId' : ['177', '111422'], | |
'itemFilter': [ | |
{'name': 'Condition', 'value': 'Used'}, |
# For each database: | |
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; | |
# For each table: | |
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | |
# For each column: | |
ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | |
# (Don’t blindly copy-paste this! The exact statement depends on the column type, maximum length, and other properties. The above line is just an example for a `VARCHAR` column.) |
# Initialize the scroll | |
page = es.search( | |
index = 'yourIndex', | |
doc_type = 'yourType', | |
scroll = '2m', | |
search_type = 'scan', | |
size = 1000, | |
body = { | |
# Your query's body | |
}) |