Skip to content

Instantly share code, notes, and snippets.

View sunilgarg7's full-sized avatar

sunil garg sunilgarg7

  • India
View GitHub Profile
@sunilgarg7
sunilgarg7 / parse_austria.php
Created February 11, 2019 12:18 — forked from geek-at/parse_austria.php
Parsing ip data from a file
<?php
$infile = 'austria.csv';
$outfile = 'austria.ips';
$fp = fopen($outfile,'w');
$handle = fopen($infile, "r");
if ($handle)
{
while (($line = fgets($handle)) !== false) {
$line = trim($line);
@sunilgarg7
sunilgarg7 / scrapper.sh
Created December 2, 2018 08:06 — forked from akhld/scrapper.sh
Email scrapper
cat urls | while read url;
do
curl -o- $url | grep -oh -i '[A-Z0-9._%+-]\+@[A-Z0-9.-]\+\.[A-Z]\{2,4\}' > emails;
email_found=`[[ $(wc -l < emails) -ge 1 ]] && echo "yes" || echo "no"`;
emails=`head -n3 emails | perl -00 -lpe 's/\n/,/g'`;
domain=`echo $url | awk -F[/:] '{print $4}'`;
more_emails=`[[ $(wc -l < emails) -ge 3 ]] && echo "yes" || echo "no"`;
echo "$domain, $email_found, $emails, $more_emails, $url";
done
@sunilgarg7
sunilgarg7 / youtube-dl.md
Created August 8, 2018 14:46
Using youtube-dl to download courses from Pluralsight

Download courses from learning sites with youtube-dl

You can download whole courses from an array of tutorial sites with the CLI tool youtube-dl. In the example further down I'm using my Pluralsight account to get videos from a course at their site. Here is a list of all supported sites that you can download from with this tool

The flags you have to supply may vary depending on which site you make a request to.

You can get a free 3 month trial to Pluralsight by signing up for free to Visual Studio Dev Essentials

Installation

# Script to screenscrape 2011 India Assembly Elections
# Author : SrikanthLogic
# Date : 13 May 2011
# Screen Scrapped from http://eciresults.ap.nic.in/Constituencywises031.htm
# Output :- http://bit.ly/jaFNTh
from BeautifulSoup import BeautifulSoup
import re
import urllib2
import codecs