Skip to content

Instantly share code, notes, and snippets.

View bydga's full-sized avatar

Martin Bydžovský bydga

  • Emplifi a.s.
  • Pilsen
View GitHub Profile
@bydga
bydga / all
Last active November 13, 2017 09:49
timerange 2017-10-31 14:29:34.59736 - 2017-11-13 09:31:17.747297
select l.type, count(*)
from login_log l
left join users u on u.id=l.id_user
where u.internal=false
group by l.type
"twitter";126
"email";9013
"facebook";5727
@bydga
bydga / crash.log
Created September 19, 2016 11:19
Marathon periodic restarts/suicides
2016-09-19T09:47:27.492089+00:00 mesos-master2 marathon[14634]: [2016-09-19 09:47:27,491] WARN Error: Framework disconnected
2016-09-19T09:47:27.492092+00:00 mesos-master2 marathon[14634]: In case Mesos does not allow registration with the current frameworkId, delete the ZooKeeper Node: /marathon/state/framework:id
2016-09-19T09:47:27.492095+00:00 mesos-master2 marathon[14634]: CAUTION: if you remove this node, all tasks started with the current frameworkId will be orphaned! (mesosphere.marathon.MarathonScheduler$$EnhancerByGuice$$b1753258:Thread-1566)
2016-09-19T09:47:27.492099+00:00 mesos-master2 marathon[14634]: [2016-09-19 09:47:27,491] ERROR Committing suicide! (mesosphere.marathon.MarathonScheduler$$EnhancerByGuice$$b1753258:Thread-1566)
2016-09-19T09:47:27.492243+00:00 mesos-master2 marathon[14634]: I0919 09:47:27.492220 14738 sched.cpp:1217] Aborting framework '20160106-083626-1258962954-5050-9311-0000'
2016-09-19T09:47:27.492508+00:00 mesos-master2 marathon[14634]: [2016-09-19 09:47:27,492] INFO Driv
@bydga
bydga / Vagrantfile
Last active February 3, 2016 09:43
graceful restart docker-marathon-mesos app
# -*- mode: ruby -*-
# vi: set ft=ruby :
#IP addrees this VM will have
IP = "192.168.50.4"
# script that updates the system, downloads all prerequisities, installs docker,
# zookeeper, marathon, clones actual mesos branch and compiles it.
$setup = <<SCRIPT
bydga@bydga-mac ~/Downloads/marathon-0.14.0-RC2/bin $ ./start --master 192.168.59.4:5050 --zk zk://localhost:2181/marathon-bbb
MESOS_NATIVE_JAVA_LIBRARY is not set. Searching in /usr/lib /usr/local/lib.
MESOS_NATIVE_LIBRARY, MESOS_NATIVE_JAVA_LIBRARY set to '/usr/local/lib/libmesos.dylib'
[2016-01-13 16:25:23,342] INFO Starting Marathon 0.14.0-RC2 with --master 192.168.59.4:5050 --zk zk://localhost:2181/marathon-bbb (mesosphere.marathon.Main$:main)
[2016-01-13 16:25:26,000] INFO Connecting to ZooKeeper... (mesosphere.marathon.Main$:main)
[2016-01-13 16:25:26,020] INFO Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT (org.apache.zookeeper.ZooKeeper:main)
[2016-01-13 16:25:26,020] INFO Client environment:host.name=10.11.0.200 (org.apache.zookeeper.ZooKeeper:main)
[2016-01-13 16:25:26,020] INFO Client environment:java.version=1.8.0_31 (org.apache.zookeeper.ZooKeeper:main)
[2016-01-13 16:25:26,020] INFO Client environment:java.vendor=Oracle Corporation (org.apache.zookeeper.ZooKee
@bydga
bydga / jedem.md
Last active November 4, 2015 14:49
Debugování nodu

Debugování node.js aplikace

Nainstalujeme node-inspector modul

npm install -g node-inspector

přepínač -g znamená, že se nainstaluje do /Users/bydga/.nvm/versions/node/v4.2.1/bin/node-inspector

OT: standardní npm install express nainstaluje modul do aktuální složky, do ./node_modules/express

@bydga
bydga / functions-solution1.js
Created October 21, 2015 12:25
functions solution
var fruits = ["apple", "pear", "banana", "mango"]
var functions = []
//EDIT THIS:
for (var i=0; i<fruits.length; i++) {
var fruit = fruits[i]
functions.push(
function(fr) {
@bydga
bydga / create-app.md
Last active November 2, 2015 17:09
First more complex app

Jednoduchá nodejs appka

Struktura nodejs aplikace (projektu)

/my-project          # kořenový adresář apliakce
  node_modules/      # adresář s nainstalovanými third-party moduly
  application.js           # soubor s naší aplikací
@bydga
bydga / a-url.js
Last active October 21, 2015 14:22
Node workshop examples
//načtení externího modulu, který parsuje/sestavuje url (nodejs)
var url = require("url")
doHttpRequest = function() {
//do nothing
return
}
var work = function(){
url = "http://api.zcu.cz"
doHttpRequest(url)
@bydga
bydga / stepbystep.md
Last active November 4, 2015 15:23
Krok za krokem nodejs app

Workshop - tvorba apliakce krok za krokem

Struktura nodejs aplikace (projektu)

/my-project          # kořenový adresář apliakce
  node_modules/      # adresář s nainstalovanými third-party moduly
  index.js           # soubor s naší aplikací
@bydga
bydga / workshop.md
Last active October 15, 2015 15:05
Nodejs workshop

Instalace node.js platformy

Návod na instalaci node.js a npm (balíčkovacího systému pro node)

Windows

https://nodejs.org/download/ # stáhnout a nainstalovat windows binárku. Modifikuje $PATH proměnnou, takže v příkazové řádce můžeme volat node a npm příkazy
cmd.exe
node -v # kontrola. Měla by vypsat v4.2.1