Skip to content

Instantly share code, notes, and snippets.

View manishnakar's full-sized avatar
💭
Exploring Nodejs

Manish Nakar manishnakar

💭
Exploring Nodejs
  • Mumbai, India
  • 13:37 (UTC +05:30)
View GitHub Profile
@manishnakar
manishnakar / install.sh
Created March 26, 2019 08:32 — forked from marklit/install.sh
Bot Detection Script. Works with Apache and Nginx Log Files.
sudo apt-get update
sudo apt-get install \
python-dev \
python-pip \
python-virtualenv
virtualenv findbots
source findbots/bin/activate
curl -O http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz
SELECT b.email, c.value AS name, a.updated_at, d.added_at, d.product_id, e.name, SUM(g.qty_ordered) AS purchased
FROM `wishlist` AS a
INNER JOIN customer_entity AS b ON a.customer_id = b.entity_id
INNER JOIN customer_entity_varchar AS c ON a.customer_id = c.entity_id AND c.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'firstname' AND entity_type_id = b.entity_type_id)
INNER JOIN wishlist_item AS d ON a.wishlist_id = d.wishlist_id
INNER JOIN catalog_product_flat_1 AS e ON d.product_id = e.entity_id
LEFT JOIN sales_flat_order AS f ON f.customer_email = b.email
LEFT JOIN sales_flat_order_item AS g ON (f.entity_id = g.order_id AND g.sku LIKE CONCAT(e.sku,'%') AND g.product_type = 'simple')
GROUP BY b.email, c.value, a.updated_at, d.added_at, d.product_id, e.name
@manishnakar
manishnakar / Magento-order-sum-breakout-report.sql
Created October 21, 2018 07:25 — forked from tegansnyder/Magento-order-sum-breakout-report.sql
Magento - Sum of All Orders by Month and Year Breakdown includes Discount Sums
SELECT sub_query.month_ordered,
sub_query.year_ordered,
SUM(sub_query.base_subtotal) AS sum_base_subtotal,
SUM(sub_query.discount_amount) AS sum_discount_amt,
SUM(sub_query.order_qty) AS sum_total_item_count,
COUNT(sub_query.entity_id) AS total_orders
FROM
(SELECT so.entity_id,
MONTH(so.created_at) AS month_ordered,
YEAR(so.created_at) AS year_ordered,
@manishnakar
manishnakar / Magento Admin Backend.md
Created August 29, 2018 05:20 — forked from tegansnyder/Magento Admin Backend.md
Magento Custom Admin Backend

You can set your own custom Magento admin URL in:

System -> Configuration -> [ADVANCED] -> Admin -> Admin Base URL

NOTE: Make sure you have added a ServerAlias directive to your virtual host configuration for backend.domain.com and that you have a SSL cert or wildcart setup for HTTPS traffic on that subdomain or you will lock yourself out the admin.

Rules for your .htaccess file to prevent duplicate urls and redirect directly to admin dashboard:

Lumen and naming transactions into NewRelic

Problem: How to build transaction name for NewRelic in Lumen.

Description: NewRelic tries to group similar transaction into group, to be able easier watch for them later on Extra-Problem: NewRelic has an issue and becuase of that they can not group following transactions:

  • /orders/zzZfN0kZ6F1PtFdQ4Baq
  • /orders/aaZDd0k43D1GtFeG5cCe ...

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@manishnakar
manishnakar / nodejs
Last active September 1, 2015 11:26
node.js init.d script for CentOS
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"