George Opritescu

Developer from somewhere

facebook flow check single file

flow check-contents < file.js
Read More

package electron app for osx

From within your app’s root folder:

electron-packager . --darwin
Read More

node create readable stream from file contents

Wanted to pipe the contents of a file through to unzip module. Achieved it like this:

let unzip = require("unzip");
let fs = require("fs");

var Readable = require('stream').Readable

fs.readFile("x.zip", (err, data) => {
  if(err)
    throw err;

  var s = new Readable
  s.push(data)
  s.push(null)

  s.pipe(unzip.Parse()).on('entry', (entry) => {
      let fileName = entry.path;
      let type = entry.type; // 'Directory' or 'File'
      let size = entry.size;
      if(fileName.toLowerCase().endsWith(".srt")) {
        entry.pipe(fs.createWriteStream(fileName));
      } else {
        entry.autodrain()
      }
    });
});
Read More

npm install from github

Example of installing a module from github:

npm i git+ssh://git@github.com/EvanOxfeld/node-unzip --save
Read More

hiveserver2 view detailed logging output

Can be useful in diagnosing problems:

hive --service hiveserver2 --hiveconf hive.server2.thrift.port=10000 --hiveconf hive.root.logger=INFO,console
Read More

serve files easily using python's SimpleHTTPServer

Easy way of starting a web server to serve some static files:

python -mSimpleHTTPServer

This will start a server, listening on 8080, and on 0.0.0.0

Read More

YouCompleteMe and nvim

Steps taken:

  • install pip: sudo easy_install pip
  • install neovim: pip install –user neovim
  • added to init.vim the following: NeoBundle ‘Valloric/YouCompleteMe’
  • restart nvim, install YouCompleteMe
  • in ~/.config/nvim/bundle/YouCompleteMe run ./install.py –gocode-completer
Read More

compiling crystal from sources on OSX El Capitan

This is easy if you have homebrew:

  • brew install llvm
  • clone the crystal repo:
git clone git@github.com:crystal-lang/crystal.git
  • cd to that folder
  • export PATH=$PATH:/usr/local/opt/llvm/bin
  • run make
Read More

chef remote_file progress

When using remote_file, the show_progress attribute can show download progress. Example:

remote_file "/home/vagrant/zeppelin-0.6.2-bin-all.tgz" do
  source "http://mirrors.m247.ro/apache/zeppelin/zeppelin-0.6.2/zeppelin-0.6.2-bin-all.tgz"
  show_progress true
end

and it will have the following effect on the output:

==> default:  - Progress: 10%
==> default:
==> default:  - Progress: 20%
...
Read More

zeppelin hive ClassNotFoundException

Got a ClassNotFoundException when trying to create a snippet in a zeppelin notebook. Luckily I found this answer, which suggested this fix:

  • download hive-jdbc standalone.jar
  • download hadoop-common.jar
  • place them in interpreter/jdbc of the zeppelin installation:
cp ~/Dev/Hadoop/apache-hive-1.2.1-bin/lib/hive-jdbc-1.2.1-standalone.jar ./interpreter/jdbc/
cp ~/Dev/Hadoop/hadoop-2.6.4/share/hadoop/common/hadoop-common-2.6.4.jar ./interpreter/jdbc/
Read More