Skip to content

Instantly share code, notes, and snippets.

View jose-marquez89's full-sized avatar
📊
Focusing

jose-marquez89

📊
Focusing
View GitHub Profile
@jose-marquez89
jose-marquez89 / sql_solution.sql
Created July 5, 2023 10:27
SQL Solution To Most Popular Client
-- with sub queries
select client_id
from (
select
client_id,
count(distinct user_id) as ucount
from (
select
id,
user_id,
# organizes files in a directory according to file extension
this_file="$(basename "$0")"
for name in *;
do
if [ -f "$name" ] && [ "$name" != "$this_file" ];
then
extension="${name##*.}"
mkdir -p "$extension"
from collections import Counter
import random
def display_board(board,clearYorN):
if clearYorN == 'Y':
print('\n'*100)
print(f' | | \n {board[7]} | {board[8]} | {board[9]} \n___|___|___\n | | \n {board[4]} | {board[5]} | {board[6]} \n___|___|___\n | | \n {board[1]} | {board[2]} | {board[3]}\n | | ')
def player_input():
int reverse(int x) {
char *buffer = malloc(sizeof(int) * (log10(x) + 1));
char new[3];
sprintf(buffer, "%d", x);
printf("%c", buffer[2]);
return 0;
}
@jose-marquez89
jose-marquez89 / increasingBST.c
Created July 31, 2020 14:47
Binary Tree In-order Rearrange
#define MAX_ARR_SIZE 400
/* create a stack */
typedef struct {
int top;
struct TreeNode array[MAX_ARR_SIZE];
} Stack;
int node_comparator(const void *p, const void *q);
@jose-marquez89
jose-marquez89 / podcast_feature.py
Created July 9, 2020 14:30
A script that finds two podcast lengths that match a specified jogging time.
"""
podcast_feature.py - A mock feature for some imaginary application. In the
context of a running application that has a podcast player, the feature is
a function 'podcast_pair_exists' that returns a boolean value corresponding
to whether the sum of two podcast lengths adds up to the user's running length.
For added impracticality, podcast times are modeled after actual podcast
running lengths using the gaussian distribution, hence the mean and standard
deviation functions (created for practice). The script prints out the amount
of attempts necessary to find a pair of podcasts to match a 65 minute run.
@jose-marquez89
jose-marquez89 / predict_out.json
Last active March 5, 2020 23:39
Sample json output from medcab1-api.herokuapp.com/predict
{
"id": 1,
"strain_id": [
962,
357,
604,
1365,
1332,
1293,
1815,
@jose-marquez89
jose-marquez89 / predict_example.py
Last active March 5, 2020 23:25
API example for medcab1-api.heroku.com
import requests
payload = {
"id": 1,
"race": "hybrid",
"positive_effects": "",
"negative_effects_avoid": "",
"ailments": "Inflammation, Eye Pressure",
"flavors": "",
"additional_desired_effects": "I want to feel a sense of calm",