Skip to content

Instantly share code, notes, and snippets.

@sushilshah
sushilshah / example2.js
Created November 19, 2012 15:47 — forked from anonymous/example2.js
MongoDB map reduce example 2
// suggested shell cmd line to run this:
//
// mongo --shell example2.js
//
// Note: the { out : … } parameter is for mongodb 1.8+
db.things.insert( { _id : 1, tags : ['dog', 'cat'] } );
db.things.insert( { _id : 2, tags : ['cat'] } );
db.things.insert( { _id : 3, tags : ['mouse', 'cat', 'dog'] } );
db.things.insert( { _id : 4, tags : [] } );
@sushilshah
sushilshah / example.js
Created November 19, 2012 15:50 — forked from philipp-spiess/example.js
MongoDB CRUD and MapReduce
db.foo.insert( { name: "Mario", fach: ["E", "D"] } );
db.foo.insert( { name: "Philipp", fach: ["PR", "D"] } );
db.foo.find();
db.foo.find( { name: "Mario" } );
db.foo.find( { fach: { $in : [ "E", "M" ] } } );
db.foo.update( { name: "Mario" }, { $push: { fach: "M" } } );
db.foo.find( { name: "Mario" } );
//Setup directories
mkdir r1
mkdir r2
mkdir r3
mkdir r4
mkdir r5
mkdir r6
mkdir config
//create replicasets
@sushilshah
sushilshah / ShardSvrSetup for Win
Created January 10, 2013 07:33
10gen-MongoDB
rem for windows
set mongod=start /MIN mongod
set mongos=start /MIN mongos
set name=%COMPUTERNAME%
mkdir a0
mkdir a1
mkdir a2
mkdir b0
mkdir b1
@sushilshah
sushilshah / OracleDatabaseInfo
Created October 29, 2013 07:30
Oracle System Queries for Retrieving Oracle Database Object Information
// http://www.razorsql.com/articles/oracle_system_queries.html
The following contains information on how to retrieve database information for Oracle objects such as tables, views, indexes, packages, procedures, functions, and triggers. The queries all query the Oracle system views located in the SYS schema.
Tables
This is a query to get all Oracle tables that can be viewed by the current user.
select TABLE_NAME, OWNER from SYS.ALL_TABLES order by OWNER, TABLE_NAME
import sys
from urllib import urlencode
import requests
from urlparse import urlparse, parse_qs
from random import choice
import re
self_id = None # your facebook id here
utc_bday = None # utc timestamp of your birthday
@sushilshah
sushilshah / Consumer
Last active May 7, 2018 10:06
ActiveMQ JMS MQTT pub/sub
import javax.jms.*;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
public class Consumer {
static String topicName = "foo";
public static void main(String[] args) throws JMSException {
// Getting JMS connection from the server
/*
* eHealth sensor platform for Arduino and Raspberry from Cooking-hacks.
*
* Description: "The e-Health Sensor Shield allows Arduino and Raspberry Pi
* users to perform biometric and medical applications by using 9 different
* sensors: Pulse and Oxygen in Blood Sensor (SPO2), Airflow Sensor (Breathing),
* Body Temperature, Electrocardiogram Sensor (ECG), Glucometer, Galvanic Skin
* Response Sensor (GSR - Sweating), Blood Pressure (Sphygmomanometer) and
* Patient Position (Accelerometer)."
*
#!/usr/bin/python
import paho.mqtt.client as paho
import os
import socket
import ssl
from time import sleep
from random import uniform
connflag = False
@sushilshah
sushilshah / frequency_estimator.py
Created July 20, 2016 09:17 — forked from endolith/frequency_estimator.py
Frequency estimation methods in Python
from __future__ import division
from numpy.fft import rfft
from numpy import argmax, mean, diff, log
from matplotlib.mlab import find
from scipy.signal import blackmanharris, fftconvolve
from time import time
import sys
try:
import soundfile as sf
except ImportError: