Skip to content

Instantly share code, notes, and snippets.

View zeroows's full-sized avatar
🥰
Rust

Abdulrhman Alkhodiry zeroows

🥰
Rust
View GitHub Profile
@zeroows
zeroows / hello_server.ex
Created September 18, 2017 09:58 — forked from blackode/hello_server.ex
GenServer Callbacks examples
defmodule HelloServer do
use GenServer
## Server API
def init(initial_value) do # initiating the state with the value 1 passed
{:ok,initial_value}
end
# add the value to the state and returns :ok
def handle_call({:add,value},_from,state) do
@zeroows
zeroows / RetrofitConfiguration.java
Created April 8, 2017 14:59
Retrofit Configuration for Spring Boot
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.aalkhodiry.notifications.utils.LoggingInterceptor;
import okhttp3.OkHttpClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
@zeroows
zeroows / RabbitmqConfiguration.java
Created April 8, 2017 14:57
Rabbitmq Configuration for Spring Boot <3
import lombok.extern.slf4j.Slf4j;
import net.aalkhodiry.api.configurations.queues.CustomDLQueueDLQueue;
import net.aalkhodiry.api.utils.CustomJsonMessageConverter;
import org.aopalliance.intercept.Interceptor;
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.rabbit.config.RetryInterceptorBuilder;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
@zeroows
zeroows / PrometheusConfig.md
Last active April 6, 2017 08:21
Using Prometheus with Spring Boot - https://prometheus.io
  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
  </dependency>
  <!-- The client -->
  <dependency>
      <groupId>io.prometheus</groupId>
      <artifactId>simpleclient</artifactId>
      <version>0.0.18</version>
@zeroows
zeroows / _service.md
Created May 31, 2016 17:31 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@zeroows
zeroows / docker-ssl-cert-generate
Created February 16, 2016 09:33 — forked from cameron/docker-ssl-cert-generate
Generate self-signed SSL certs for docker client <— HTTPS —> daemon
#! /bin/bash
# HEADS UP! Make sure to use '*' or a valid hostname for the FDQN prompt
echo 01 > ca.srl
openssl genrsa -des3 -out ca-key.pem
openssl req -new -x509 -days 365 -key ca-key.pem -out ca.pem
openssl genrsa -des3 -out server-key.pem
openssl req -new -key server-key.pem -out server.csr
@zeroows
zeroows / generate_docker_cert.sh
Created February 16, 2016 09:33 — forked from bradrydzewski/generate_docker_cert.sh
Generate trusted CA certificates for running Docker with HTTPS
#!/bin/bash
#
# Generates client and server certificates used to enable HTTPS
# remote authentication to a Docker daemon.
#
# See http://docs.docker.com/articles/https/
#
# To start the Docker Daemon:
#
# sudo docker -d \
@zeroows
zeroows / maven-profiles.xml
Created December 22, 2015 16:49
generation service from wsdl
<profiles>
<profile>
<id>CXF</id>
<!-- To use Metro by default, move this activation element to its profile below -->
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<cxf.version>3.0.1</cxf.version>
@zeroows
zeroows / write_to_file.rs
Last active October 5, 2015 06:13
Testing Rust with writing to a file and formating functionallity
fn main() {
use std::fs::File;
use std::io::prelude::*;
use std::fmt;
struct Info {
name: String,
age: i32,
rating: i32,
}
@zeroows
zeroows / DUB.sublime-build
Created September 13, 2015 13:19
Sublime 3 Dub build system configration
{
"cmd": ["dub", "run"],
"working_dir": "${project_path:${folder}}",
"file_regex": "^(.*?)\\(([0-9]+),?([0-9]+)?\\): (.*)",
"selector": "source.d"
}