Skip to content

Instantly share code, notes, and snippets.

View fahadsiddiqui's full-sized avatar

Fahad Siddiqui fahadsiddiqui

View GitHub Profile
export PS1="[\[\e[31m\]\\t\[\e[m\]] \\u:\[\e[32m\]\\w\[\e[m\] $ "
// https/http is a must. works for com, net URls
val urlRegex1 = r"""https?:\/\/(.*)?[a-z]*.(com|net)(\/(.*))?"""
// works for any URL
val urlRegex2 = r"""^(?:https?:\/\/)?(?:www\.)?[a-zA-Z0-9.]+\/?$"""
@fahadsiddiqui
fahadsiddiqui / csv_file_to_json_string.scala
Last active February 16, 2018 10:43
CSV file to JSON string using Jackson
import com.fasterxml.jackson.dataformat.csv.CsvSchema
import com.fasterxml.jackson.dataformat.csv.CsvMapper
import com.fasterxml.jackson.databind.ObjectMapper
import java.io.File
/*
maven dependencies =>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
@fahadsiddiqui
fahadsiddiqui / reset_permissions.sh
Last active May 17, 2018 07:32
Reset folder and file permissions after copying from old storage.
#!/bin/bash
PATH_TO_RESET=~
# reset folder permissions
find $PATH_TO_RESET -type d -exec chmod 775 {} \;
# reset file permissions
find $PATH_TO_RESET -type f -exec chmod 664 {} \;
@fahadsiddiqui
fahadsiddiqui / neo4j_cypher_cheatsheet.md
Created August 27, 2018 05:03 — forked from DaniSancas/neo4j_cypher_cheatsheet.md
Neo4j's Cypher queries cheatsheet

Neo4j Tutorial

Fundamentals

Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)
export PS1="\[\033[01;32m\]\u\[\033[00m\] ▴:\[\033[01;34m\]\w\[\033[00m\]\ $"
# "what has changed in your life?"
export PS1="\[\033[01;33m\]\u\[\033[00m\] ▴:\[\033[01;35m\]\w\[\033[00m\] $"
@fahadsiddiqui
fahadsiddiqui / rr.sh
Created November 6, 2018 11:58
Pass file path as an argument like ./rr.sh fileinput_word_per_line
#!/bin/bash
while IFS='' read -r line || [[ -n "$line" ]]; do
if [ ! -z $line ]
then
QUERY="your_query to be run on each $line here"
PGPASSWORD=your_password psql -U your_user -d your_db -c "$QUERY"
fi
done < "$1"
systemctl is-active --quiet postgresql && echo "Running..."
val sentence = "10-Q 1 flws20180930_10q.htm FORM 10-Q UNITED STATES SECURITIES AND EXCHANGE COMMISSION WASHINGTON, D.C. 20549 FORM 10-Q X QUARTERLY REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the quarterly period ended September 30, 2018 or ___ TRANSITION REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the transition period from ___ to ___ Commission File No. 0-26841 1-800-FLOWERS.COM, Inc.;"
val word = "D.C."
// sentence
// //.replace("( )+", " ")
// .replace("\n", " ")
// .replace("\t", " ")
// .replaceAll("\\p{C}", "?")
// .split(" ")
// .map {