Skip to content

Instantly share code, notes, and snippets.

View anadimisra's full-sized avatar
🏠
Working from home

Anadi Mishra anadimisra

🏠
Working from home
View GitHub Profile
@anadimisra
anadimisra / MappingJackson2HttpMessageConverter.java
Created November 5, 2012 07:46
Http Message converter for spring 3.1.X using jackson 2.X
import java.io.IOException;
import java.nio.charset.Charset;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
import org.springframework.http.converter.AbstractHttpMessageConverter;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import org.springframework.util.Assert;
@anadimisra
anadimisra / nginx
Created January 28, 2013 11:32
Yet another nginx init script, modified some paths
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /apps/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@anadimisra
anadimisra / nginx.conf
Last active December 11, 2015 20:19
nginx configuration for puppet master
user puppet;
worker_processes 4;
error_log logs/error.log info;
events {
use epoll;
worker_connections 1024;
}
@anadimisra
anadimisra / gist:cbee30f04bdebc6853ae
Created February 26, 2015 16:03
drive uploader java code
@Service
public class GoogleDriveResumeUploader implements ResumeUploader {
/** Global Drive API client. */
private Drive drive;
@Resource
private Environment environment;
private static final Logger LOGGER = LoggerFactory.getLogger(GoogleDriveResumeUploader.class);
@anadimisra
anadimisra / gist:a8ca496b8a9cbce89608
Created March 14, 2015 03:34
Google recaptcha response verifier server side
@Service
public class ReCaptchaResponseVerfier {
@Resource
private Environment environment;
private static final Logger LOGGER = LoggerFactory.getLogger(ReCaptchaResponseVerfier.class);
@Async
public ListenableFuture<GoogleCaptchaResponseData> isCaptchaResponseValid(String captchaResponse) throws InterruptedException,
@anadimisra
anadimisra / MyMqttApp.java
Created October 31, 2015 06:08
Sample MQTT Publish Program in Java
package org.mqtt.app;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.MqttTopic;
@anadimisra
anadimisra / php-fpm.conf
Created March 13, 2017 07:53
Configuration for php fpm with workers for stack overflow question
[global]
pid = /run/php/php7.0-fpm.pid
error_log = /var/log/php7.0-fpm.log
log_level = notice
include=/etc/php/7.0/fpm/pool.d/*.conf
@anadimisra
anadimisra / rails_fixture_range_postgres.yml
Created July 18, 2017 06:26
sample gist for how to use erb to define postgres daterange and tsrange in a yml
one:
name: Wrong Name
city: This City
venue: MyString
dates: '(''<%= Date.today %>'' , ''<%= Date.today+2.days %>'')'
schedule: '(''<%= Time.now %>'' , ''<%= Time.now+480.minutes %>'')'
seats: 1
unit_price: 9.99
venue_map_link: MyString
description: MyText
@anadimisra
anadimisra / error.log
Created September 3, 2017 13:44
error logs
F, [2017-09-03T11:27:10.616818 #4598] FATAL -- :
ActionView::Template::Error - wrong number of arguments (given 2, expected 1):
actionview (5.1.1) lib/action_view/template/error.rb:67:in `initialize'
actionview (5.1.1) lib/action_view/template.rb:321:in `handle_render_error'
actionview (5.1.1) lib/action_view/template.rb:160:in `rescue in render'
actionview (5.1.1) lib/action_view/template.rb:155:in `render'
actionview (5.1.1) lib/action_view/renderer/template_renderer.rb:64:in `render_with_layout'
actionview (5.1.1) lib/action_view/renderer/template_renderer.rb:50:in `render_template'
actionview (5.1.1) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (5.1.1) lib/action_view/renderer/renderer.rb:42:in `render_template'
@anadimisra
anadimisra / something.py
Created December 15, 2017 05:45
parking_lot_zeomega
import unittest
class ParkingLotTest(unittest.TestCase)
def test_create_parking():
lot = ParkingLot()
lot.create_parking_lot(6)
self.assertEqual(6, lot.get_size())
def test_find_slot(self):