A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
#! /usr/bin/env python | |
import fileinput | |
import argparse | |
from operator import itemgetter | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int) | |
parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+') | |
args = parser.parse_args() |
import requests | |
nList= [] | |
nProxL = '' | |
file = open('proxy.txt') | |
for line in file: | |
try: | |
aproxy = line.strip('\n') | |
user_agent = {'User-agent': 'Mozilla/5.0'} | |
print aproxy | |
proxies = { |
#!/bin/sh | |
# This script will migrate schema and data from a SQLite3 database to PostgreSQL. | |
# Schema translation based on http://stackoverflow.com/a/4581921/1303625. | |
# Some column types are not handled (e.g blobs). | |
SQLITE_DB_PATH=$1 | |
PG_DB_NAME=$2 | |
PG_USER_NAME=$3 |
#!/bin/bash | |
# This script will migrate schema and data from a SQLite3 database to PostgreSQL. | |
# Schema translation based on http://stackoverflow.com/a/4581921/1303625. | |
# Some column types are not handled (e.g blobs). | |
# | |
# See also: | |
# - http://stackoverflow.com/questions/4581727/convert-sqlite-sql-dump-file-to-postgresql | |
# - https://gist.github.com/bittner/7368128 |
#views.py | |
class TaskUpdateView(generic.UpdateView): | |
model = Task | |
form_class = TaskForm | |
@json_view | |
def dispatch(self, *args, **kwargs): | |
return super(TaskUpdateView, self).dispatch(*args, **kwargs) | |
#! /bin/sh | |
usage_error () { | |
echo 'Usage: sh migrator.sh <path to sqlite_to_postgres.py> <path to sqlite db file> <an empty dir to output dump files>' | |
echo | |
echo 'Example:' | |
echo '>sh migrator.sh sqlite_to_postgres.py ~/reviewboard.db /tmp/dumps' | |
echo | |
echo 'Tested on:' | |
echo 'Python 2.7.3' |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import signal | |
from os import system | |
### MENU ### | |
# Here are all the elements you can import | |
# Box elements |
—— BEGIN LICENSE —— | |
Michael Barnes | |
Single User License | |
EA7E-821385 | |
8A353C41 872A0D5C DF9B2950 AFF6F667 | |
C458EA6D 8EA3C286 98D1D650 131A97AB | |
AA919AEC EF20E143 B361B1E7 4C8B7F04 | |
B085E65E 2F5F5360 8489D422 FB8FC1AA | |
93F6323C FD7F7544 3F39C318 D95E6480 | |
FCCC7561 8A4A1741 68FA4223 ADCEDE07 |
1. select keymap | |
2. disk partitions | |
3. configure mirror list | |
4. base system install | |
5. configure fstab | |
6. configure hostname | |
7. configure locale | configure timezone | |
8. configure hardclock | |
9. configure network | |
10. configure pacman |