Skip to content

Instantly share code, notes, and snippets.

View moshemal's full-sized avatar

Moshe Malka moshemal

  • Tel Aviv, Israel
View GitHub Profile
@moshemal
moshemal / extract.sh
Created November 8, 2018 16:16
extract a file without knowing the type
#!/bin/bash
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.tar.xz) tar zxvf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
@moshemal
moshemal / App.jsx
Last active November 9, 2023 00:26
Debug react-router routings
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import Login from 'components/Login'
import DefaultComponent from 'components/DefaultComponent'
class DebugRouter extends Router {
constructor(props){
super(props);
console.log('initial history is: ', JSON.stringify(this.history, null,2))
this.history.listen((location, action)=>{
@moshemal
moshemal / concat-csv.sh
Last active June 25, 2017 13:26
concat csv files into one file
#!/bin/bash
dataPath=$1
outFilePath=$2
files=(`ls ${dataPath}`)
#write the column names
head -n 1 ${dataPath}/${files[0]} > ${outFilePath}