Skip to content

Instantly share code, notes, and snippets.

View kamilziajka's full-sized avatar
🍫
😮

Kamil Ziajka kamilziajka

🍫
😮
View GitHub Profile
@kamilziajka
kamilziajka / app.js
Created October 24, 2017 07:39
react router
import {HashRouter as Router, Route} from 'react-router-dom';
<Router>
<div>
<Route exact path={'/'} component={Home}/>
<Route exact path={'/foo'} component={Foo}/>
<Route exact path={'/bar'} component={bar}/>
</div>
</Router>
devServer: {
proxy: {
'/api': {
target: 'http://localhost:1234',
pathRewrite: {
'^/api': ''
}
}
}
}
@kamilziajka
kamilziajka / Dockerfile
Created August 3, 2017 12:36
Docker build arguments
FROM ubuntu
ARG ANSIBLE_VERSION
RUN \
apt \
update \
--yes \
&& \
apt \
#!/usr/bin/env bash
# ./ssh-keygen.sh ~/test
# will create ~/test-public-key and ~/test-private-key
function keygen {
local key_path="${1}"
local key_public_path="${key_path}-public-key"
local key_private_path="${key_path}-private-key"
@kamilziajka
kamilziajka / entrypoint.sh
Created May 12, 2017 08:32
entrypoint that adds container user to the same group as mounted docker socket
#!/usr/bin/env bash
groupadd -g $(stat -c "%g" /var/run/docker.sock) docker_host
usermod -a -G docker_host ubuntu
/original_entrypoint
@kamilziajka
kamilziajka / package.json
Created October 11, 2016 08:41
npm scripts multiple alias args
{
"scripts": {
"build": "node bin/build",
"update": "node bin/update",
"build-update": "buildupdate(){ npm run build -- $@ && npm run update -- $@; }; buildupdate"
}
}
@kamilziajka
kamilziajka / ab.sh
Last active October 7, 2016 11:39
apache benchmark
#!/usr/bin/env sh
ab -p input.json -T application/json -c 8 -n 10000 http://localhost:5000/
@kamilziajka
kamilziajka / update-image.sh
Last active September 30, 2016 12:44
OpenStack CoreOS image upload
#!/usr/bin/env bash
REPOSITORY_URL="https://stable.release.core-os.net/amd64-usr/current";
IMAGE_FILE="coreos_production_openstack_image.img";
IMAGE_BZIP_FILE="${IMAGE_FILE}.bz2"
VERSION_FILE="version.txt";
TEMP_DIR=`mktemp -d` && cd ${TEMP_DIR}
# checking what is the latest CoreOS release version
@kamilziajka
kamilziajka / docker.sh
Last active April 25, 2018 11:38
docker remove
# Remove all stopped containers
docker rm $(docker ps -a | grep "Exited" | cut -d " " -f1)
# Remove all images
docker rmi $(docker images | tail -n +2 | awk '{ print $3; }')
# Stop all containers except docker-registry
docker stop $(docker ps -a | grep -v "docker-registry" | tail -n +2 | cut -d " " -f1)
# Remove all containers except docker-registry
@kamilziajka
kamilziajka / Dockerfile
Created June 30, 2016 12:38
ubuntu container
FROM ubuntu
RUN apt-get update
RUN apt-get -y install net-tools iputils-ping vim