Skip to content

Instantly share code, notes, and snippets.

@nikhilkuria
nikhilkuria / Pascals_Triangle.md
Last active July 11, 2019 07:24
Pascal's Triangle

Background

Pascal's triangle is an arithmetic and geometric figure often associated with the name of Blaise Pascal, but also studied centuries earlier in India, Persia, China and elsewhere.

Its first few rows look like this:

    1
   1 1
  1 2 1
 1 3 3 1
### Glossary
##### Item
An item is an unit of accommodation or a POI (Point of Interest). It can be
* A hotel
* A home rental
* A town, a region, or a landmark (POI)
* ex : Eiffel Tower, Alt Stadt
#!/usr/bin/env bash
mkdir -p ~/images/Phase1/1001
mkdir -p ~/images/Phase1/1002
cd ~/images/Phase1/1001
#property image 1
curl -o 1001_125_001.jpg https://media-cdn.tripadvisor.com/media/photo-s/03/5c/02/d6/alakapuri-hotel.jpg
#property image 2
@nikhilkuria
nikhilkuria / downloadAll.sh
Created June 5, 2017 15:17
Download all files within dirs from an ftp connection
#!/bin/sh
echo "Attempt to connect to ftp server and download a file"
mkdir tmp
cd ./tmp
wget -r -nH --cut-dirs=5 -nc ftp://nikhilkuria:serahbella@localhost//Users/nikhilkuria/images
@nikhilkuria
nikhilkuria / file.sh
Created June 5, 2017 15:00
Splits a file based on a separator
#!/bin/sh
for file in ./tmp/*; do
[ -e "$file" ] || continue
name=${file##*/}
identifier=${name%.*}
echo $identifier;
@nikhilkuria
nikhilkuria / download.sh
Last active June 5, 2017 15:00
Simple ftp download
#!/bin/sh
echo "Attempt to connect to ftp server and download a file"
mkdir tmp
cd ./tmp
ftp -in test.rebex.net << SCRIPTEND
user demo password
binary
cd /pub/example
@nikhilkuria
nikhilkuria / Hacker Rank Game input
Created August 26, 2014 12:32
Hacker Rank Game input
3
10
321 386 740 595 161 176 606 64 577 316
10
267 744 264 372 943 683 506 607 504 441
10
3 559 416 40 263 747 634 135 817 34
2293
@nikhilkuria
nikhilkuria / BuendiaGist
Last active August 29, 2015 14:00
BuendiaGist
Hello, welcome to the Buendia Family Tree...
//setup
//output
//console
[source,cypher]
CREATE (JoseArcadioBuendia:Male {name:'Jose Arcadio Buendia',Gender:'Male'})
CREATE (UrsulaIguaran:Female {name:'Ursula Iguaran',Gender:'Female'})
CREATE (JoseArcadio:Male {name:'Jose Arcadio',Gender:'Male'})
CREATE (AurelianoBuendia:Male {name:'Colonel Aureliano Buendia',Gender:'Male'})
Hello.. this gist aims to visualize an xml as a graph using Neo4j Cypher queries..
See http://bit.ly/1gqosDP for the xml file and http://bit.ly/1gUcMFn for implementation details
//setup
//output
//console
[source,cypher]
CREATE (n1:NODE:PARENT:breakfast_menu {PARENT:0,ID:1,ATTRIBUTES:"",VALUE:"",TAG:"breakfast_menu"})
CREATE (n2:NODE:food {PARENT:1,ID:2,ATTRIBUTES:"",VALUE:"",TAG:"food"})