Skip to content

Instantly share code, notes, and snippets.

View rasheedamir's full-sized avatar

Rasheed Amir rasheedamir

View GitHub Profile
@rasheedamir
rasheedamir / Ubuntu - Install Tomcat.md
Last active August 29, 2015 14:10
Ubuntu - Install Tomcat
  • Step 1: Download Tomcat from here: http://tomcat.apache.org/download-70.cgi

  • Step 2: Right click and extract the file.

  • Step 3: Copy (or better Cut) the extracted folder (e.g. apache-tomcat-7.0.53) and paste it to ~/Tools/Tomcat

  • Step 4: Open Terminal and cd ~/Tools/Tomcat/apache-tomcat-7.0.53/conf

  • Step 5: nano tomcat-users.xml Add following at the end of the file before ""

@rasheedamir
rasheedamir / Site Maintenance Page
Last active August 29, 2015 14:10 — forked from pitch-gist/gist:2999707
Site Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@rasheedamir
rasheedamir / Software Load Balancers.md
Last active July 10, 2020 08:01
Software Load Balancers - Apache vs HAProxy or Nginx

Why use frontend server (Apache or HAProxy or Nginx)?

Scalability - You can load balance multiple instances of your application behind front end server. This will allow you to handle more volume, and increase stability in the event one of your instances goes down.

Security - Apache, Tomcat, and Glassfish all support SSL, but if you decide to use Apache, most likely thats where you should configure it. If you want additional protection against attacks (DoS, XSS, SQL injection, etc.) you can install the mod_security web application firewall.

Additional Features - Apache has a bunch of nice modules available for URL rewriting, interfacing with other programming languages, authentication, and a ton of other stuff.

Clustering - By using Apache HTTP as a front end you can let Apache HTTP act as a front door to your content to multiple Apache Tomcat instances. If one of your Apache Tomcats fails, Apache HTTP ignores it and your Sysadmin can sleep through the nigh

@rasheedamir
rasheedamir / Log Management.md
Last active May 31, 2023 09:19
Log Management: elastic-search, logstash & kibana (ELK)!

The Log!

Setup a Log Management Solution with the ELK Stack

Logstash is an open source tool for collecting, parsing, and storing logs for future use. Kibana 3 is a web interface that can be used to search and view the logs that Logstash has indexed. Both of these tools are based on Elasticsearch. Elasticsearch, Logstash, and Kibana, when used together is known as an ELK stack.

@rasheedamir
rasheedamir / Git.md
Last active August 29, 2015 14:11
Git

Workflow

Git Workflow

Pull Requests

Aside from isolating feature development, branches make it possible to discuss changes via pull requests. Once someone completes a feature, they don’t immediately merge it into upstream branch (i.e. develop/master). Instead, they push the feature branch to the central server and file a pull request asking to merge their additions into upstream (i.e. develop/master). This gives other developers an opportunity to review the changes before they become a part of the main codebase.

Code review is a major benefit of pull requests, but they’re actually designed to be a generic way to talk about code. You can think of pull requests as a discussion dedicated to a particular branch. This means that they can also be used much earlier in the development process. For example, if a developer needs help with a particular feature, all they have to do is file a pull request. Interested parties will be notified automaticall

@rasheedamir
rasheedamir / solid principles.md
Last active August 29, 2015 14:11
solid principles
@rasheedamir
rasheedamir / Continuous Delivery.md
Last active August 29, 2015 14:11
Continuous Delivery

Docker

Fact: docker is an abstraction on top of LXC Containers. This means you can run an isolated “virtual machine” (container) within your Linux-based distro. Containers are extremely lightweight and you can start a new container very quickly. You can use containers to run your websites, databases, etc, in a isolated environment. In theory you should be able to use containers to run low-latency operations such as an individual database transaction

12 Factors App!

Integrate with IdP

In order for authentication to work properly both SP(FMU in this case) and the IdP(Säkerhetstjänster) must publish a meta-data document to each other. These documents are needed in order to redirect the User Agent(a user trying to log in) through the authentication flow. They also contain certificate data to sign/validate statements issued between the entities.

Add IdP meta-data to SP

The meta-data for the IdP is published on a URL depending on what environment is needed (test, acctest, prod, etc.). Let's assume we're going for acctest.

  1. Download the meta-data from: https://idp2.acctest.sakerhetstjanst.inera.se/idp/saml
  2. Save this file in the project (e.g. metadata/siths.xml)
@rasheedamir
rasheedamir / Design Patterns.md
Last active March 18, 2016 16:46
Design Patterns

Key patterns are organized into categories such as Caching, Exception Management, Logging and Instrumentation, Page Layout, Presentation, Request Processing, and Service Interface Layer; as listed below:

Exception Management - Exception Shielding: Filter exception data that should not be exposed to external systems or users.

Logging and Instrumentation - Provider: Implement a component that exposes an API that is different from the client API, to allow any custom implementation to be seamlessly plugged in.

Caching - Cache Dependency: Use external information to determine the state of data stored in a cache.

Caching - Page Cache: Improve the response time for dynamic Web pages that are accessed frequently but change less often and consume a large amount of system resources to construct.

@rasheedamir
rasheedamir / docker.md
Last active September 17, 2015 12:39
docker

Docker, the new trending containerization technique, is winning hearts with its lightweight, portable, “build once, configure once and run anywhere” functionalities.

Container vs Image

An instance of an image is called container. You have an image, which is a set of layers. If you start this image, you have a running container of this image. You can have many running containers of the same image.

So a running image is a container.

Cheat Sheet

  • Lists only running containers: sudo docker ps