Skip to content

Instantly share code, notes, and snippets.

View OdinsHat's full-sized avatar
💭

Doug OdinsHat

💭
View GitHub Profile
@OdinsHat
OdinsHat / python_resources.md
Last active August 29, 2015 14:25 — forked from jookyboi/python_resources.md
Python-related modules and guides.

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

@OdinsHat
OdinsHat / javascript_resources.md
Last active August 29, 2015 14:25 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@OdinsHat
OdinsHat / 0_reuse_code.js
Last active August 29, 2015 14:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@OdinsHat
OdinsHat / innodb_buffer_pool_size.sql
Created July 8, 2015 15:46
Find optimum innodb_buffer_pool_size in G for my.cnf
SELECT CEILING(Total_InnoDB_Bytes*1.6/POWER(1024,3)) RIBPS FROM
(SELECT SUM(data_length+index_length) Total_InnoDB_Bytes
FROM information_schema.tables WHERE engine='InnoDB') A;
- name: Group by Distribution
hosts: all
tasks:
- group_by: key=${ansible_distribution}
- name: Set Time Zone
hosts: Ubuntu
gather_facts: False
tasks:
- name: Set timezone variables
@OdinsHat
OdinsHat / local.xml
Created June 26, 2015 08:29
Turning off all visitor logging for Magento
<frontend>
<events>
<controller_action_predispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_predispatch>
<controller_action_postdispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_postdispatch>
<customer_login>
<observers><log><type>disabled</type></log></observers>
@OdinsHat
OdinsHat / wipe_products.sql
Created June 19, 2015 14:44
Wipe Magento products
-- Wipe ALL Products
-- USE WITH CAUTION
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
@OdinsHat
OdinsHat / reset-mage-perms.sh
Created June 1, 2015 13:43
Reset the Magento permissions on a Debian or Ubuntu box assuming run in root of Mage dir
#!/bin/sh
chown -R www-data .
find . -type f -exec chmod 400 {} \;
find . -type d -exec chmod 500 {} \;
find var/ -type f -exec chmod 600 {} \;
find media/ -type f -exec chmod 600 {} \;
find var/ -type d -exec chmod 700 {} \;
find media/ -type d -exec chmod 700 {} \;
chmod 700 includes
chmod 600 includes/config.php
@OdinsHat
OdinsHat / key_error_magento.sql
Created May 29, 2015 15:53
Used this to fix key error on Magento after transferring to new server
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;
@OdinsHat
OdinsHat / iframe.php
Created May 20, 2015 11:25
iframe PHP example passing an id to iframe getting hashed value back via postrmessage
<html>
<head>
<title>The IFrame</title>
</head>
<body>
<h1>IMAGINE THIS IS PRODUCT DESIGNR</h1>
<form id="form-pdesignr">
<input type="button" value="Click Me to Post Data Up ^" />
</form>
<script>