Skip to content

Instantly share code, notes, and snippets.


Jakub Janarek jxub

View GitHub Profile
View node-rules.d.ts
declare module 'node-rules' {
export default class RuleEngine {
constructor(rules?: Rule[] | Rule, options?: object);
register(rule: Rule): any;
sync(): Rule[] | void;
execute(fact: {[x: string]: any}, cb: (data: {result?: any, reason?: any, [x: string]: any}) => void): void;
findRules(filter?: any): Rule[] | void;
turn(state: string, filter: any): Rule[] | void;
prioritize(priority: number, filter: any): Rule[] | void;
toJSON(): string;

lab 5

pass: koReBOKuIDDepwhWk7jZC0RTdopnAYKh command: find . -type f -size 1033c ! -executable

lab 6

pass: DXjZPULLxYr17uwoI01bNLQbtFemEgo7 command: find . -user bandit7 -group bandit6 -size 33c -ls 2>&1 | grep -v find | awk -F " " '{print $NF}' | xargs cat


Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

jxub / enumerable-tuple-elixir.ex
Created Nov 30, 2017
A way to add implementation of Enum for Tuples in Elixir 😁
View enumerable-tuple-elixir.ex
defimpl Enumerable, for: Tuple do
def count(tuple) do
def member?([], _), do {:ok, false}
def member?({}, _), do {:ok, false}
def member?(tuple, elem) do
|> Tuple.to_list
jxub /
Created Sep 22, 2017
A simple mongoimport for importing csv files with python and pymongo
import pandas as pd
from pymongo import MongoClient
import json
def mongoimport(csv_path, db_name, coll_name, db_url='localhost', db_port=27000)
""" Imports a csv file at path csv_name to a mongo colection
returns: count of the documants in the new collection
client = MongoClient(db_url, db_port)
db = client[db_name]

Keybase proof

I hereby claim:

  • I am jxub on github.
  • I am jxub ( on keybase.
  • I have a public key ASC0COBt6HSAbVQUBqTHEWBgAg33-HW_bGa0-73LBnuuswo

To claim this, I am signing this object:

jxub /
Created Apr 1, 2017 — forked from bih/
Intro to Rails 5 Workshop

Intro to Rails 5 Workshop

0. Configuration

Ruby 2.4.0 & Rails 5.2.0

How to install Ruby 2.4.0

$ curl -sSL | bash -s stable --ruby=2.4.0
jxub / StreamToString.go
Last active Mar 20, 2017 — forked from tejainece/StreamToString.go
Golang: io.Reader stream to string or byte slice
View StreamToString.go
import "bytes"
func StreamToByte(stream io.Reader) []byte {
buf := new(bytes.Buffer)
return buf.Bytes()
func StreamToString(stream io.Reader) string {
buf := new(bytes.Buffer)
View functional.go
// functional is a small FP-like library with no dependencies (yet!)
// open-sourcing bits and pieces here on gist :)
// Reduce reduces a slice of ints, uints or runes to a single element
// making the pythonic lambda sadly implicit and opinionated
func Reduce(elements []interface{}) interface{} {
switch elements.(type) {
case int: