Skip to content

Instantly share code, notes, and snippets.

View segasai's full-sized avatar

Sergey Koposov segasai

View GitHub Profile
@segasai
segasai / final.py
Last active April 4, 2016 16:52
IBM ponders
def func(p):
if p(162) >= 0:
if p(40) >= 0:
if p(135) >= 0:
if p(4) >= 0:
if p(147) >= 0:
if p(1) >= 0:
if p(149) >= 0:
return (1, 149, 150);
import numpy as np
cosd = lambda x: np.cos(np.deg2rad(x))
sind = lambda x: np.sin(np.deg2rad(x))
# cosine and sine in degrees
ra0,dec0=210.,-62.
# initial coordinates
X0 = np.r_[cosd(ra0)*cosd(dec0), sind(ra0)*cosd(dec0), sind(dec0)]
#vector pointing towards the star
@segasai
segasai / data.csv
Created April 17, 2019 23:35
Data for problem 3
X Y E STUDENT
0.08278243391083029 -0.10684129377669312 0.23228013119640514 OD
-0.9803757619114297 3.5347025346415815 0.4377896762183271 OD
0.22258982555702111 0.27600895731531433 0.3220140745914828 OD
-0.4361661429137276 0.45036330148321924 0.9190835739319942 OD
0.5240431847176898 0.2008978887172514 0.5131064457244146 OD
0.2834421939956382 -0.2313860442036691 0.6530096571670552 OD
0.08548550922740672 -0.7959785213567536 0.8085019132279926 OD
0.9341219556671525 4.171329891838006 0.9339981329442264 OD
-0.2966658807917244 0.2771381702831968 0.7896792526235241 OD
@segasai
segasai / data.csv
Last active April 25, 2019 16:16
Data for problem 1 of homework 3
t STUDENT
14.812251272248009 OD
15.94189336946593 OD
14.913469186961699 OD
3.872995329243676 OD
5.397295207514228 OD
8.340992500771973 OD
2.685890604907424 OD
8.218436273560854 OD
12.749965244260185 OD
@segasai
segasai / data.csv
Created April 23, 2020 20:26
Dataset for problem 3
X Y E
0.25656893790551005 -0.5339321432581925 0.6615630051645608
0.38381979342232286 0.2839874939725324 0.19893568097342582
-0.20153213667446557 -1.3861078165146252 0.9845053591896493
0.7571555436036743 1.4838795035056096 0.7010860771863712
0.03620379102694726 -0.5169944710249601 0.5373999715183462
0.8485769621098496 1.9457900069793994 0.5788164546366801
-0.6773901017679056 0.14628386343523947 0.4646716533467433
0.41890945178707417 0.17209814317577327 0.13288509817154112
-0.34355950967910487 -0.4539547617279721 0.185810894809869
@segasai
segasai / part1.py
Last active December 21, 2020 16:12
day18
from enum import Enum
import sys
class State(Enum):
DEFAULT = -1
NUMBER = 1
PARENTHESIS = 2
OPERATOR = 3
year word ncomm16 ncomm50 ncomm84 nposts
2010 made 5 20 31 6
2010 person 5 19 30 7
2010 american 3 19 27 9
2010 hard 9 19 26 6
2010 making 6 18 31 6
2010 feel 6 18 22 8
2010 yes 12 18 23 7
2010 level 5 17 22 8
2010 look 6 17 23 12
This file has been truncated, but you can view the full file.
# MIST version number = 1.2
# MESA revision number = 7503
# --------------------------------------------------------------------------------------
# Yinit Zinit [Fe/H] [a/Fe] v/vcrit
# 0.2490 1.42857E-06 -4.00 0.00 0.40
# --------------------------------------------------------------------------------------
# initial_mass N_pts N_EEP N_col phase type
# 1.1600000000E+00 1710 10 77 YES low-mass
# EEPs: 1 202 353 454 605 631 707 808 1409 1710
# --------------------------------------------------------------------------------------
#include "postgres.h"
#include "catalog/pg_type.h"
#include "utils/lsyscache.h"
#include "fmgr.h"
#include "utils/rangetypes.h"
#include "utils/multirangetypes.h"
PG_MODULE_MAGIC;
def reader(fname):
arrivals = {}
with open(fname, 'r') as fd:
N = int(fd.readline())
for i in range(N):
arr = fd.readline().split(' ')
t1 = int(arr[0])
dt = int(arr[1])
typ = arr[2].rstrip()
arrivals[t1] = (dt, typ)