Skip to content

Instantly share code, notes, and snippets.

View ogavrisevs's full-sized avatar

Oskars Gavriševs ogavrisevs

View GitHub Profile
@ogavrisevs
ogavrisevs / run.sh
Created July 19, 2018 17:05
DEploy monga
Setup mongadb instance
-----------------------
localhost$ mongo admin --username root --password hSFRP0Vf856R
cat ./bitnami_credentials
-> add 27017 port to SG
-> add monga user
db = db.getSiblingDB('reaction')
db.createUser( { user: "reactionUser", pwd: "reactionPwd", roles: [ "readWrite", "dbAdmin" ]} )
@ogavrisevs
ogavrisevs / crontab
Last active October 8, 2017 17:50
Send temprature from AM2302 to AWS cloudWatch
* * * * * python /root/main.py
@ogavrisevs
ogavrisevs / bash.sh
Created April 13, 2017 10:34
Create timelaps from images
x=1; for i in *jpg; do counter=$(printf %04d $x); ln -s "~/timelapse/$i" /tmp/timelaps/img"$counter".jpg; x=$(($x+1)); done
/tmp/timelaps$ ffmpeg -f image2 -i img%04d.jpg a2.mpg
@ogavrisevs
ogavrisevs / .bashrc
Last active October 17, 2022 09:03
.tmux.conf
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
@ogavrisevs
ogavrisevs / README.md
Created October 13, 2016 13:01
Networking in container

s

@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
@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 / 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
var client = new XMLHttpRequest();
client.open('GET', '/builddate.txt');
client.onreadystatechange = function() {
alert(client.responseText);
}
client.send();
@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
#