Skip to content

Instantly share code, notes, and snippets.

View ogavrisevs's full-sized avatar

Oskars Gavriševs ogavrisevs

View GitHub Profile
@ogavrisevs
ogavrisevs / gist:f7aa5e5351f6e51e6e1f
Created June 10, 2015 07:44
ELK stack ok AWS ECS
{
"taskDefinitionArn": "arn:aws:ecs:eu-west-1:960921042111:task-definition/elasticsearch:21",
"revision": 21,
"containerDefinitions": [
{
"volumesFrom": [],
"portMappings": [
{
"hostPort": 9201,
"containerPort": 9200
@ogavrisevs
ogavrisevs / error.log
Created June 5, 2015 07:14
Ansible URI module with POST fails
<127.0.0.1> ESTABLISH CONNECTION FOR USER: vagrant
<127.0.0.1> REMOTE_MODULE uri method=PUT url=http://localhost:9200/_snapshot/s3_backups_grafana
<127.0.0.1> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/xxxxx/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o Port=2222 -o IdentityFile="/Users/xxxxx/.vagrant.d/insecure_private_key" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 127.0.0.1 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1433428044.88-119207179644196 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1433428044.88-119207179644196 && echo $HOME/.ansible/tmp/ansible-tmp-1433428044.88-119207179644196'
<127.0.0.1> PUT /var/folders/_1/pg5y8ygn4gdbcyxhw1x6lhxw0000gn/T/tmpgpjvIl TO /home/vagrant/.ansible/tmp/ansible-tmp-1433428044.88-119207179644196/uri
<127.0.0.1> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPe
@ogavrisevs
ogavrisevs / PrimCalc.java
Created May 22, 2015 08:38
Prim number calculator
import java.util.Date;
import java.util.Random;
public class PrimCalc {
private static int range = 100000;
private static int iterations = 100000;
public static void main(String[] args) {
PrimCalc primCalculator = new PrimCalc();
FROM centos:6
MAINTAINER Oskars G.
RUN yum -y install openssh-server
RUN ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key
RUN ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key
RUN ssh-keygen -q -N "" -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
RUN sed -i "s/#UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config
RUN sed -i 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config
@ogavrisevs
ogavrisevs / EsTimeStampMapping.json
Created December 14, 2013 13:47
EsTimeStampMapping.json
curl -X PUT http://localhost:9200/twitter_33/ -d '
{
"mappings": {
"tweet": {
"_timestamp" : {
"enabled" : "yes",
"path" : "post_date"
},
"properties": {
"message": {
@ogavrisevs
ogavrisevs / gist:7373751
Created November 8, 2013 16:35
Java couses example
import jenkins.*
import jenkins.model.*
import hudson.*
import hudson.model.*
def printCouse(cause) {
println("cause ========> : "+ cause )
println("cause.class ========> : "+ cause.class )
@ogavrisevs
ogavrisevs / build.gradle
Created October 7, 2013 20:01
joda time res. from nexus proxy
allprojects {
apply plugin: 'java'
dependencies{
compile "joda-time:joda-time:2.3"
}
repositories {
maven {
@ogavrisevs
ogavrisevs / SyntaxHighlighterSample.html
Last active December 15, 2015 03:39
SyntaxHighlighter example
<!DOCTYPE html>
<html>
<head>
<title>SyntaxHighlighterSample</title>
</head>
<pre class="brush: java">public static void main(String args[]) {
System.out.println("Hello World!");
}
</pre>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
@ogavrisevs
ogavrisevs / installHgKeyringExt.sh
Created October 26, 2012 09:35
Install mercurila keyring extension (for cygwin users)
#!/bin/bash
#
# Simple script to add keyring extension for mercurial.
# (only for cygwin users with native hg installation from debina package)
# This keyring extension enables password save so you do not need to enter it every time.
#
# Script install steps:
# 1) keyring lib from python rep.
# 2) downloads extension
# 3) configure mercurial to use keyring extension
@ogavrisevs
ogavrisevs / hgAll.sh
Created October 17, 2012 14:20
Simple script for mercurial routine command autommation.
#!/bin/bash
#
# Simple script for mercurial routine command autommation.
# Execute mercurial commands for all repos found in current dir.
#
# Exmaple Usage
#
# $. <- current dir 1) hgAll.sh in - get all incoming commits
# $../repo1 2) hgAll.sh diff - uncommitted changes
# $../repo2 3) hgAll.sh st - uncommitted changes