This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- with sub queries | |
select client_id | |
from ( | |
select | |
client_id, | |
count(distinct user_id) as ucount | |
from ( | |
select | |
id, | |
user_id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(): | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": 1, | |
"strain_id": [ | |
962, | |
357, | |
604, | |
1365, | |
1332, | |
1293, | |
1815, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", |