Skip to content

Instantly share code, notes, and snippets.

View eguyd's full-sized avatar
🏠
Working from home

GuyD008 eguyd

🏠
Working from home
  • Tollgate
  • San Diego
View GitHub Profile
@eguyd
eguyd / MaximizeIT!.py
Created December 19, 2019 02:02
You are given a function . You are also given lists. The list consists of elements. You have to pick one element from each list so that the value from the equation below is maximized: % denotes the element picked from the list . Find the maximized value obtained. denotes the modulo operator. Note that you need to take exactly one element from ea…
import itertools
(K, N) = map(int, raw_input().split())
L = list()
for i in range(K):
l = map(int, raw_input().split())
n = l[0]
L.append(l[1:])
@eguyd
eguyd / nslookup.sh
Created September 23, 2019 02:00
10 most used Nslookup commands
#!/usr/bin/env bash
1. How to find the A record of а domain.
Command line:
$ nslookup example.com
2. How to check the NS records of a domain.
Command line:
$nslookup -type=ns example.com
#!/usr/bin/env bash
# SECTION 1 | Set Host IPv4
# localhost: '127.0.0.1' # ADD USER TO LOCAL HOST
# remotehost <reopteIPv4> # ADD USER TO REMOTE HOST
# SECTION 2 | Generate Login Details
set -e # STOP IF ANY ERROR
if [ $(id -u) -eq 0 ]; then # VERIFY ROOT THEN IF ROOT
read -p "Enter username : " username # ENTER USER NAME
@eguyd
eguyd / ping_sweep.py
Last active September 12, 2019 21:54
Execute Ping Sweep from IDE console and output results to .txt file
"""
Program: Execute Ping Seep (ICMP Requests) and output results to a text file.
Interpreter Python 2.7 | Linux
"""
import os
import platform
from datetime import datetime
net = raw_input("Enter the IP address")
@eguyd
eguyd / TCPIPScanner.py
Created August 3, 2019 03:06
Simple and Basic TCP IP Scanner with Python 3 and outputs open ports.
import socket
import subprocess
import sys
from datetime import datetime
subprocess.call("", shell=True)
rmip = input("ENTER REMOTE HOST IP: ")
ps1 = int(input("ENTER START PORT NUMBER TO SCAN: "))
ps2 = int(input("ENTER LAST PORT NUMBER TO SCAN: "))
print("*"*40)
@eguyd
eguyd / NASDAQNews.py
Last active August 3, 2019 01:16
natural language processing algorithms to identify sentiments in market.
import requests
from bs4 import BeautifulSoup
import csv
import pandas as pd
mostActiveStocksUrl = "https://www.nasdaq.com/markets/most-active.aspx"
r = requests.get(mostActiveStocksUrl)
data = r.text
soup = BeautifulSoup(data)
@eguyd
eguyd / ICMP.py
Created July 31, 2019 20:06
Scan an entire IPv4 subnet with Python using ICMP ECHO request to identify live hosts.
"""
Author: Guy D.
Last Modified: 31 JUL 19
Program: Scan an entire subnet with Python using ICMP ECHO request to view live hosts.
This sample code is provided for the purpose of illustration "AS IS" WITHOUT WARRANTY OF ANY KIND.
"""
import os
import platform
@eguyd
eguyd / Ch5_Ex6.py
Last active November 12, 2020 02:56
A main function that tests the conversion function with numbers in several bases.
"""
Define a function decimalToRep that returns the representation of an integer in a
given base. The two arguments should be the integer and the base. The function
should return a string. It should use a lookup table that associates integers with
digits. Include a main function that tests the conversion function with numbers
in several bases.
"""
##############################
# Author: Guy D. #
# Last Day Modified: 6/23/19 #
##############################
""" Write a program that allows the user to navigate the lines of text in a file. The
program should prompt the user for a filename and input the lines of text into a
list. The program then enters a loop in which it prints the number of lines in the
file and prompts the user for a line number. Actual line numbers range from 1 to
the number of lines in the file. If the input is 0, the program quits. Otherwise, the
@eguyd
eguyd / decimaltobinary.py
Created June 22, 2019 21:20
Convert Decimal to binary
decimal = int(input("ENTER A DECIMAL INT: "))
if decimal == 0:
print(0)
else:
print("QUOTIENT REMAINDER BINARY")
bitString = ""
while decimal > 0:
remainder = decimal % 2
decimal = decimal // 2
bitString = str(remainder) + bitString