Skip to content

Instantly share code, notes, and snippets.

View kamilziajka's full-sized avatar
🍫
😮

Kamil Ziajka kamilziajka

🍫
😮
View GitHub Profile
@kamilziajka
kamilziajka / Angular2 router angular_1_router.js
Created February 16, 2016 11:07
Angular2 router angular_1_router.js
npm i @angular/router
import '@angular/router/angular1/angular_1_router';
angular.module('application', [
'ngComponentRouter'
]);
@kamilziajka
kamilziajka / gist:25da3a45d36e3f6f840f
Last active March 11, 2016 14:29
bookshelf virtual property alias
const bookshelf = Bookshelf(knex).plugin('virtuals');
const alias = (property) => ({
get: function () {
return this.get(property)
},
set: function (value) {
this.set(property, value)
}
});
@kamilziajka
kamilziajka / start.js
Created April 7, 2016 10:09
cli config + babel
#!/usr/bin/env node
'use strict';
const path = require('path');
const temp = process.cwd();
process.chdir(path.resolve(__dirname, '../'));
require('config');
process.chdir(temp);
require('babel-register')({
require('babel-register')({
presets: ['es2015', 'stage-0'],
only: 'my-cli/@(src|bin)/*.js'
});
'use strict';
import Koa from 'koa';
import KoaRouter from 'koa-router';
import {SerialPort} from 'serialport';
const path = '/dev/ttyAMA0';
const options = {baudrate: 9600};
const port = new SerialPort(path, options);
@kamilziajka
kamilziajka / bootstrap.sh
Last active June 4, 2016 23:08
project bootstrap
#!/usr/bin/env bash
npm init --y
cat > .editorconfig <<EOF
root = true
[*.{md,js}]
indent_style = space
indent_size = 2
@kamilziajka
kamilziajka / Dockerfile
Created June 24, 2016 10:55
server-http
FROM node:6
ADD server.js /server.js
CMD ["node", "/server.js"]
EXPOSE 8080
FROM node:6
ADD server.js /server.js
ADD cert.pem /cert.pem
ADD key.pem /key.pem
CMD ["node", "/server.js"]
EXPOSE 8080
@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
@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