Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Manish Pandit lobster1234

🎯
Focusing
View GitHub Profile
@lobster1234
lobster1234 / linkedlist.c
Last active Apr 22, 2020
Plain vanilla singly linked list
View linkedlist.c
#include<stdio.h>
#include<stdlib.h>
/*
Coding a C linked list after 1995. It took a global pandemic.
*/
/*
First off, lets create a node struct called Node
*/
@lobster1234
lobster1234 / S3AsyncTest.java
Created May 19, 2019
S3Async Driver Quick Test
View S3AsyncTest.java
package org.lobster1234;
import software.amazon.awssdk.services.s3.S3AsyncClient;
import software.amazon.awssdk.services.s3.model.DeleteObjectRequest;
import software.amazon.awssdk.services.s3.model.DeleteObjectResponse;
import software.amazon.awssdk.services.s3.model.ListBucketsResponse;
import java.util.concurrent.CompletableFuture;
public class S3AsyncTest {
@lobster1234
lobster1234 / ProducerConsumer.java
Created Apr 19, 2019
Producer Consumer with wait/notify
View ProducerConsumer.java
package org.lobster1234;
import java.util.Random;
import java.util.Stack;
/**
* Simple demo of producer-consumer problem with wait and notify
*
*/
public class ProducerConsumer {
@lobster1234
lobster1234 / Miner.java
Last active Mar 27, 2019
A miner for demo during talks/presentations
View Miner.java
package org.lobster1234;
import org.apache.commons.codec.digest.DigestUtils;
public class Miner {
public static void main(String[] args){
Block block = new Block("185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969"
@lobster1234
lobster1234 / merge.py
Last active Sep 14, 2018
Quick and Dirty utility to merge swagger.json files for microservices.
View merge.py
import json
from collections import OrderedDict
from operator import itemgetter
import requests
import sys
if len(sys.argv) < 2:
print("Usage : python merge.py [http(s)://path_to_swagger_json(s)]")
sys.exit(-1)
# Loop through the URLs
files = list()
@lobster1234
lobster1234 / serverless_multiple_functions.md
Last active Dec 28, 2017
Serverless Framework Java : Multiple Functions in same class
View serverless_multiple_functions.md

Specify packaging as individual in serverless.yml

service: aws-java-maven # NOTE: update this with your service name

provider:
  name: aws
  runtime: java8

package:
@lobster1234
lobster1234 / lambda_logging.md
Last active Oct 12, 2017
Logstash logging with lambdas
View lambda_logging.md
  • Its a pain to log events with a lambda, given that there is no server to run the agents (splunk, filebeat, etc.) on. Here is a quick and easy way to set up ELK logging by writing directly to logstash via TCP.

  • Make sure the lambda is running in the right Subnet and has the right Security Group to be able to talk to Logstash server:port.

pom.xml

<dependency>
    <groupId>net.logstash.logback</groupId>
    <artifactId>logstash-logback-encoder</artifactId>
    <version>4.11</version>
@lobster1234
lobster1234 / Dockerfile
Created Aug 23, 2017
Dockerfile for Solr 6.5.1
View Dockerfile
FROM java:8-jdk
WORKDIR /tmp
RUN wget http://archive.apache.org/dist/lucene/solr/6.5.1/solr-6.5.1.tgz
RUN tar xvfz solr-6.5.1.tgz
EXPOSE 8983
CMD /tmp/solr-6.5.1/bin/solr start -force -f
# docker build .
# Note the image ID
# docker run -p8983:8983 <imageid>
# point the browser to localhost:8983 for solr console
@lobster1234
lobster1234 / schema.xml
Created Aug 16, 2017
Fixed up schema.xml to work with Nutch 2.3.1 and Solr 6.5.1
View schema.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Solr managed schema - automatically generated - DO NOT EDIT -->
<schema name="nutch" version="1.5">
<uniqueKey>id</uniqueKey>
<defaultSearchField>text</defaultSearchField>
<solrQueryParser defaultOperator="OR"/>
<fieldType name="binary" class="solr.BinaryField"/>
<fieldType name="date" class="solr.TrieDateField" omitNorms="true" positionIncrementGap="0" precisionStep="0"/>
<fieldType name="double" class="solr.TrieDoubleField" omitNorms="true" positionIncrementGap="0" precisionStep="0"/>
<fieldType name="float" class="solr.TrieFloatField" omitNorms="true" positionIncrementGap="0" precisionStep="0"/>
@lobster1234
lobster1234 / ivy.xml
Created Aug 16, 2017
The ivy/ivy.xml from Nutch 2.x to enable MongoDB
View ivy.xml
<?xml version="1.0" ?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
You under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
You can’t perform that action at this time.