Skip to content

Instantly share code, notes, and snippets.

!ENTRY = 0 R main()[] 1 R main()[]
dec.check = 0 L dec.restore 1 R dec.scan_1
dec.init = 0 R dec.check 0 R dec.check
dec.restore = 1 L return.1 1 L return.1
dec.scan_0 = 0 L dec.scan_done 1 R dec.scan_1
dec.scan_1 = 0 R dec.scan_0 1 R dec.scan_1
dec.scan_done = 0 L dec.shift_0 1 L dec.shift_0
dec.shift_0 = 0 L return2.0 0 L dec.shift_1
dec.shift_1 = 1 L dec.shift_0 1 L dec.shift_1
dispatch.0.carry = 1 L dispatch.1 0 L dispatch.1.carry
!ENTRY = 0 R main()[] 1 R main()[]
dec.check = 0 L dec.restore 1 R dec.scan_1
dec.init = 0 R dec.check 0 R dec.check
dec.restore = 1 L return.1 1 L return.1
dec.scan_0 = 0 L dec.scan_done 1 R dec.scan_1
dec.scan_1 = 0 R dec.scan_0 1 R dec.scan_1
dec.scan_done = 0 L dec.shift_0 1 L dec.shift_0
dec.shift_0 = 0 L return2.0 0 L dec.shift_1
dec.shift_1 = 1 L dec.shift_0 1 L dec.shift_1
dispatch.0.carry = 1 L dispatch.1 0 L dispatch.1.carry
0RQV1RQV_0LD1RF_0RB0RB_1LSI1LSI_0LG1RF_0RE1RF_0LH1LH_0LSJ0LI_1LH1LI_1LK0LL_0LM1LM_1LM0LN_0LO1LO_1LO0LP_0LQ1LQ_1LQ0LR_0LS1LS_1LS0LT_0LU1LU_1LU0LV_0LW1LW_1LW0LX_0LY1LY_1LY0LZ_0LBA1LBA_1LBA0LBB_0L1L_1L0L_0LSH0RBD_1RBC1RBD_0RBF1RBF_0RBG1RBG_1LSI1RBH_0RBG1RBH_0LBJ1LBJ_1LBK1LBK_0LBL0LBL_0LBM0LBM_0LBU0LBU_0LBO1LBO_0LBR0LBR_0LBQ1LBQ_1LBR1LBR_1LBS1LBS_0LBT0LBT_1LBU1LBU_0LS0LS_0LBW1LBW_0LCI0LCI_0LBY1LBY_0LBZ0LBZ_0LCA0LCA_1LCB1LCB_1LCC1LCC_1LCD1LCD_1LCE1LCE_1LCF1LCF_0LY0LY_0LCH1LCH_1LCI1LCI_0LCJ0LCJ_1LBT1LBT_0LCL1LCL_1LCM1LCM_0LCN0LCN_0LCX0LCX_0LCP1LCP_1LCQ1LCQ_0LCR0LCR_1LCS1LCS_0LR0LR_0LCU1LCU_1LCV1LCV_0LCW0LCW_1LCX1LCX_0LEP0LEP_0LCZ1LCZ_0LDA0LDA_1LCR1LCR_0LDC1LDC_0LDD0LDD_0LDE0LDE_0LEJ0LEJ_0LDG1LDG_1LDH1LDH_0LDI0LDI_0LEO0LEO_0LDK1LDK_0LDL0LDL_0LDM0LDM_1LDN1LDN_1LDO1LDO_1LDP1LDP_1LDQ1LDQ_1LDR1LDR_1LDS1LDS_0LBA0LBA_0LDU1LDU_0LDV0LDV_1LDI1LDI_0LDX1LDX_0LDY0LDY_1LDZ1LDZ_1LEA1LEA_0LEB0LEB_1LEC1LEC_0LED0LED_0LEE0LEE_0LFL0LFL_0LEG1LEG_1LEH1LEH_0LEI0LEI_1LEJ1LEJ_1LR1LR_0LEL1LEL_0LEM0LEM_1LEN1LEN_1LEO1LEO_1LEP1LEP_1LEQ1LEQ_0LU
# stolen from here: https://amor.cms.hu-berlin.de/~rodrigus/Jupyter%20Notebooks/Solar_System_N-Body_Simulation.html
import numpy as np
import scipy as sp
import time
import scipy.constants as cs
import matplotlib.pyplot as plt
from numba import jit
from numba import cuda
from mpl_toolkits.mplot3d import Axes3D
from astropy.time import Time
# Python 3.9+
# You need to get and put your API key here https://developers.google.com/youtube/v3/getting-started
APIKEY = "XYZYOURSECRETAPIKEYXYZ"
from time import sleep
import csv
import requests
f = open("subscriptions.csv")
@void4
void4 / groundtrack.py
Last active May 23, 2023 21:54
Quickly plot impacting asteroid groundtrack
"""
Dependencies:
find_orb (specifically the non-gui 'fo'): https://www.projectpluto.com/find_orb.htm
pip install pandas plotly
$ grab_mpc obs.txt 2023 CX1
# -E 8 includes ground track latlon+alt
# only with -e generates combined.json i think
from ortools.linear_solver import pywraplp
# Create the mip solver with the SCIP backend.
solver = pywraplp.Solver.CreateSolver('SCIP')
infinity = solver.infinity()
numSteps = 25
shipBuyingPrice = 10
shipSellingPrice = 10
factoryBuyingPrice = 20
int numSteps = 35;
float shipBuyingPrice = 10;
float factoryBuyingPrice = 30;
float workshopBuyingPrice = 50;
float passiveIncome = 1;
float shipIncomeMuliplier = 3;
float factoryIncomeMultiplier = 5;
float workshopIncomeMultiplier = 9;
range Times = 0..numSteps;
float initState_money = 50;
import shutil
from glob import glob
from natsort import natsorted
import os
RESULTF = "results"
os.makedirs(RESULTF, exist_ok=True)
def nextFilename():
import zstandard
path = "test.txt.zst"
class Buffer:
def __init__(self, path):
self.f = open(path, "rb")
self.reader = zstandard.ZstdDecompressor().stream_reader(self.f)
self.buffer = ""