Skip to content

Instantly share code, notes, and snippets.

# https://hakibenita.com/fast-load-data-python-postgresql
from typing import Iterator, Dict, Any, Optional
from urllib.parse import urlencode
import datetime
#------------------------ Profile
import time
@omz
omz / PythonistaBackup.py
Last active January 6, 2024 05:44
PythonistaBackup.py
# coding: utf-8
'''Creates a zip archive of your Pythonista files and serves them via HTTP in your local network.'''
import sys
if sys.version_info[0] >= 3:
from http.server import SimpleHTTPRequestHandler, HTTPServer
else:
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
@DavidWittman
DavidWittman / notes.md
Created February 22, 2012 18:54
A Brief Introduction to Fabric

A Brief Introduction to Fabric

Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:

for s in $(cat servers.txt); do ssh $s service httpd graceful; done

Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.

@ThinkCode
ThinkCode / search.py
Created August 1, 2011 21:26 — forked from GaretJax/search.py
Search for Keyword in Text File and return line number
import os, sys
import re, MySQLdb
db = MySQLdb.connect("localhost","testuser","test123","TESTDB" )
#
# MySQL Code
# CREATE TABLE keyword (keywordid integer primary key auto_increment, keyword VARCHAR(255) NOT NULL);
#
# CREATE TABLE location (companyid integer, pdfid integer, keywordid integer references keyword(keywordid),