Skip to content

Instantly share code, notes, and snippets.

View martonsereg's full-sized avatar

Marton Sereg martonsereg

  • Budapest, Hungary
View GitHub Profile
@martonsereg
martonsereg / gist:7264983
Created November 1, 2013 12:53
O(n) Ruby solution to the Twitter interview question mentioned here: http://qandwhat.apps.runkite.com/i-failed-a-twitter-interview/
def calculate_water (columns)
left = 0
right = columns.length - 1
left_max = 0
right_max = 0
volume = 0
until left >= right
left_max = columns[left] if columns[left] > left_max
right_max = columns[right] if columns[right] > right_max
@martonsereg
martonsereg / gist:7620155
Created November 23, 2013 21:25
Very simple Amazon EC2 provision script that installs and starts an Nginx server.
#!/bin/bash
yum -y install nginx;
mkdir -p /marci/trafikmutyi;
cd /marci/trafikmutyi;
wget https://s3.amazonaws.com/marci-trafik/nginx.conf;
mv nginx.conf /etc/nginx/nginx.conf;
@martonsereg
martonsereg / README.md
Last active August 29, 2015 13:57
Setup ActiveMQ to $HOME/prj

Setup ActiveMQ

This script downloads and installs ActiveMQ to $HOME/prj and adds ACTIVEMQ_HOME to PATH.

To install ActiveMQ with this script:

curl -s https://gist.githubusercontent.com/martonsereg/9375096/raw/activemq-install | bash
@martonsereg
martonsereg / eclipse.importorder
Last active August 29, 2015 13:57
Eclipse formatter configurations used at SequenceIQ
#Organize Import Order
#Thu Mar 06 15:02:23 CET 2014
4=com
3=org
2=javax
1=java
0=\#
@martonsereg
martonsereg / check_plugin.groovy
Last active August 29, 2015 13:57
ansible ci
def plugins = jenkins.model.Jenkins.instance.pluginManager.plugins
println plugins.find { it.getShortName() == args[0] } != null
@martonsereg
martonsereg / gist:10022429
Created April 7, 2014 15:26
docker yarn playground on macosx
#!/bin/bash
# remove the ssh-key
rm -f ~/.ssh/id_hadoop
#starting an instance for retrieving the ssh key
echo installing the ssh key of the instance
DID=$(docker run -d -t sequenceiq/hadoop-docker)
docker stop -t 1 $DID
docker cp $DID:/root/.ssh/id_rsa .
#!/bin/bash
# remove the ssh-key
rm -f ~/.ssh/id_hadoop
DOCKER_IMAGE="sequenceiq/phoenix"
# removing the sandbox container if it exist
sudo docker rm -f sandbox
@martonsereg
martonsereg / gist:5a1333bccda0a7f5631a
Created June 3, 2014 17:09
sockjs + stomp for JS
var stompClient = null;
function connect() {
var socket = new SockJS('http://localhost:8080/notification');
stompClient = Stomp.over(socket);
stompClient.connect({}, function(frame) {
console.log('Connected: ' + frame);
stompClient.subscribe('/topic/stack', function(stackInfo){
logStackInfo(stackInfo);
});
@martonsereg
martonsereg / commit-msg
Created July 8, 2014 13:26
Commit message hook to always follow the message pattern on the Cloudbreak repo
#!/bin/sh
grep -qs "^CLOUD-[0-9]\{1,4\}\b " "$1" || {
echo "Your commit message does not follow the pattern: CLOUD-X commit-message"
exit 1
}
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -584,9 +584,19 @@
int err = 0;
/* Only support the initial namespaces for now. */
+ /*
+ * We return ECONNREFUSED because it tricks userspace into thinking
+ * that audit was not configured into the kernel. Lots of users
+ * configure their PAM stack (because that's what the distro does)