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 / SpringExtension.java
Created February 17, 2015 07:42
Extension to tell Akka how to create beans via Spring.
package tk.aalkhodiry.client.akka;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import akka.actor.Extension;
import akka.actor.Props;
/**
* Extension to tell Akka how to create beans via Spring.
@zeroows
zeroows / SpringActorProducer.java
Created February 17, 2015 07:43
An actor producer that lets Spring create the Actor instances.
package tk.aalkhodiry.client.akka;
import org.springframework.context.ApplicationContext;
import akka.actor.Actor;
import akka.actor.IndirectActorProducer;
/**
* An actor producer that lets Spring create the Actor instances.
*/
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.
/*
* Register error provider that shows message on failed requests
* or redirects to login page on unauthenticated requests
*/
$httpProvider.interceptors.push(function($q, $rootScope, $location, $log, alertsService) {
return {
'responseError' : function(rejection) {
if (!rejection.config.ignoreAuthModule) {
switch (rejection.status) {
@zeroows
zeroows / CompletionServiceTaskScheduler.java
Created June 11, 2015 08:47
To Utilize the same Executor in java
package tk.aalkhodiry.concurrent.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import javax.annotation.PostConstruct;
import java.util.Date;
var loc = window.location, new_uri;
if (loc.protocol === "https:") {
new_uri = "wss:";
} else {
new_uri = "ws:";
}
new_uri += "//" + loc.host;
var ws_location += loc.pathname + "/wsmessage";
var client = ngstomp(ws_location, {
@zeroows
zeroows / SimpleActor.d
Created June 16, 2015 17:08
very Simple Actor in D language
import std.stdio, std.concurrency;
void myActor() {
try {
for(;;){
receive(
(int i){ writeln("Received integer: ",i); }
);
}
}catch(Exception e){
@zeroows
zeroows / PingPong.d
Created June 16, 2015 17:09
Ping Pong Actor based example in D language
import std.stdio, std.concurrency;
import core.thread;
alias Thread.sleep sleep;
void ping() {
Tid pong;
try {
for(;;){
receive(
(string s){
@zeroows
zeroows / CXFConfiguration.java
Last active August 29, 2015 14:23
Defining CXF endpoint in JavaConfig spring boot
/**
* To enable web services of Apache CXF
*/
@Configuration
@ImportResource({"classpath:META-INF/cxf/cxf.xml"})
protected static class CXFConfiguration {
@Autowired
private Bus cxfBus;
@Bean
@zeroows
zeroows / createGitRepo.sh
Created June 23, 2015 17:01
Shell script to automate creating a git repository and initializing it on my Synology NAS
#! /bin/sh
if [ $# -eq 0 ] ; then
echo "Usage: repoName"
exit 1
fi
# git base folder
gitFolder="/volume1/git/"