Skip to content

Instantly share code, notes, and snippets.

View thebigdatajedi's full-sized avatar

Gabe Cruz thebigdatajedi

View GitHub Profile
@thebigdatajedi
thebigdatajedi / README-Template.md
Created March 29, 2022 05:42 — forked from DomPizzie/README-Template.md
A simple README.md template

Project Title

Simple overview of use/purpose.

Description

An in-depth paragraph about your project and overview of use.

Getting Started

#sklearn.metrics has a mean_squared_error function. The RMSE is just the square root of whatever it returns.
#source:https://intellipaat.com/community/1269/is-there-a-library-function-for-root-mean-square-error-rmse-in-python
from sklearn.metrics import mean_squared_error
from math import sqrt
rms = sqrt(mean_squared_error(y_actual, y_predicted))
@thebigdatajedi
thebigdatajedi / In Windows the .profile file if multiple vendors are using ssh keys using GitBash.sh
Created December 17, 2022 11:41
For a few months in the pandemic my Mac Book Pro would not ship because labor shortages, I was then given a Windows box for 6 months. And I quickly found out what I could do to use GitBase with a .profile file to use to Git vendors.
env=~/.ssh/agent.env
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ; }
agent_load_env
@thebigdatajedi
thebigdatajedi / reset hard.txt
Created December 17, 2022 11:45
This an explanation to what you get with git reset hard and how to do it. My bias is that if I'm having absolutely to do a reset this is the reset I do.
If you reset --hard, it will make your local code and local history be just like it was at that commit: <commit hash>
git reset --hard <commit hash>
@thebigdatajedi
thebigdatajedi / reset soft.txt
Created December 17, 2022 11:50
This an explanation of what git reset soft does and how to do it. My bias is to do a git reset hard. I usually have to do them when I'm in a terrible place and the loss of code will be code I wasn to get rid off, the thing with the git reset soft is that it leaves your local files etc. the same. I just don't have much use for moving the HEAD but…
And if you reset --soft, it will move your HEAD to where they were , but leave your local files etc. the same:
git reset --soft <commit hash>
@thebigdatajedi
thebigdatajedi / Array sort (done manually instead of a builtin sort method).java
Created December 17, 2022 13:24
Java, array sort done manually instead of using a builtin sort method.
//Outer loop
for (int i = 0; i < nums.length; i++ ) {
//inner loop
for(int j = i + 1; j < nums.length; j++){
int temp = 0;
if(nums[j] < nums[i]) {
//checking elements
temp = nums[i];
nums[i] = nums[j];
@thebigdatajedi
thebigdatajedi / Nested loop search.java
Created December 17, 2022 13:25
Java, nested loop search.
class Solution {
public boolean searchMatrix(int[][] matrix, int target) {
boolean found = false;
outer:for(int[] array : matrix)
{
for(int item : array){
if(item == target){
found = true;
@thebigdatajedi
thebigdatajedi / Converting Int to BigDecimal.java
Created December 17, 2022 13:26
Java, converting Int to BigDecimal because if you know, you know.
int intSample = 1;
BigDecimal.valueOf((double)intSample);
@thebigdatajedi
thebigdatajedi / ternary operator.ts
Created December 17, 2022 13:41
ternary explanation with example
//This is how a ternary operator works:
//<condition to check> ? <what happens if the condition is true> : <what happens
//if the condition is false>;
//Credit Union System example with evaluating fees.
function getFee(isMember: boolean): string {
return (isMember ? '$2.00' : '$10.00');
}
static getDateTime(): string {
const today = new Date();
const date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
const time = today.getHours() + ':' + today.getMinutes() + ':' + today.getSeconds();
const dateTime = date + ' ' + time;
return dateTime;
}