Skip to content

Instantly share code, notes, and snippets.

@RGGH
RGGH / PolynomialLinearRegression.py
Created May 26, 2021 07:16 — forked from tharunpeddisetty/PolynomialLinearRegression.py
Implementing Polynomial Regression for predicting the salaries of the employees based on their seniority level
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('/Users/tharunpeddisetty/Desktop/Position_Salaries.csv') #Add your file path
X = dataset.iloc[:,1:-1].values
y = dataset.iloc[:, -1].values
@RGGH
RGGH / Scrapy-tables
Created June 7, 2021 12:28 — forked from dray89/Scrapy-tables
How to scrape tables using Scrapy
import scrapy
import pandas
from ..items import YahooItem
class YahooSpider(scrapy.Spider):
name = 'Yahoo'
symbols = ["ADSK","BA","CAT","EBAY","GS","HSY","IBM","JPM","WMT","SHOP",
"T", "F", "TRI", "AMZN", "C", "A", "O", "B","MSFT", "NVDA",
"DIS", "AAL", "NFLX", "JNJ","BAC","GOOGL", "WFC"]
start_urls = ['https://finance.yahoo.com/quote/{0}/history?p={0}'.format(x) for x in symbols]
@RGGH
RGGH / np_gen_from_txt.py
Last active January 20, 2022 21:20
Import CSV that includes text into Numpy
import numpy as np
''' numpy gen from text '''
x = np.genfromtxt("t.txt", delimiter=",", dtype='f8,U6')
print(x)
# Where CSV is :
# 1,'moo'
@RGGH
RGGH / run python file without typing python and extension.md
Created September 15, 2022 18:50 — forked from umangahuja1/run python file without typing python and extension.md
How to run python files without typing python and extension

How to run python files without typing python and extension (in Linux)

Steps to follow to run your python code without typing python filename.py.

You can simply run by typing filename if you follow these simple steps.

Step 1 : Add shebang line as first line in your python code

@RGGH
RGGH / nginx-https.md
Created October 16, 2022 21:47 — forked from dotja/nginx-https.md
Configure Nginx with HTTPS

Nginx/HTTPS Configuration

About

HTTPS is when HTTP (hypertext transfer protocol); a communication protocol, is encrypted using TLS (transport layer security).

This means that if anyone is eavesdropping on the communication between a server and a client, they will eavesdrop on encrypted data that is hard to decipher and is therefore secure.

TLS is the more recent term which replaces the term SSL (secure socket layer) but we can refer to them as SSL/TLS.

use std::fs;
fn main() {
let results = fs::read_to_string("mytext.txt");
let contents = match results {
Ok(messag) => messag,
Err(error) => String::from("Uh oh"),
};
@RGGH
RGGH / rust_update_2d_array.rs
Created December 1, 2022 15:00
Update a 2d array in Rust
fn main() {
let mut mar = [[1, 3, 5], [2, 4, 6], [7, 8, 9]];
for row in mar.iter_mut() {
for num in row.iter_mut() {
*num += 5;
print!("{:?} ", num)
}
}
}
@RGGH
RGGH / gist:4a4335b92048ad39ce2fff872084e6e9
Created December 1, 2022 16:00
Update Array from a Function - Rust
fn main() {
let mut arr: [i32; 4] = [1, 2, 3, 4];
change_value(&mut arr);
for x in arr {
print!("{} ", x);
}
}
@RGGH
RGGH / get_reqwest.rs
Created December 1, 2022 17:49
get request in rust
/* reqwests example in Rust
Credit : https://www.becomebetterprogrammer.com/rust-how-to-make-an-http-request/
*/
#[tokio::main]
async fn main() {
let fact = get_cat_fact().await;
println!("fact = {:#?}", fact);
}
{
"window.zoomLevel": 2,
"workbench.sideBar.location": "right",
"workbench.colorCustomizations": {
"terminal.background": "#dfdddd",
"editorCursor.foreground": "#e5b526",
"terminalCursor.foreground": "#c54940",
"editor.hover.enable":true,
"editor.action.triggerParameterHints":true,
},