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 / 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"
}
@zeroows
zeroows / main.go
Last active September 12, 2015 23:19 — forked from nmerouze/main.go
Example for "Build Your Own Web Framework in Go" articles
package main
import (
"database/sql"
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"time"
@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/"
@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 / 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 / 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){
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 / 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;