This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Source: https://gist.github.com/sonus21/53cd486fb0bdb83cd10d/ | |
# Script for installing tmux on systems where you don't have root access. | |
# tmux will be installed in $HOME/local/bin. | |
# It's assumed that wget and a C/C++ compiler are installed. | |
# exit on error | |
set -e | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Adapted from https://djangosnippets.org/snippets/2619/ | |
@register.tag(name='counter') | |
def do_counter(parser, token): | |
""" | |
Counter tag. Can be used to output and increment a counter. | |
Usage: | |
- {% counter %} to output and post-increment the counter variable | |
- {% counter reset %} to reset the counter variable to 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> | |
<!-- | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def binary_search(values, key, lo=0, hi=None, length=None, comp=None): | |
""" | |
This is a binary search function which search for given key in values. | |
This is very generic in the sense values and key can be of different type. | |
If they are of different type then caller must specify comp function to | |
perform comparision between key and values's item. | |
:param values: List of items in which key has to be search | |
:param key: search key | |
:param lo: start index to begin search | |
:param hi: end index where search will be performed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
#include <exception> | |
#include <stdexcept> | |
using namespace std; | |
class IndexError: public exception { | |
public: IndexError(char * msg) { | |
this -> msg = new char[strlen(msg)]; | |
cout << msg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface RqueueMessageSender { | |
/** | |
* Enqueue a message on given queue without any delay, consume as soon as possible. | |
* | |
* @param queueName on which queue message has to be send | |
* @param message message object it could be any arbitrary object. | |
* @return message was submitted successfully or failed. | |
*/ | |
boolean enqueue(String queueName, Object message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RqueueListener(value = "job-queue",numRetries = "3") | |
public void onMessage(Job job) throws Exception { | |
// | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RqueueListener(value = "job-queue",numRetries = "3", deadLetterQueue="job-dlq") | |
public void onMessage(Job job) throws Exception { | |
// | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation 'org.springframework.boot:spring-boot-starter-data-redis' | |
implementation 'org.springframework.boot:spring-boot-starter-web' | |
implementation 'com.github.sonus21:rqueue-spring-boot-starter:2.7.0-RELEASE' | |
compileOnly 'org.projectlombok:lombok' | |
annotationProcessor 'org.projectlombok:lombok' | |
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' | |
testImplementation('org.springframework.boot:spring-boot-starter-test') { | |
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootApplication | |
@EnableRedisRepositories | |
@EnableWebMvc | |
public class AsynchronousTaskExecutorApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(AsynchronousTaskExecutorApplication.class, args); | |
} | |
} |
OlderNewer