Skip to content

Instantly share code, notes, and snippets.

How to set up a Looker cluster on Azure

Install Terraform

  1. Download terraform binary
  2. Install Azure CLI curl -L https://aka.ms/InstallAzureCli | bash
  3. Login with az login you will be taken to the browser and returned to the shell

Step 1. Create Resource Group

Step 2. Provision Compute

  • create app server looker-1
#!/bin/bash
MC_API_KEY="apikey:YOUR_KEY"
MC_LIST_ID="YOUR LIST ID"
# don't forget to update usN to your own MailChimp data center ID
TOTAL_ITEMS=`curl --silent --request GET --url "https://usN.api.mailchimp.com/3.0/lists/$MC_LIST_ID/members?fields=total_items" --user $MC_API_KEY | jq -r ".total_items"`
CHUNK_SIZE=1000
echo "id,email_address,status,avg_open_rate,avg_click_rate,timestamp_signup,last_changed,member_rating" > mailchimp_list.csv
echo "action,timestamp,url,type,campaign_id,title,parent_campaign,subscriber_id" > mailchimp_list_activity.csv
<?php
/**
* Example of simple product POST using Admin account via Magento REST API. OAuth authorization is used
*/
$callbackUrl = "http://yourdomain.com/magento-create-product-rest-api.php"; // the URL of this file
$temporaryCredentialsRequestUrl = "http://yourdomain.com/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://yourdomain.com/admin/oauth_authorize';
$accessTokenRequestUrl = 'http://yourdomain.com/oauth/token';
$apiUrl = 'http://yourdomain.com/api/rest';
$consumerKey = 'v3b7p1yn29q0378ybk9w5d7hrsmiifpf';
oauth \
--method PUT \
--consumer-key v3b7p1yn29q0378ybk9w5d7hrsmiifpf \
--consumer-secret q91boucyygushav4ce4x07sohvpsynlg \
--token abe2y68hu5y43qr9eghwyttyrf0yhowy \
--secret 6gbzpn4uiok1k5ml8963nkz43l67ynom \
--uri http://yourdomain.com/api/rest/products/522909 \
debug
Method: PUT
<?php
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
$rows = $db->fetchAll("SELECT entity_id FROM catalog_product_entity WHERE type_id = 'simple'");
foreach ($rows as $row) {
Mage::helper('SalesOrderPlanning/ProductAvailabilityStatus')->RefreshForOneProduct($row['entity_id']);
Mage::helper('AdvancedStock/Product_Base')->updateStocksFromProductId($row['entity_id']);
Mage::helper('purchase/Product')->updateProductWaitingForDeliveryQty($row['entity_id']);
Mage::helper('purchase/Product')->updateProductDeliveryDate($row['entity_id']);
}
<?php
class Lot_Common_Helper_Cli_Erp extends Lot_Common_Helper_Cli_Data {
public function refreshStockStatusAsync($entity_ids) {
foreach ($entity_ids as $entity_id) {
try {
Mage::helper('SalesOrderPlanning/ProductAvailabilityStatus')->RefreshForOneProduct($entity_id);
Mage::helper('AdvancedStock/Product_Base')->updateStocksFromProductId($entity_id);
Mage::helper('purchase/Product')->updateProductWaitingForDeliveryQty($entity_id);
Mage::helper('purchase/Product')->updateProductDeliveryDate($entity_id);
<?php
/*
==New BSD License==
Copyright (c) 2013, Drew Gillson
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
<?php
/*
==New BSD License==
Copyright (c) 2013, Drew Gillson
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@drewgillson
drewgillson / pricerules.php
Created October 11, 2012 02:35
Magento CLI utility to refresh catalog price rules
<?php
require_once 'abstract.php';
class Mage_Shell_Pricerules extends Mage_Shell_Abstract
{
public function run()
{
ini_set('memory_limit', '1024M');
$this->db = Mage::getSingleton('core/resource')->getConnection('core_read');
@drewgillson
drewgillson / RefreshAllWithoutBackgroundTasks-Patch.php
Created September 14, 2012 08:51
Refresh All Without Background Tasks
<?php
/**
* This new CLI script refreshes stock status, just do 'php erp.php refreshstockstatus' in /shell
* Optimized for minimal memory usage with one fix to the core BoostShop ERP code, which is the addition
* of $this->_product->clearInstance() to the end of MDN_SalesOrderPlanning_Model_ProductAvailabilityStatus::Refresh
**/
#/shell/erp.php
require_once 'abstract.php';
class Mage_Shell_Erp extends Mage_Shell_Abstract