Skip to content

Instantly share code, notes, and snippets.

View andy722's full-sized avatar

Andy Belsky andy722

  • as a private person here
  • Russia, Novosibirsk
View GitHub Profile
@andy722
andy722 / get_port_pid.sh
Last active August 29, 2016 08:25
Solaris: get PID of a process which listens on given port
#!/bin/bash
#
# Get PID of a process which listens on given port.
#
if [ $# -lt 1 ]
then
echo "Specify port number to look for"
echo "e.g. $0 22"
@andy722
andy722 / convert_dates.groovy
Created August 29, 2016 08:21
In given CSV file, converts dates from _full_ format to short form
import java.text.DateFormat
import java.util.regex.Pattern
//
// In given CSV file, converts dates formatted like
//
// Monday, August 1, 2016 8:39:28 PM +07:00
//
// to dates like
//
@JmxResource(domainName = "mobi.eyeline.mps.core", beanName = "ETPService")
public class EtpService implements MQSender {
private final Logger logger = Logger.getLogger("ETP");
/**
* Queue name for sending issue state change notifications.
*/
private final String queueStateOut;
@JmxResource(domainName = "mobi.eyeline.mps.core", beanName = "ApplicationHandler")
public class ApplicationHandler extends MQConsumerTask {
private final Logger logger = Logger.getLogger("ETP");
private static final String HEADER_SSOID = "SSOId";
private final CoordinateDataCoder decoder = new CoordinateDataCoder();
private final CoreDbService db;
class MQConnection implements ExceptionListener {
private final MQQueueConnectionFactory brokerConnectionFactory;
private Connection connection;
private boolean receiverTransacted;
private int receiverAcknowledge;
private final Map<String, Consumer> consumers;
private final Map<String, Producer> producers;
public class MQConnectionWrapper {
private static final long RECONNECT_DELAY_MILLIS = TimeUnit.SECONDS.toMillis(30);
private static final long MESSAGE_WAIT_MILLIS = TimeUnit.SECONDS.toMillis(30);
private final Logger logger = Logger.getLogger("ETP");
private final Object RECONNECT_MONITOR = new Object();
private final String hosts;
abstract class MQConsumerTask extends Thread {
private static final Logger logger = Logger.getLogger("ETP");
private final String queueName;
private final MQConnectionWrapper connection;
private volatile boolean isStopped;
public MQConsumerTask(String name, String queueName, MQConnectionWrapper connection) {
| ̄ ̄ ̄ ̄ ̄ ̄ ̄|
| ЗАЕБАЛИ! |
|_______|
(\__/) ||
(•ㅅ•) ||
/   づ
@andy722
andy722 / omg.js
Created June 2, 2015 14:58
Part of handlebars.js. OMG Javascript
(function(depth0,helpers,partials,data
/**/) {
var stack1;
return "\n\n"
+ ((stack1 = helpers['if'].call(depth0,(depth0 != null ? depth0.length : depth0),{"name":"if","hash":{},"fn":this.program(1, data, 0),"inverse":this.program(8, data, 0),"data":data})) != null ? stack1 : "")
+ "\n";
})
@andy722
andy722 / sad-rabbit
Created May 29, 2015 14:20
Just as sad rabbit in ASCII
██████████████████████████████████
▌ ▐█ ▐
▌ ▄ ▄█▓█▌ ▐
▌ ▐██▄ ▄▓░░▓▓ ▐
▌ ▐█░██▓ ▓▓░░░▓▌ ▐
▌ ▐█▌░▓██ █▓░░░░▓ ▐
▌ ▓█▌░░▓█▄███████▄███▓░▓█ ▐
▌ ▓██▌░▓██░░░░░░░░░░▓█░▓▌ ▐
▌ ▓█████░░░░░░░░░░░░▓██ ▐
▌ ▓██▓░░░░░░░░░░░░░░░▓█ ▐