This is for all of the little things I forget to do even though I shouldn't.
- Unpack firefox in
/opt
# update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/firefox/firefox 100
- Boot into a LiveCD
MySQLdb is a Python wrapper around _mysql written by Andy Dustman. This wrapper makes it possible to interact with a MySQL Server performing all sorts of DDL and DML statements. I began my Python journey recently and stumbled at the installation of the MySQLdb module install. I was keen not to jump at an apt/yum installation as we have servers that have no outbound connections I decided I wanted to build the module from source.
You can download the MySQLdb files from SourceForge (70kb)
When downloaded you need to prep before your system is ready to build the file. Here are some prerequisites that will make life easier for you. I performed this particular install using an Ubuntu 10.04 64bit OS.
Before you start ensure you have the following installed (MySQL isn't actually required but for local Python development it's nice to have a database server to develop against!)
from flask import Flask, jsonify | |
import threading | |
import socket | |
import time | |
app = Flask(__name__) | |
_timer = 60 * 5 | |
_timeout = 3 |
# -*- coding: utf-8 -*- | |
from flask import Flask, send_file | |
import qrcode | |
from StringIO import StringIO | |
app = Flask(__name__) | |
@app.route("/qr/<path:url>") | |
@app.route("/qr") | |
def qr_route(url="http://dongcorp.org"): |
import struct, socket, csv | |
def ip_to_decimal(ip): | |
return struct.unpack("!I", socket.inet_aton(ip))[0] | |
def read_list(ip_csv="/tmp/IpToCountry.csv"): | |
""" Read the entire IpToCountry CSV file into life. | |
:param ip_csv: the file we're reading from |
;; require'd [digest] and [base64-clj.core :as base64] | |
; This excessively large string is an SSH RSA key. | |
; You're meant to base64 decode then hash the result to get a key fingerprint. | |
(def k "AAAAB3NzaC1yc2EAAAADAQABAAABAQDt6wSbWhx/lQ1kqzqy4ET7ogSZqZngcDzaYiS8/ZWKgamkt4o9+2RebcysJT2DX/8t0Mif3jovSsUjW+6dCLY8rO0+fGMctwWL4HqAlHFgWY6xA2M4/ZLYvlm53WUKt02ygFeO9M4Fj9w9MoTRhQjS52Z6PA5OE0ppjjupvLWUp3wu23usUUWQucye50mTPBE4tZAbnh+H3w7FXTHOROsNTSuNbDYQ8pPqHy66hbJ5t2Dz5/3yTpL6mzc4rFHJPt5O8Wxlur4kzNSYlhPYsbrDoZF4lpxjdrkrE4qGxJUk48Hufr/VJ+3cafLumk7DsdVNnDeAO8lgpgXh2Hvr9ZYl") | |
(digest/md5 (base64/decode k)) ; => 8befc4d6d025ea89bd5603ea2bf7ecdd | |
; My question is this: in any other language, the above gives an output of: | |
; 287893e77d820df340d92b833e942128 | |
; I've tested (independently and together) both the md5 and base64 functions, to verify that they're not cocking up the output and spewing out random crap, but they're giving valid info |
(def in "5d41402abc4b2a76b9719d911017c592") | |
(def res "5d:41:40:2a:bc:4b:2a:76:b9:71:9d:91:10:17:c5:92") | |
; python => ':'.join(a+b for a,b in zip(a[::2], a[1::2])) | |
; (clojure.string/join ":" (map (fn [x] (clojure.string/join "" x)) (partition 2 s))) | |
(defn md5 [x] x) | |
(defn hash-to-fingerprint [k] | |
(defn shrink [x] (clojure.string/join "" x)) | |
(clojure.string/join ":" | |
(map shrink (partition 2 (md5 k))))) | |
(= (hash-to-fingerprint s) res) |
@namespace url(http://www.w3.org/1999/xhtml); | |
@-moz-document domain("facebook.com") { | |
div.seen { | |
visibility: hidden !important; | |
} | |
div._510g { | |
height: 12px; | |
} | |
} |