Skip to content

Instantly share code, notes, and snippets.

View OdinsHat's full-sized avatar
💭
Open to job offers

Doug OdinsHat

💭
Open to job offers
View GitHub Profile
@OdinsHat
OdinsHat / getstockfile.py
Last active August 29, 2015 14:02
Quick script written for reading our many company email for stock status updates from Kidkraft and then downloading the attached xlsx file for processing
#!/usr/bin/env python
import email
import imaplib
import os
import sys
detach_dir = '.' # directory where to save attachments (default: current)
files = os.listdir('.')
@OdinsHat
OdinsHat / setuplemp.sh
Created June 25, 2014 16:25
Quick instructions/script okn installing LEMP stack via homebrew
#!/bin/sh
### Install LEMP Stack on OSX Mavericks
# Make sure xcode CLI tools installed
xcode-select --install
# Install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
# Install nginx
@OdinsHat
OdinsHat / setup.sh
Created October 8, 2014 19:52
Local Dev Setup
#### NOTES: ####
# UNDER DEVELOPMENT
#Chrome
#Opera
#Firefox
# HomeBrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@OdinsHat
OdinsHat / Magento.md
Last active April 22, 2018 07:12 — forked from grafikchaos/gist:9938618
Magento Cook book

Magento Snippets

Changing Order Status

// shipping_cdl setup in the admin area under shipping methods
$orderModel = Mage::getModel('sales/order');
$orderModel->reset()->load($orderId);
$orderModel->addStatusHistoryComment('Sent to CDL', 'shipping_cdl');
$orderModel->setStatus('shipping_cdl')->save();
@OdinsHat
OdinsHat / Gruntfile.js
Created January 18, 2015 17:14
Example Magento Gruntfile.js
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
phplint: {
local: {
files: [{
expand: true,
cwd: 'app/code/local/',
@OdinsHat
OdinsHat / bootstrap.sh
Created January 18, 2015 17:17
Example Vagrant Bootstrap file for an existing Magento install
#!/bin/sh
# Disable SELinux
sudo su
echo 0 >/selinux/enforce
setenforce Permissive
# Yum Update
sudo yum -y update
@OdinsHat
OdinsHat / copyFiles.js
Last active August 29, 2015 14:14
Simply reads a file and outputs it to console.log/stdout
var fs = require('fs');
var file = fs.createReadStream('origin.txt');
var destFile = fs.createWriteStream('destination.txt');
// Not surte why end: false required as it seems silly to close midway through copying?
file.pipe(destFile, {end: false});
file.on('end', function(){
destFile.end('Finished!');
@OdinsHat
OdinsHat / countcsvheaders.sh
Last active August 29, 2015 14:17
Count number of headers in a CSV file using the shell/terminal/console
#/bin/sh
# Count number of headers in all CSV files in the current directory
for i in `ls`; do echo $i; head -1 $i | sed 's/,/ /g' | wc -w;done
@OdinsHat
OdinsHat / MageDbExport.sh
Last active August 29, 2015 14:18 — forked from collymore/MageDbExport.sh
Run this one-liner in your Magento root to have the instaled DB dumped to the directory above with the filename the same as the dbname[.sql]
grep 'user\|dbname\|pass' app/etc/local.xml | tr -d '\n' | sed 's/<username><\!\[CDATA\[\(.*\)\]\]><\/username>.*<password><\!\[CDATA\[\(.*\)\]\]><\/password>.*<dbname><\!\[CDATA\[\(.*\)\]\]><\/dbname>/ mysqldump -u\1 -p\2 \3 > ..\/\3.sql/g' | sh