Skip to content

Instantly share code, notes, and snippets.

View rasheedamir's full-sized avatar

Rasheed Amir rasheedamir

View GitHub Profile
@rasheedamir
rasheedamir / Makefile
Created June 19, 2017 07:29 — forked from prwhite/Makefile
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
@rasheedamir
rasheedamir / JavaTests.java
Last active June 4, 2017 07:39
Java Tests
@RunWith(SpringRunner.class)
@DataJpaTest
public class UserEntityTests {
private static final VehicleIdentificationNumber VIN = new VehicleIdentificationNumber(
"00000000000000000");
@Rule
public ExpectedException thrown = ExpectedException.none();
package io.github.jhipster.sample.web.rest;
import io.github.jhipster.sample.security.jwt.JWTConfigurer;
import io.github.jhipster.sample.security.jwt.TokenProvider;
import io.github.jhipster.sample.web.rest.vm.LoginVM;
import java.util.Collections;
import com.codahale.metrics.annotation.Timed;
import org.springframework.http.HttpStatus;
@rasheedamir
rasheedamir / WorkUnit.java
Created April 10, 2017 20:35
trying lombok with jackson with builder patter
package sample.producer.domain;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.Value;
@Value /* to generate equals, hashCode, getters & toString ( immutable ) */
@NoArgsConstructor(force = true, access = AccessLevel.PACKAGE) /* just for dehydration! as default ctor is used to create object & then fields are set using refection! */
org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.lang.Object.
at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46)
at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63)
at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:37)
at com.mongodb.DBObjectCodec.writeValue(DBObjectCodec.java:212)
at com.mongodb.DBObjectCodec.encodeMap(DBObjectCodec.java:222)
at com.mongodb.DBObjectCodec.writeValue(DBObjectCodec.java:198)
at com.mongodb.DBObjectCodec.encode(DBObjectCodec.java:130)
@rasheedamir
rasheedamir / ObservationResource.java
Last active May 8, 2017 19:04
Spring REST Resource - Set Default Page & Default Sort
private static final int DEFAULT_PAGE_NUMBER = 0;
private static final int DEFAULT_PAGE_SIZE = 50;
@RequestMapping(value = API_VERSION_1_OBSERVATION,
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<List<ApiAttachmentObservation>> findObservations(@RequestParam(required = false) String encounterId,
@RequestParam(required = false) String patientId,
@PageableDefault(page = DEFAULT_PAGE_NUMBER, size = DEFAULT_PAGE_SIZE)
@rasheedamir
rasheedamir / Cassandra-OpsCenter-Compose.md
Created October 12, 2016 11:35 — forked from disintegrator/Cassandra-OpsCenter-Compose.md
OSX: 3-node Cassandra cluster + OpsCenter using Docker Compose
brew install boot2docker
eval $(boot2docker shellinit)
boot2docker up
sudo pip install -U docker-compose

# put the docker-compose.yml file in a directory e.g. ~/Work/docker/cassandra

cd ~/Work/docker/cassandra
docker-compose up
@rasheedamir
rasheedamir / coreos-windows-share.sh
Last active September 23, 2016 09:56 — forked from pantelis/coreos-windows-share.sh
Mount Windows share drives on CoreOS
# WARNING - THIS IN NOT a SHELL SCRIPT - JUST a LIST of COMMANDS
# based on https://github.com/coreos/coreos-overlay/issues/595 with links updated
# Build cifs-utils in a container and copy it into /tmp on the host.
$docker run -t -i -v /tmp:/host_tmp fedora /bin/bash
# On the container bash prompt
yum groupinstall -y "Development Tools" "Development Libraries"
yum install -y tar
yum install -y bzip2
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class PrettyPrintJson
{
public static void main(String[] args)
{
Person person = new Person();
person.firstName = "John";
person.lastName = "Stark";
@rasheedamir
rasheedamir / Dockerfile
Created July 31, 2016 16:02
yeoman dockerfile based on Ubuntu 16.04 LTS
FROM phusion/baseimage:0.9.19
MAINTAINER Rasheed Amir <[email protected]>
RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main universe" > /etc/apt/sources.list
RUN apt-get -y update
RUN apt-get -y install sudo nano git sudo zip bzip2 fontconfig wget
# install NodeJs
RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -