Skip to content

Instantly share code, notes, and snippets.

@elranu
elranu / s3check.sh
Created September 4, 2017 18:39
HDFS to S3 compress gzip
#!/bin/bash
# ./s3check /user/raw/2016
# it will check recursivly check all files on that path on S3, with the equivalent path on s3.
# if the file is not on s3 it will created with compresion
if [ -z "$1" ]; then
echo usage: $0 directory
exit
fi
hdfsDir=$1
@elranu
elranu / TPL DataFlow and Reactive Extensions Examples
Created February 7, 2017 23:55 — forked from valm/TPL DataFlow and Reactive Extensions Examples
TPL DataFlow and Reactive Extensions Example
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reactive.Linq;
using System.Text;
using System.Threading;
@elranu
elranu / ReflectionExtensions.cs
Created January 31, 2017 22:27
C# object to string. To write an object in a readble format
public static class ReflectionExtensions
{
/// <summary>
/// Turns into string all the properties of an object.
/// The idea of this method is to make an object more readable. The idea of this method is to be typically used in logs, to know the full status of an object.
/// </summary>
/// <param name="obj">Object to get the properties of</param>
/// <param name="tab">The tab to print the object</param>
/// <returns>Object properties in readable string format</returns>
public static string PropertiesToString(this object obj, int tab = 0)
@elranu
elranu / Program.cs
Created September 22, 2016 17:06 — forked from DanielSWolf/Program.cs
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@elranu
elranu / clr in windows
Created February 6, 2015 14:42
Git Config
git config --global core.autocrlf true
git config --global core.safecrlf true
@elranu
elranu / gist:c1d142831379cf4844b1
Created June 2, 2014 18:09
apply and call example
var x, o1, o2, r1, r2, r3;
x = 4;
o1 = {x: 2};
o2 = {x: 7};
f = function(m, n) {return m * n * this.x;};
r1 = f(3, 1));
r2 = f.call(o1,3, 1));
r3 = f.apply(o2,[3, 1]));
@elranu
elranu / jsbin.UTonifOg.html
Created December 23, 2013 23:09
json to html Form simple script
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="json to html form" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
@elranu
elranu / gist:7707374
Created November 29, 2013 15:33
Git remote branch tranking
git remote update
git checkout -t -b nameBranch remote/branch
git branch -vv (to check, two Vs)
@elranu
elranu / gist:7237386
Created October 30, 2013 18:16
use Angular injector to reuse angular modules outside angular
var injector = angular.injector(['module1', module2, 'ng']);
var service = injector.get("serviceName");
@elranu
elranu / inheritance.js
Last active December 14, 2015 06:48
inheritance in javascript
//More info: http://javascript.crockford.com/private.html
function Vehicle() {
this.pepe = function(){
console.log('pepe');
};
}
Vehicle.prototype.drive = function () {