Skip to content

Instantly share code, notes, and snippets.

View gajoseph's full-sized avatar

George @ Joseph gajoseph

View GitHub Profile
@gajoseph
gajoseph / zillow.py
Created September 29, 2018 16:14 — forked from scrapehero/zillow.py
Python 3 script to find real estate listings of properties up for sale on zillow.com
from lxml import html
import requests
import unicodecsv as csv
import argparse
def parse(zipcode,filter=None):
if filter=="newest":
url = "https://www.zillow.com/homes/for_sale/{0}/0_singlestory/days_sort".format(zipcode)
elif filter == "cheapest":
@gajoseph
gajoseph / CheckSudoaccess
Last active November 16, 2020 22:13
script verifies that the ssh and sudo functionalities are workng as expected
/*
This script verifies that the ssh and sudo functionalities are workng as expected
*/
sshme.sh:: contents are below
sshpass -p password ssh -tt -o LogLevel=error -q id@$host <<'EOF'
ls| wc -l
echo password | sudo -S su - postgres -c "ls|wc -l"
exit
EOF
@gajoseph
gajoseph / taillogs2slack.sh
Last active June 7, 2018 20:28
Slack :: Stream any log file to Slack using curl
#!/bin/bash
echo "$1, 2 =$2, 3=$3"
tail -n0 -F "$1"| while read LINE; do
(echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \
"payload={ \"channel\": \"#tstpglogs\", \"text\": \"$( sed "s/\"/'/g" <<< $LINE )\"}" "$2";
done
@gajoseph
gajoseph / lambdaStrmDistinctSepaByCommas
Created May 30, 2018 18:35
Java lambdaexpression ::Sharing some sample landa express to pull all ids in this cause distinct and separated by commas like ('1','2')
Sharing some sample landa express to pull all ids in this cause distinct and separated by commas like ('1','2')
In this example a tab(table) object has list of parentId_pkids which is collection of fkids() and under each fkid object there is collection of string
NOdeleet = NOdeleet + tab.parentId_pkids.fkids().stream()
.map(fkid -> fkid.Pks.stream()
.filter(ids -> !ids.deleteable)
.map(ids -> ids.Pkids.stream()
.map(Object::toString)
.collect(Collectors.joining("','"))
@gajoseph
gajoseph / gitDeleteaFile_tracking.txt
Last active May 30, 2018 18:25
safely delete a file from git repository,
### GIt prem delete a file
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch FOLDERNAME" -- --all
rm -rf .git/refs/original/
### prune entries older than the specified time
git reflog expire --expire=now --all
### Cleanup unnecessary files and optimize the local repository; prune object older than now
git gc --prune=now
@gajoseph
gajoseph / gcloud
Created May 22, 2018 19:26
Google cloud create instance
### CReate instance
gcloud compute instances create oracent --zone us-central1-a --image-family=centos-7 --image-project=centos-cloud --boot-disk-size "100" --boot-disk-type "pd-standard" --boot-disk-device-name "oracent" --boot-disk-auto-delete
### Start
gcloud compute instances start oracent --zone us-central1-a
#### Copy files over
gcloud compute scp c:\users\tgaj2\aws\ora\*.sh c:\users\tgaj2\aws\ora\Dockerfile tgaj2@oracent:/home/tgaj2 --zone us-central1-a
# SSH
gcloud compute ssh mylove@oracent --zone us-central1-a
@gajoseph
gajoseph / COPYSCHEMA
Created May 22, 2018 19:10
Oracle:: this sp internally calls a expdp via PLSQL api to copy a schema data from one server
DROP PROCEDURE SYS.COPYSCHEMA;
CREATE OR REPLACE PROCEDURE SYS.Copyschema
(
pschemafrom IN VARCHAR2,
pschemato IN VARCHAR2,
ptablespacefrom1 IN VARCHAR2 DEFAULT NULL,
ptablespaceto1 IN VARCHAR2 DEFAULT NULL,
@gajoseph
gajoseph / mysql.sf_compTablesInschemas
Created May 22, 2018 19:01
mysql compare tables in 2 schemas
DELIMITER $$;
DROP FUNCTION IF EXISTS `mysql`.`sf_compTablesInschemas`$$
CREATE DEFINER=`root`@`%` FUNCTION `sf_compTablesInschemas`( pvchTablename VARCHAR(100),pvchSchema1 varchar(100)
,pvchSchema2 varchar(100)
) RETURNS varchar(20) CHARSET latin1
DETERMINISTIC
BEGIN
declare asd int default 0;
@gajoseph
gajoseph / SYS.sf_compTablesInschemas
Created May 22, 2018 18:56
oracle compare tables in 2 schema
CREATE OR REPLACE FUNCTION SYS.sf_compTablesInschemas
(
pvchTablename IN VARCHAR2,
pvchSchema1 in varchar2,
pvchSchema2 in varchar2
)
return varchar2
IS
@gajoseph
gajoseph / gist:e3368ac4b1f66a3440430dbeed3164e7
Created May 21, 2018 21:47
Create a table and Db in aws Athena
create database clindb;
CREATE EXTERNAL TABLE IF NOT EXISTS comp_logs (
`Date_Received` Date,
product STRING,
sub_product STRING,
issue INT,
sub_issue STRING,
Consumer_comp STRING,
comp_pub_response STRING,