Skip to content

Instantly share code, notes, and snippets.

View utmishra's full-sized avatar
👨‍💻

Utkarsh Mishra utmishra

👨‍💻
View GitHub Profile
@utmishra
utmishra / kafka.cheat.md
Last active August 29, 2015 14:27 — forked from johndstein/kafka.cheat.md
Kafka Cheat Sheet

Kafka Cheat Sheet

Display Topic Information

$ kafka-topics.sh --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1
curl -XDELETE localhost:9200/twitter
curl -XPOST localhost:9200/twitter -d '
{"index":
{ "number_of_shards": 1,
"analysis": {
"filter": {
"snowball": {
"type" : "snowball",
"language" : "English"
@utmishra
utmishra / magento-multiple-model-save
Last active August 29, 2015 14:16 — forked from cmuench/gist:3082029
Save multiple magento models at a time
<?php
// $foo = Mage::getModel('.....
// $bar = Mage::getModel('.....
$transaction = Mage::getModel('core/resource_transaction');
$transaction->addObject($foo);
$transaction->addObject($bar);
$transaction->save(); // runs save on all objects. On error -> rollback
// This is how you would use it. Pass in your collection
// along with an individual callback as well as a batch callback
Mage::getSingleton('stcore/resource_iterator_batched')->walk(
$collection,
array($this, 'batchIndividual'),
array($this, 'batchAfter'),
self::BATCH_SIZE
);
public function batchIndividual($model)
#!/bin/bash
# version: 1.0
# author: Sorin Sbarnea
require_clean_work_tree_git () {
git rev-parse --verify HEAD >/dev/null || exit 1
git update-index -q --ignore-submodules --refresh
err=0
if ! git diff-files --quiet --ignore-submodules
@utmishra
utmishra / .gitignore
Last active August 29, 2015 14:15 — forked from kbariotis/.gitignore
app/code/community/Phoenix/
app/code/community/Cm/
app/code/core/
app/design/adminhtml/default/default/
app/design/frontend/base/
app/design/frontend/default/blank/
app/design/frontend/default/default/
app/design/frontend/default/iphone/
app/design/frontend/default/modern/
app/design/frontend/enterprise/default
UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username='admin';
/*
keep qX or another else, if you change qX set in all parameters, only qX
you can use user_id too */