Skip to content

Instantly share code, notes, and snippets.

# -*- coding: UTF-8 -*-
from pymongo import *
import json,sys
def mongo_get(hosts):
client = MongoClient(hosts, 27017)
dbs = client.database_names()
for db in dbs:
mydb = client[db]
cols = mydb.collection_names()
@tamr
tamr / Loop-react-motion.js
Created March 21, 2017 09:09 — forked from bsansouci/Loop-react-motion.js
Example Loop component React-Motion
let Loop = React.createClass({
getInitialState() {
return {
isMovingToEnd: true
};
},
endValue(currVals) {
let {endValueProp, isDone, startValue} = this.props;
let {isMovingToEnd} = this.state;
@tamr
tamr / export.php
Last active June 14, 2017 22:04
opencart 1.5 Miinto.com Product feed
<?php
ini_set('display_errors', 0);
ini_set('max_execution_time', 0);
ini_set('memory_limit', -1);
ignore_user_abort(1);
function getProductFilters() {
global $db;
$result = array();
@tamr
tamr / 0_reuse_code.js
Created December 12, 2016 23:10
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
@tamr
tamr / error.json
Created October 20, 2016 14:55
error
{
"Message":"An error has occurred.",
"ExceptionMessage":"Invalid column name 'DataPartnerId'.\r\nInvalid column name 'DataPartnerId'.",
"ExceptionType":"System.Data.SqlClient.SqlException",
"StackTrace":" at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()\r\n at System.Data.SqlClient.SqlDataReader.get_MetaData()\r\n at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds
@tamr
tamr / calc.sql
Created September 24, 2016 03:00
query_cache_size
SELECT FORMAT(((QCACHE_HITS / (Qcache_hits + Qcache_inserts + Qcache_not_cached))*100),2) AS query_cache_hit_rate_percentage
-- , QCACHE_FREE_BLOCKS, QCACHE_FREE_MEMORY, QCACHE_HITS, QCACHE_INSERTS, QCACHE_LOWMEM_PRUNES, QCACHE_NOT_CACHED, QCACHE_QUERIES_IN_CACHE, QCACHE_TOTAL_BLOCKS
FROM
(SELECT MAX(IF(VARIABLE_NAME = 'QCACHE_FREE_BLOCKS', VARIABLE_VALUE, NULL)) QCACHE_FREE_BLOCKS,
MAX(IF(`VARIABLE_NAME` = 'QCACHE_FREE_MEMORY', VARIABLE_VALUE, NULL)) QCACHE_FREE_MEMORY,
MAX(IF(`VARIABLE_NAME` = 'QCACHE_HITS', VARIABLE_VALUE, NULL)) QCACHE_HITS,
MAX(IF(`VARIABLE_NAME` = 'QCACHE_INSERTS', VARIABLE_VALUE, NULL)) QCACHE_INSERTS,
MAX(IF(`VARIABLE_NAME` = 'QCACHE_LOWMEM_PRUNES', VARIABLE_VALUE, NULL)) QCACHE_LOWMEM_PRUNES,
MAX(IF(`VARIABLE_NAME` = 'QCACHE_NOT_CACHED', VARIABLE_VALUE, NULL)) QCACHE_NOT_CACHED,
MAX(IF(`VARIABLE_NAME` = 'QCACHE_QUERIES_IN_CACHE', VARIABLE_VALUE, NULL)) QCACHE_QUERIES_IN_CACHE,
@tamr
tamr / usercss.css
Last active August 21, 2016 15:29
youtube 1920 > 1280
body {
font-family: tahoma, arial;
}
.ytp-hide-info-bar:hover .ytp-chrome-top {
display: inherit !important;
}
.ytp-hide-info-bar .ytp-chrome-top > .ytp-title {
display: none !important;
@tamr
tamr / export.php
Created May 18, 2016 07:14
Opencart products
<?php
require_once 'config.php';
require_once 'vqmod/vqmod.php';
VQMod::bootup();
require_once VQMod::modCheck(DIR_SYSTEM . 'startup.php');
require_once VQMod::modCheck(DIR_SYSTEM . 'library/customer.php');
@tamr
tamr / usercss.css
Last active April 25, 2018 19:05
facebook as a blog
.fbDock.clearfix {display:none}
.fbTimelineCapsule ._1vc-,
#rightCol,
._5pb8._29h._303,
._4d6h._4p1p._4-u3._57d8,
._ohe.lfloat ._47gt,
._156n._23fw,
._30vx._5v-0,
._2yj._509-._4ki._4ks,
@tamr
tamr / HandlerSocket.php
Created May 18, 2015 09:07
HandlerSocket
<?php
/**
* HandlerSocket communication framework
*
* Note I'm using mb_orig_* functions. If you don't use mbstring extension, replace mb_orig_* with general functions.
*
* Usage sample:
$hs_params = array(
'r_indexes' => array(