Skip to content

Instantly share code, notes, and snippets.

@Averroes
Averroes / python_resources.md
Last active January 2, 2016 09:05 — forked from jookyboi/python_resources.md
Python-related modules and guides. January 2016 links updated.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@Averroes
Averroes / django_model_graph.sh
Created April 21, 2016 09:20 — forked from perrygeo/django_model_graph.sh
Generate UML diagram of django app models
apt-get install python-pygraphviz
pip install django-extensions
# add 'django_extensions' to INSTALLED_APPS in settings.py
python manage.py graph_models trees -o test.png
@Averroes
Averroes / Wordpress::WooCommerce : Remove unnecessary markup from WooCommerce
Last active August 15, 2016 06:56 — forked from retlehs/gist:4120053
Wordpress::WooCommerce : Remove unnecessary markup from WooCommerce
<?php
/**
* Remove unnecessary markup from WooCommerce:
*
* 1. Remove <meta name="generator" content="WooCommerce (version)" />
* 2. Remove the addition of <body class="theme-themename">
*/
function woocommerce_head_cleanup() {
global $woocommerce;
@Averroes
Averroes / remove-all-product-categories-tags.php
Created January 16, 2017 10:10 — forked from mikaelz/remove-all-product-categories-tags.php
Remove all WooCommerce product categories and tags
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE a,c FROM wp_terms AS a
LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id
LEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id
WHERE c.taxonomy = 'product_tag'");
$wpdb->query("DELETE a,c FROM wp_terms AS a
LEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_id
@Averroes
Averroes / delete-all-woocommerce-products.php
Created January 18, 2017 18:03 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");
@Averroes
Averroes / gist:a1588749f370f3daa1e456088a212030
Created February 24, 2017 08:31 — forked from super3/gist:7173942
Linux Quick Guide

Extract Emails from a File:

grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+\b" data.txt | sort -u > emails.txt

// iMacro CheatSheet - Command Reference
// http://wiki.imacros.net/Command_Reference
// iMacros supports 3 types of variables:
// * The macro variables !VAR0 thru !VAR9. They can be used with the SET and ADD command inside a macro.
// * Built-in variables. They contain certain values set by iMacros.
// * User-defined variables. They are defined in-macro using the SET command.
@Averroes
Averroes / screen-cheatsheet.sh
Created March 8, 2017 10:19
Screen Management CheatSheet for UNIX Systems
# Screen Management CheatSheet for UNIX Systems
# http://www.tecmint.com/screen-command-examples-to-manage-linux-terminals/
# 1. Installing.
apt-get install screen # Debian based Systems
yum install screen # RedHat based Systems
@Averroes
Averroes / bash-cheatsheet.sh
Created March 8, 2017 10:21 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
// iMacros Bootstrap - Write your macros with JavaScript.
// Be careful, you need to rename and set the extension of your macro to ".js".
// 1. Variables Initialization.
var variable1, variable2, variable3;
macro = "";