Skip to content

Instantly share code, notes, and snippets.

View ItsCalebJones's full-sized avatar
🎯
Focusing

Caleb Jones ItsCalebJones

🎯
Focusing
View GitHub Profile
@ItsCalebJones
ItsCalebJones / launch_viewset.py
Created June 20, 2023 05:13
Attempting to Implement PolymorphicSerializer
from django_filters.rest_framework import DjangoFilterBackend
from drf_spectacular.utils import OpenApiParameter, extend_schema, extend_schema_view
from rest_framework.filters import OrderingFilter, SearchFilter
from api.endpoints.common.views import BaseModelViewSet
from api.models import Launch
from api.permission import HasGroupPermission
from ...common.prefetches import get_prefetched_launch_queryset
from ...launch.filters import LaunchFilterSet
@ItsCalebJones
ItsCalebJones / day_6.py
Created December 6, 2022 06:43
Day 6 - Advent of Code 2022
import time
from utils import get_inputs
from collections import Counter
def part_one():
input = get_inputs(puzzle_day=6)
buffer_size = 4
for i in range(len(input) - buffer_size + 1):
_string = (input[i: i + buffer_size])
from datetime import timedelta
from difflib import SequenceMatcher
import requests
from django.utils.text import slugify
def find_spacex_api(launch):
max_delta = 7
url = 'https://api.spacexdata.com/v3/launches'
@ItsCalebJones
ItsCalebJones / find_empty.py
Last active November 23, 2017 00:48
Python script to find empty cells.
from openpyxl import load_workbook
some_array = [1,2,3]
wb = load_workbook(filename = 'your_excel.xlsx')
ws = wb.get_sheet_by_name('Sheet Name')
for row in ws.iter_rows('C{}:C{}'.format(ws.min_row, ws.max_row)):
for cell in row:
print cell.value
## Read the printed value here - then write condition to replace with formula.
@ItsCalebJones
ItsCalebJones / launchlibrarysdk.py
Created October 23, 2017 01:29
Python implementation for retrieving space launches from Launch Library
import requests
from datetime import timedelta
from django.utils.datetime_safe import datetime
BASE_URL = 'https://launchlibrary.net/'
headers = {
"Content-Type": "application/json"
}
@ItsCalebJones
ItsCalebJones / PUBGSeason.java
Created August 17, 2017 01:58
Creating a public static dictionary in Java
public enum PUBGSeason {
PRE1_2017("2017-pre1", "Early Access Season #1"),
PRE2_2017("2017-pre2", "Early Access Season #2"),
PRE3_2017("2017-pre3", "Early Access Season #3");
PUBGSeason(String seasonName, String seasonKey) {
this.seasonName = seasonName;
this.seasonKey = seasonKey;
}