Skip to content

Instantly share code, notes, and snippets.

View neilghosh's full-sized avatar
🇮🇳

Neil Ghosh neilghosh

🇮🇳
View GitHub Profile
package computerdatabase
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
import io.gatling.jsonpath._
class Test1 extends Simulation {
val httpConf = http
@neilghosh
neilghosh / gist:780a9286582ea5b6d910
Last active November 16, 2015 11:41
Fix PHP 5.3 Apache in OS X El Capitan

I was fooling arroung PHP to get openssl and currupted the installation

later started to get following error while attempting to start apache

sudo apachectl restart
httpd: Syntax error on line 32 of /usr/local/etc/apache2/2.2/httpd.conf: Cannot load /usr/local/opt/php53/libexec/apache2/libphp5.so into server: dlopen(/usr/local/opt/php53/libexec/apache2/libphp5.so, 10): Symbol not found: _ap_unixd_config\n  Referenced from: /usr/local/opt/php53/libexec/apache2/libphp5.so\n  Expected in: /usr/local/Cellar/httpd22/2.2.29/bin/httpd\n in /usr/local/opt/php53/libexec/apache2/libphp5.so

reinstalling php53 gave me zlib not found error brew reinstall php53 --homebrew-apxs

@neilghosh
neilghosh / gphotos_download.py
Created February 14, 2015 11:09
Script to find and download the oversized photos in Google Plus
#!/usr/bin/python
import gdata.photos.service
import os.path
import sys, os
#Script to find and download the oversized photos in Google Plus
programName = 'PicScanner'
username = "<Your Email>"
password = "<Your password>"
@neilghosh
neilghosh / ReadFromCommandLine.java
Last active May 25, 2016 15:22
Read Command Line Numbers In Java
/*
* 1st line input - two numbers space separated
* 2nd line input - series (1st number of last line times) of number space separated
*/
import java.util.*;
import java.lang.*;
import java.io.*;
class ReadFromCommandLine {
public static void main (String[] args) {
@neilghosh
neilghosh / gist:53fde86255f3819f70467b66ea567b8c
Created July 19, 2016 05:43
Changing max item size in memcached in mac
#Assuming installed via homebrew
edit /usr/local/opt/memcached/homebrew.mxcl.memcached.plist
#Add the following to increase default 1m to 2m
<string>-I</string>
<string>2m</string>
#restart memcached (or just reboot the machine)
launchctl unload /usr/local/opt/memcached/homebrew.mxcl.memcached.plist
launchctl load /usr/local/opt/memcached/homebrew.mxcl.memcached.plist
sox -t mp3 http://7609.live.streamtheworld.com/977_HITS_SC -t wav -r 22050 -c 1 - | sudo ./pifm - 102.3
const request = require('request');
function getCompanies(name, res, handleCompanies, handlePrice) {
request.get('https://trade-junky.appspot.com/companysearch?name=' + name, function(error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); //Prints the response of the request.
handleCompanies(res, body, handlePrice)
});
}
@neilghosh
neilghosh / index.js
Last active November 19, 2017 07:31
Webhook for devfest
const request = require('request');
const MAX_COMPANIES_IN_RESPONSE = 2;
function sendResponse(response,responseTxt, context, end){
let responseJson = {};
responseJson.speech = responseTxt; // spoken response
responseJson.displayText = responseTxt; // displayed response
responseJson.contextOut = context;
if(end) {
responseJson.data = {google:{expect_user_response: false}};
@neilghosh
neilghosh / upload_es.py
Created February 10, 2018 14:29
Upload CSV data to Elastic Search Index
import csv
import json
import requests
# with open('products.csv', 'rb') as csvfile:
# spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
# for row in spamreader:
# print ', '.join(row)
url = "http://localhost:9200/_bulk?pretty"
@neilghosh
neilghosh / Spark-PostgreSQL.MD
Last active August 19, 2018 15:14
Spark PostgreSQL

Install Spark and run master and slaves (workers) in standalone mode.

brew install apache-spark
/usr/local/Cellar/apache-spark/2.3.1/bin/spark-class org.apache.spark.deploy.master.Master
/usr/local/Cellar/apache-spark/2.3.1/bin/spark-class org.apache.spark.deploy.worker.Worker  spark://<MASTER_IP>:7077 -c 1 -m 512M

In PostgreSQL