Skip to content

Instantly share code, notes, and snippets.

View ogavrisevs's full-sized avatar

Oskars Gavriševs ogavrisevs

View GitHub Profile
@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": {
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 / 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();
@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 / 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 / aws-temp-token.sh
Created July 29, 2015 16:36
Script to generate AWS STS token
#!/bin/bash
#
# Sample for getting temp session token from AWS STS
#
# aws --profile youriamuser sts get-session-token --duration 3600 \
# --serial-number arn:aws:iam::012345678901:mfa/user --token-code 012345
#
# Based on : https://github.com/EvidentSecurity/MFAonCLI/blob/master/aws-temp-token.sh
#
var client = new XMLHttpRequest();
client.open('GET', '/builddate.txt');
client.onreadystatechange = function() {
alert(client.responseText);
}
client.send();
@ogavrisevs
ogavrisevs / run_me.sh
Created January 5, 2016 07:27
Docker cpu/mem test
docker run -it --cpu-shares=256 --memory=128M --oom-kill-disable jess/stress -c 1 -i 1 -m 1 --vm-bytes 512M -t 30s -v
@ogavrisevs
ogavrisevs / call__docker_api.sh
Last active January 7, 2016 08:52
Access Docker API (docker-machine) with curl on Mac
#! /bin/bash
docker_machine_name="dev"
password="qwerty123"
ip=$(docker-machine ip $docker_machine_name)
openssl pkcs12 -export -in ~/.docker/machine/machines/$docker_machine_name/server.pem -inkey ~/.docker/machine/machines/$docker_machine_name/server-key.pem -out ~/.docker/machine/machines/$docker_machine_name/cert.pfx -password pass:$password
curl --cacert ~/.docker/machine/machines/$docker_machine_name/server.pem --cert ~/.docker/machine/machines/$docker_machine_name/cert.pfx --pass $password https://$ip:2376/version | jq .
@ogavrisevs
ogavrisevs / docker-compose.yml
Created June 3, 2016 16:15
Drone 0.5 setup ( master + slave + gogs + postgres )
# set admin user
# docker exec -it postgres sh -c "psql -h postgres -U puser"
# \c postgres
# update users set user_admin=TRUE;
version: '2'
services:
gogs:
image: gogs/gogs:0.9.0
container_name: gogs