Skip to content

Instantly share code, notes, and snippets.

View faisalbegins's full-sized avatar

Faisal Ahmed faisalbegins

  • Fairfield, Iowa
View GitHub Profile
@faisalbegins
faisalbegins / install-artifacts
Last active February 2, 2022 08:07
Generate maven artifacts from existing jar files
#!/bin/sh
# ./install-artifact unmanaged/lib/path managed/repo/path com.miu.legecy
all_jar_files=`ls ./$1/*.jar`
replacer="dot"
for each_jar_file in $all_jar_files
do
echo "Processing: $each_jar_file"
jar_file_basename="$(basename "$each_jar_file")"
echo "Base Name of The File: $jar_file_basename"
@faisalbegins
faisalbegins / Python3 Virtualenv Setup
Created March 15, 2017 09:40 — forked from evansneath/Python3 Virtualenv Setup
Setting up and using Python3 Virtualenv
To install virtualenv via pip
$ pip3 install virtualenv
Note that virtualenv installs to the python3 directory. For me it's:
$ /usr/local/share/python3/virtualenv
Create a virtualenvs directory to store all virtual environments
$ mkdir somewhere/virtualenvs
Make a new virtual environment with no packages
@faisalbegins
faisalbegins / setup.md
Created March 15, 2017 05:03 — forked from xrstf/setup.md
Nutch 2.3 + ElasticSearch 1.4 + HBase 0.94 Setup

Info

This guide sets up a non-clustered Nutch crawler, which stores its data via HBase. We will not learn how to setup Hadoop et al., but just the bare minimum to crawl and index websites on a single machine.

Terms

  • Nutch - the crawler (fetches and parses websites)
  • HBase - filesystem storage for Nutch (Hadoop component, basically)
@faisalbegins
faisalbegins / AprConfiguration.java
Created February 27, 2017 09:33 — forked from andreldm/AprConfiguration.java
APR on Spring Boot
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.core.AprLifecycleListener;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* NOTE: You also need to install APR on your system, on Arch Linux the package is called `tomcat-native`.
@faisalbegins
faisalbegins / ubuntu_agnoster_install.md
Created November 10, 2016 09:42 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 14.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@faisalbegins
faisalbegins / PdfOrErrorController.java
Created March 31, 2016 11:15 — forked from jonikarppinen/PdfOrErrorController.java
Example of using ExceptionHandler in Spring Boot: a controller method that returns either binary data or error JSON
package com.company.project.controllers;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Random;
@faisalbegins
faisalbegins / CustomErrorController.java
Created March 31, 2016 11:15 — forked from jonikarppinen/CustomErrorController.java
Example of replacing Spring Boot "whitelabel" error page with custom error responses (with JSON response body)
package com.company.project.controllers;
import com.company.project.model.api.ErrorJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
@faisalbegins
faisalbegins / boilerplate
Last active August 29, 2015 14:10
boilerplate codes to write JavaScript module that runs in browser (including AMD support) and nodejs
"use strict";
/*
* all codes should go inside
* anonymous function.
**/
(function(){
var greetings = (function() {
@faisalbegins
faisalbegins / NumericStringTranslator
Last active August 29, 2015 14:10
NumericStringTranslator is a utility class that converts english numeric string value to bangla numeric string value and vice versa
package bd.devel83.num;
/**
* @author faisal ahmed
*/
public class NumericStringTranslator {
private final char[] banglaNumericCharSet = {'০','১','২','৩','৪','৫','৬','৭','৮', '৯'};
private final char[] englishNumericCharSet = {'0','1','2','3','4','5','6','7','8', '9'};
@faisalbegins
faisalbegins / Loggable
Created November 17, 2014 09:52
JEE6 based logger producer mechanism, it
package bd.devel83.logger;
import javax.inject.Qualifier;
import java.lang.annotation.*;
/**
* @author faisal ahmed
* Qulifier for logger
* so that logger can be injected as @Loggable along with @Inject
*/