dsl for docker

Imagine having dsl that would combine traits into dockerfile in declarative way.
wouldn’t that be nice?
I’ve started to write scripts for it simple concatination for now.
but goal is to support multiple sources for traits.
https://github.com/NikolaMandic/kofi

walkera 250 tips

if you ever get this drone things to look out for:

if you put battery all the way in it’s place drone will not be balanced then it will drift forward in manual mode.
move the battery little bit to the back to balance it out.

once you come to new flight ground calibrate the compas otherwise gps won’t work I calibrate all just in case ince other things are quick to calibrate

minor javascript cyber

have you ever wanted to parse javascript that has \r\n in it but the dev tools stopped the cyber.

What one can do to parse string with \r\n is to replace the characters with temporary placeholder characters

"string\r\n".replace("\\r\\n","\\\\x\\\\q")
"string\\x\\q".replace(/\\x\\q/gm,"\\r\\n")

now after you have replaced the placeholder characters you should be able to use JSON.parse() on the new string and you can continue with the cyber

grsecurity hardened kernel + docker

Grsecurity might interfere with docker.
After getting hardened kernel up and running there could be errors like permissions are denied etc.

What to do?

Modify GRSecurity options once you do “make menuconfig” when recompiling kernel
I enabled softmode (does not enforce grsecurity PaX on every executable but only on explicitly marked ones).

Enable various PaX features
PaX control
Not sure if it is needed but I wanted to turn it on just in case

Then I dissabled dissable privileged IO (not sure if needed but had some weird errors on some other thing so I though I’ll just disable this)

and I dissabled chroot jail restriction

you can find this options under security-grsecurity when running make menuconfig

then docker stuff started to work not sure if I am going to bump into more non working stuff but for now that solved some things

also you can disable chroot stuff with
echo 0 > /proc/sys/kernel/grsecurity/chroot_deny_unix

hardening your kernel

so let’s say you rent a server and you want to up the bar on security.

you might want to use GRSecurity that is a patch on top of linux kernel that does not have enough users but provides things that windows has when it comes to having better security with they way memory is managed. That is probably bad way of describing it but let’s say windows has things like ASR and then when you put this patch on linux it has something like that also. For details consult their page. Features that it has are desirable comodity because they remove an entire classes of malicious things that can happen to your computer.

here is how to have centos 7 patched

[code]

#install dependencies
yum groupinstall -y “Development Tools”
yum install -y bc
yum install -y openssl-devel
yum install -y gcc-plugin-devel
yum install -y ncurses-devel

#download and patch kernel
cd /tmp
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.2.4.tar.xz
tar -xf linux-4.2.4.tar.xz -C /usr/src/
cd /usr/src/linux-4.2.4
wget https://grsecurity.net/test/grsecurity-3.1-4.2.4-201510222059.patch
patch -p1 < grsecurity-3.1-4.2.4-201510222059.patch

#make configuration and install
#here you can tupe make menuconfig and make sure to enable GRSecurity in your config
make oldconfig
make
make modules_install install
[/code]
once you restart the server type “uname -r” and if it shows the new kernel with grsec string in it then it means it is ok if not check whether your config has the grsecurity enabled

blockchain phantasy

Imagine you have a big computation problem.
You build your app the way it would run on supercomputer.
That unit of computation you sign with your key.
Then you submit it to p2p network.
It is written in blockchain framework that has simple interface calculate verify.
Blockchain network uses interface/strategy pattern to calculate the problem and do verification.
Blockchain does it’s thing you get the result.
Blockchain is used for distributed consesus on some other service like anonimous bitcoin or instant messaging or distributed search or distributed thing that is not distributed but centralized now.
p2p network might run these algos in kubernetes way.

example distributed mail is backed by (pifs|protein fold| neural network training| large prime selection) blockchain algo combo

imagine blockchain for rent where you get compensated for computation?

crowdfunding ?

next gen blockchain :-)

Blockchain is a distributed consensus thing.
How do you get bunch of people to agree on something if they do not trust each other?
You use blockchain.

Now days bitcoin is the most popular blockchain it calculates sha crypto hash and those machinses that calculate that use up a lot of power.

So how to make all that number crunching usefull?

Imagine using pifs as an prof of work.
Instead of calculating crypto hash calculate where the informaion is in pi.

Imagine using neural network training for POW.

Protein folding?

Also digital curencies are bad because they do not have anonimity. That makes bitcoin a disasster. Since you could have malicious threats like roque regimes(imagine if Nazi’s had it). Or if tomorrow US gets a dictator or if any malicious party with enough reach.

cygwin as putty replacement

So I’ve used putty before and I am reluctant to go back to it each time I am on windows so I looked alternatives around and you see all sorts of stuff even commercial shareware on some redit thread.

But I have not seen people recomend cygwin as an replacement for putty.

I’ve tried it it looks and works just as a vm shell there is tmux vim copy paste ssh all the things.

With cygwin you can only install what is needed.

This looks to me the nice way to run socks proxy on windows :-).

So my setup is cygwin with zsh(and oh-my-zsh) and tmux(with pluggins for session restore) + vim
all of that on windows copy paste works great and you can alt tab as you usually do nothing will hog your system like a vm.

here is how to run zsh(from stackoverflow)

C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico /bin/zsh --login

Seems to me I’ll never use Putty again 😀
 

perl6 grammars

perl6 got out and it looks nice and how wouldn’t it it’s perl.

there ain’t much examples tuts online so here is one.

What is so neat about this new perl is that grammars are first class citizens yay \o/

now you can just make your grammar like so

use v6;

grammar X {
token letter { \w }
token word { + }
token quantifier { '*'|'?' }
token orop { '|' }
rule quantified { | }
rule unit { | }
rule group { ['('][')'] }
rule unitgroup {+ }
rule unitgroups {|}
rule TOP { }
}

so you defined the grammar now what 😀

well we can have actions fired when each rule is matched

class A {
has $.field; # `$.field` is immutable.
has $.word;
has @.words is rw; 

method orop($n) {
say "orop $n";
}
method letter($n) {
say "letter $n";
}
method word($word) {
say "word $word";
push @!words, $word
}
method quantifier($n) {
say "quantifier $n";
}
method unitgroup($n) {
say "unitgroup $n ";
}
method unitgroups($n) {
say "unitgroups $n ";
}
method unit($n) {
say "unit $n ";
}
method group($n) {
say "group $n";
}
method regexp ($n) {
say "regexp $n";
}
method TOP ($n) {
say "top $n";
}
};

that creates class with words array that will get a word pushed in it as it is matched

now how you use it all

this will create instance of class with our actions and pass it to grammar so those actions get fired
they are matched by name

my $string ='(St|ring)?asd|asd|asdasd';
my $string2 = "asd(String)?";
my $a = A.new;
try X.parse($string, :actions($a));

if $! {
say "Parse failed: ", $!.message;

}
elsif $/ {
say $();

say "words in a exp = " , $a.words.join(",")
}
else {
say "Parse failed.";
}

this github page for the grammars is good tutorial
it shows also how to inline actions into grammars like in the middle of the rule

grammar Foo {
regex foo { blah blah { say "hi" } blah blah }
}

call method on grammar

grammar Foo {
method m{}
rule that{
<.m>
}
regex foo { blah blah { say "hi" } blah blah }
}

access group from lambda

grammar Foo {
rule foo { (\d+) { say "hi $0" } }
}

fire an action method from lambda

grammar Foo {
regex foo { blah blah { say "hi"; $*ACTIONS.thisismethodinactionobjectfromabove } blah blah }
}

also this

grammar Foo {
rule x{

{
$*ACTIONS.aftergroup($);
}
}

also

  '=' 

from here