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 / unsubmodule.md
Created September 3, 2023 09:08 — forked from ryaninvents/unsubmodule.md
Convert git submodule to regular directory

From Stack Overflow.

# Fetch the submodule commits into the main repository
git remote add submodule_origin git://url/to/submodule/origin
git fetch submodule_origin

# Start a fake merge (won't change any files, won't commit anything)
git merge -s ours --no-commit submodule_origin/master
@zeroows
zeroows / Dockerfile
Created June 12, 2023 14:58
Dockerfile for firebase admin tools
FROM ubuntu:latest
WORKDIR /app
COPY gcloud_configs/config_firebase_adminsdk_file.json .
RUN apt update 2>/dev/null && apt install curl -y
RUN curl -o firebase -L --progress-bar https://firebase.tools/bin/linux/latest
RUN chmod +rx firebase
@zeroows
zeroows / CORSFilter.java
Last active October 4, 2022 11:44
To enable CORS support in Spring MVC 4 - Access-Control-Allow-Origin
package com.alkhodiry.mb.rest.filters;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
@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;
from flask import Flask, jsonify, request
from waitress import serve
import logging
logger = logging.getLogger('waitress')
logger.setLevel(logging.INFO)
app = Flask(__name__)
@zeroows
zeroows / iban.py
Created October 31, 2021 12:07
IBAN Generator from Account number for Saudi Arabia Banks
import string
CHARS = {c: str(ord(c) % 55) for c in string.ascii_uppercase}
BANK = {
'Al Bilad Bank': '15',
'Al Inma Bank': '05',
'Al Jazira Bank': '60',
'Al Rajhi Bank': '80',
'Alawwal Bank': '50',
@zeroows
zeroows / CustomSoapActionInInterceptor.java
Created October 22, 2014 06:23
Removing SoapAction from CXF by using InInterceptor
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.cxf.binding.soap.Soap11;
import org.apache.cxf.binding.soap.Soap12;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
@zeroows
zeroows / firestore.rules
Last active March 30, 2020 20:57
Firestore Rules Example in Google Console
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /shoppinglist/{lists} {
function isSignedIn() {
return request.auth != null;
}
function isEmailVerified() {
return request.auth.token.email_verified != false;
}
@zeroows
zeroows / pytorch_losses_functions.ipynb
Created February 6, 2020 08:01
Some Pytorch losses examples
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.