#ot1-perplexing-regexing

1 messages · Page 99 of 1

solemn tulip
#

using range vs direct comparison is not that interesting of a question when both have the same time complexity anyway

#

this algo is nowhere near the stage of constant factor optimization

little sky
#

Yeah true that but I personally haven't seen range being used in this way and the comparison looks explicit and clear.

solemn tulip
#

idk, the range is as explicit

crystal spruce
#

why are we excluding m == 0 tho

solemn tulip
#

idk why that was changed

little sky
crystal spruce
#

do you take the convention of 0 not being a natural number?

little sky
#

Yeah 0 is a whole number but isn't natural.

solemn tulip
#

you let n include 0 but m not, so at least be consistent

#

including 0 in both won't really change much

#

god, why am I trying to solve this in closed form

#

like, the initial stuff isn't that hard to find out

def repunit(n: int) -> int:
    return int('1' * n or '0')

def repunitsum(n: int) -> int:
    return (repunit(n)*10 - n) // 9

n = 99
sum1 = 7*repunitsum(n+1) - 2*repunitsum(n-1)*10 - 7
num2 = 7*repunit(n+2) - 2*repunit(n)*10
#

but expanding and trying to massage stuff...

crystal spruce
#

I represented it as 7000... + 555.... + 7

solemn tulip
#

that's...a wiser choice

crystal spruce
#

that way your summation index can range from 0 to n-1

solemn tulip
#

oh well, I'm in too deep already

#

god, it's all repunits

crystal spruce
#

which is nice

polar merlin
#

hi

#

can anyone help me with a bash issue

#

i'm trying to run a python app that i create with bash

#

bc it wloud be faster

#

but it gives me this error

solemn tulip
# crystal spruce which is nice

I mean, I have a diophantine equation

n*(68*r(N+1) - 81 + 13*(N+1)) - 9*m == 81 + 9*68*r(N+1)
```but it's not exactly nice 🥴
#

where r = repunit

solemn tulip
#

It's almost like you picked nicer primitives 😛

#

oh wait, your S is not nice, is it?

#

I guess my form will boil down to expanding that S

#

ok, I guess this isn't that terrible when inserting 99

(n - 9)*(68*r(100) + 1219) - 9*(m - 1210) == 0
#

but still

#

I don't think I'll get any closed form solution

#

compute the numbers, solve the diophantine thing to get the solutions

#

should be like O(log something)

brazen ingot
#

yeah I have did this before by hand

#

well imma go sympy simp again

little sky
limpid lynx
little sky
#

113 bytes

limpid lynx
#

so its a draw between yours and ms. take?

#

gift yourself the pizza

little sky
#

by @acoustic moss

#

Will give it to him only I can have anytime lol. Also great try @crystal spruce, the approach was neat.

limpid lynx
little sky
little sky
crystal spruce
#

i did that at first, but i didn't generalize to n, and then i just threw in the towel and did the modulo argument

#

should've continued

little sky
molten crown
#

Can someone recommend a good laptop that doesn't cost too much which is good for a software eng/CS university course?

mortal vapor
little sky
# little sky by <@787351231332483102>

Closing the submissions officially and declaring @acoustic moss as the winner. Let me know what Pizza would you like. Thanks to everyone else who contributed to this discussion.

acoustic moss
#

i uh

#

thanks for the offer but i dont think i can accept 😅

little sky
#

Whyy lol

umbral sparrow
#

@crystal spruce @little sky What math topics would one need to be familiar with to solve this? Just wanting some direction

acoustic moss
#

you have to spot that 75...57 can be written as 7*10^n + 5*10^(n-1) + ... + 5*10 + 7 and then you have to recall the formula for sum of a geometric progression

little sky
umbral sparrow
#

Thanks for the tips

grave cove
#

i'll take pepperoni with no toppings, thanks

acoustic moss
#

nuh uh

tardy rain
#

Pepperoni is a topping

solemn tulip
#

god transcribing stuff in Tunic makes me feel so dumb

#

in my dumb serialization I came up with I get a word like fu:ah-l:o

#

fuahlo

#

follow

#

mahnolith

solemn tulip
#

kyoob

karmic gust
#

look up the english IPA alphabet if you're not already using it

solemn tulip
#

homebrew IPA

solemn tulip
brazen ingot
#

hebrew is very hard to read

solemn tulip
#

is there a sensible ascii IPA flavor? pithink

young shoal
#

India pale ascii

honest star
# solemn tulip

Pls, I should not still recognize that much tunic. It's been mooonths since I played it

drowsy rose
grave cove
#

bro got cooked

thick ore
#

who sinbad

tardy rain
#

Sinbad was a mythical arab sailor and whatnot

solemn tulip
#

putting insights into code, which means that I could analyze patterns in the insights

#

like implementing merging of glyphs, which together with a bunch of previous collected data and a dumb double for loop cracked things for me

#

oh yeah, and terminal rendering of images of tunic text, with the associated latinized sounds underneath, I disabled that part for the image above to avoid spoiling too much

solemn tulip
drowsy rose
severe wadi
#

@mystic drift

#

sending here

mystic drift
#

wqow

severe wadi
#

kmn 😭

mystic drift
#

Beautiful code

severe wadi
#

I was obsessed with nesting classes

mystic drift
#

I just shed a tear

#
if self.meele else "it's a blunt."
#

Was particularly beautiful

severe wadi
#

LMAO

mystic drift
#

you would have a heart attack

#

with my code back when I started

severe wadi
#

from another project i made around the same time

mystic drift
#

IS THAT

#

A PERCY JACKSON REFERENCE

severe wadi
#

yas

#

the file name is literally pj.py

mystic drift
#

oh god what is this gif

#

is this the new percy jackson disney thing

severe wadi
#

omg I found a programming langauge i tried to make super long ago

#
variables = {}
mode_map = {0: int, 1: float}

with open('code.tusc', 'r') as f:
    for line in map(lambda i: i.strip(), f.readlines()):
        tokens = line[0], line[1:]
        secondary_tokens = tokens[1].split(',')
        if tokens[0] == ')':
            for secondary_token in secondary_tokens:
                a, b = secondary_token.split('=')
                if '|' in b:
                    b, mode = b.split('|')
                    mode = int(mode)
                    b = mode_map[mode](b)
                variables[a] = b

        if tokens[0] == '+':
            for secondary_token in secondary_tokens:
                var, val = secondary_token.split('|')
                if val in '0123456789':
                    variables[var] = mode_map[int(val)](eval(variables[var]))
                else:
                    variables[var] = variables[var].replace(val, f'({variables[val]})')

        if tokens[0] == 'v':
            for secondary_token in secondary_tokens:
                var, val = secondary_token.split('|')
                variables[var] = round(variables[var], int(val))

        if tokens[0] == '\\':
            print(variables[tokens[1]])
mystic drift
#

proper programming

severe wadi
mystic drift
#

I <3 OOP

#

Actually can I make a shirt out of that

mystic drift
#

thats a W

mystic drift
#

my code was even worse

severe wadi
#

lmfao

#

yandere code moment

mystic drift
#

if 
  if 
    if
    elif
        if 
    elif
      if 
else
#

my average function

severe wadi
#

i defo have some of those

#

wait I'm looking for my original pokemon program

#

i loved it so much

mystic drift
severe wadi
#

i made my own docstring format? ```py
"""
Variables:
1. {fraction} = {variables}[0] || objects.misc.Fraction(3, 3)

Test cases:
    {cases}
    OR
    1. {fraction}.value == 1
    2. {fraction}.decrease_value.value == 3/4
    3. {fraction}.increase_value.value == 4/3
"""
vale raven
#

Why?

mystic drift
#

embrace arbitrary code strings

severe wadi
mystic drift
#

you were cooking

severe wadi
#

I used to write tests 🥹

vale raven
#

What’re “tests”?

mystic drift
#

my tests was literally using print

#

and seeing if the thing was going where i wanted it to

severe wadi
#

omg this is so cool. I found some code I wrote, then a shorter version i wrote later, then an even shorter version i wrote even later

thick osprey
vale raven
#

I glanced at the right side!!

#

I just keep forgetting you have to click again to see all files

thick osprey
#

The right side?

severe wadi
#

just opened a file that started with this

vale raven
# thick osprey The right side?

GitHub’s new symbol view
You click on a symbol it shows you the matches in your current file
You click again to “find in all files”
I keep forgetting to click again

vale raven
#

Wait what

#

No way

thick osprey
#

.xkcd 1053

median domeBOT
#

Saying 'what kind of an idiot doesn't know about the Yellowstone supervolcano' is so much more boring than telling someone about the Yellowstone supervolcano for the first time.

vale raven
vale raven
#

Or does it only search the current state?

thick osprey
#

It will find anything in tracked files. I think it respects the --staged flag too for looking at stage.

mystic drift
#

bruh,

#

I just lost the opportunity to become a pilot.

#

sadge.

vale raven
#

You got glasses?

mystic drift
#

I do

#

since I was 12

#

But apparently, the government is giving free classes for CPL

#

Which is super duper expensive to get

#

But they require you to have a degree or close to getting one.

#

I'm literally 1 semester short.

#

Because my university is on a strike

#

I'd switch careers in a heartbeat idc

#

I love aviation and flying

vale raven
#

See if you can get them to make an exception

mystic drift
#

fat chance

#

the signup period goes to the end of this month

#

and my semester ends like, two months from now (according to my schedule, it will take longer ofc because of the strike)

#

man what a L.

low chasm
elfin holly
#

I personally work by many principles, but one of them would be: "Certain words, when put in a specific order, can convince anyone of anything", the key is to know which words to choose and how to order them

#

so you can shoot your shot and try to register there, but make sure to choose your words carefully

low chasm
#

yeah I'd still give it a go

#

worst case scenario it doesn't happen, but what if it does?

mystic drift
#

So long as you see perfectly when using them

low chasm
#

I see

limpid lynx
#

@steady jacinth hey pecky long time no see, how is the notepad coming along

steady jacinth
limpid lynx
#

get to it later then when its all over

#

all the best with your exam

#

if i get to know youre getting distracted

#

imma start pinging you everyday again

steady jacinth
limpid lynx
wanton delta
vale raven
solemn tulip
#

git doesn't even store this info right?

#

iirc it kinda just figures out that files were moved by similarity

#

or did you just mean that avoids a lot of git adding?

#

with jj it's just plain mv to accomplish the same thing 👀

gritty zinc
#

i'm not totally sure why, but I think it's because having the diff detect moved files requires a flag (it's not the default behaviour)

solemn tulip
grave cove
#

I don't know how git would even track that

#

Without you telling "I moved this file from here to there"

latent pewter
#

huh

lime oyster
#

Howdy! How do I go about writing a proof to the following lemma?

brazen ingot
lime oyster
solemn tulip
#

iirc git does try to reconstruct some stuff like this based on diffs

tardy rain
#

Spotify when it drudges up my cringe shinedown playlist from 2015

tardy rain
#

theyre ok, kind of crybaby depression rock
https://youtu.be/MLeIyy2ipps?si=EcbKfKCaIAEPASaI

The official video remastered in HD for Shinedown's "45" from the album, 'Leave A Whisper' - available now on Atlantic Records. Download it now at http://apple.co/1AYKs5n

Order or save your copy of Shinedown’s new album ‘Planet Zero’ out now: https://shinedown.lnk.to/PlanetZero

Stream or download Shinedown essentials here: https://lnk.to/Shine...

▶ Play video
#

.randomcase staring down the barrel of a .45 🎵

median domeBOT
#

STArinG dowN ThE barrel oF a .45 🎵

tardy rain
#

(i've never held a gun in my life)

fresh basalt
#

what about falafel?

#

Have you held falafel?

#

Falafel is better than gun

#

It will make you fat if you eat too much though.

#

Also not great to eat fried food all the time.

#

Which is the cruelest joke.

#

Because fried food is so good.

#

And really who wants to live forever anyways?

tardy rain
#

not the biggest falafel fan

#

i like meat

fresh basalt
#

Meat will also kill you.

tardy rain
#

not if i kill it first

fresh basalt
#

No, it will get you in the end.

#

I saw a video of an orangutan chewing some leaves and applying it as a poultice to a wound on its face.

#

Isn't that awesome?

#

It learned how to do that.

#

It wasn't genetic or instinct.

#

I'm not surprised. I just thought it was awesome.

#

It's easy to question an entity's intelligence if you don't comprehend its behavior.

#

Chimps go to war.

#

Chimps are more vicious than gorillas.

#

I think the clip of the orangutan might be in there actually.

#

It's interesting because they patrol their territory.

#

Well that's one of their interesting behaviors.

#

They basically move quietly through the jungle stalking their territory. If they find an "intruder" they'll kill it.

grave cove
#

would you rather be with a bear or with a monkey

fresh basalt
#

What type of monkey?

grave cove
#

i wasn't aware there were multiple types of monkeys

fresh basalt
#

:O

#

Monkey is a common name that may refer to most mammals of the infraorder Simiiformes, also known as the simians. Traditionally, all animals in the group now known as simians are counted as monkeys except the apes. Thus monkeys, in that sense, constitute an incomplete paraphyletic grouping; however, in the broader sense based on cladistics, apes ...

#

Robin there are so many

#

Bears are not dumb.

carmine apex
#

a bear can likely kill with a single swipe of its paw

carmine apex
#

there are bears that attack even when not hungry

fresh basalt
#

torturing how?

carmine apex
#

i don't think sadistic behavior has been observed in monkeys. a few aquatic species, sure

fresh basalt
#

I wonder if monkeys find it funny to urinate on people walking on the ground below.

#

I mean, it is.

#

Tell your friend to walk under a tree with a monkey in it.

#

I've seen videos of monkeys crawling down out of trees and playing with human children.

#

capuchin I think

#

I mean it was local natives.

#

South America somewhere

#

They are probably used to each other.

#

sure

#

I would never really try to pet a wild animal or otherwise interact with it.

fresh basalt
carmine apex
#

i mean, zoos exist, and some of the exhibits permit touching

vale raven
#

I have an entire YouTube channel of me and my dog petting a stray cat

fresh basalt
#

Stray cats are not exactly wild.

#

Not in the sense that a mountain lion is wild.

vale raven
fresh basalt
#

Giraffes have gigantic tongues.

carmine apex
#

some critters are also less dangerous than others. you can treat a giant constrictor with less fear than a cougar, for example

fresh basalt
#

Reptiles are dope.

#

When I was a kid I got to hold a long albino boa that was like 7 feet long

carmine apex
#

it greatly saddens me that a snake cannot hear itself being complimented. at best, the vocal tones might be soothing, though

fresh basalt
#

For a long time when I was a kid I wanted a chameleon as a pet but they are very hard to not kill.

#

So I had a dog instead.

grave cove
fresh basalt
jovial oriole
#

Teapot

weak peak
#

418?

soft violet
#

Are you little, short and stout?

forest linden
#

Hello

#

What's good

forest linden
#

I like her because she's so elegant and subtle

#

I just love it

tardy rain
strange blade
#

t series quivering in his boots

grave cove
forest linden
grave cove
#

no you're supposed to send pics

limpid lynx
#

im trying to help someone but im not very good in python

grave cove
#

depends

#

tell them to make a help post

limpid lynx
forest linden
grave cove
#

🥺

paper sequoia
limpid lynx
#

looks like a racoon but cute

#

dont get me wrong, racoons are cute too

forest linden
forest linden
limpid lynx
forest linden
#

Idk wet raccoon smells bad imo

limpid lynx
#

then just dry it lmao

paper sequoia
#

fluffy triangle

grave cove
limpid lynx
#

loks very nice

grave cove
frozen crane
paper sequoia
#

👀 they must send cat pick now

forest linden
grave cove
frozen crane
limpid lynx
#

dem blue eyes ✨

grave cove
#

he is so cute

frozen crane
grave cove
#

🥺

limpid lynx
#

i want a black cat with emerald green eyes

paper sequoia
#

This channel has now been claimed by cats

limpid lynx
frozen crane
limpid lynx
#

cool

forest linden
#

Has someone seen Wilfred the warrior cat, he's so cute ong

limpid lynx
#

but why he outside tho

forest linden
#

Idk why he gets so much hate

#

...

#

Cobra?

limpid lynx
#

im not on social media so i didnt know about it

#

looks cool tho

forest linden
#

Okay, yeah my little brother showed it to me

#

When I was 15

#

I like him tbh

#

I'd keep Wilfred as a pet

#

Wow this chat went silent

limpid lynx
forest linden
#

Lol same happens with me on every other server

limpid lynx
#

i wanna keep snakes as pets

#

i love snakes

#

anyone has snakes? send pics

grave cove
frozen crane
young shoal
#

does he kill

limpid lynx
frozen crane
frozen crane
wild valley
#

Any teenager here

#

Bro I am 15

frozen crane
wild valley
#

My github

limpid lynx
limpid lynx
frozen crane
wild valley
#

Everywhere

fresh basalt
#

AFAIK online services (at least in the US) require a minimum age.

limpid lynx
fresh basalt
#

I think that's federal law.

limpid lynx
#

i meant an upper age limit

fresh basalt
#

I could be mistaken.

frozen crane
limpid lynx
#

not a minimum age

limpid lynx
fresh basalt
#

My mom's cat chitters at the birds outside the window.

#

She'll sit on the window sill and watch them.

limpid lynx
#

is it black?

fresh basalt
#

orange tabby

limpid lynx
#

i see

frozen crane
limpid lynx
#

how many servers are y'all in?
im in 2- this and my irl friend group

young shoal
#

coppa

fresh basalt
#

Why do we make acronyms for our laws?

#

Some of them are so silly.

young shoal
#

i think it's child online privacy protection act

fresh basalt
#

yeah

#

and the USA PATRIOT act is "Uniting and Strengthening America by Providing Appropriate Tools Required to Intercept and Obstruct Terrorism"

young shoal
#

it's a nice name to be fair

jovial oriole
#

Just proved the riemann hypothesis as false, average thursday.

#

I wonder if I'll be able to finish my 16-MiB all operation quantum computer by the weekend 🤔

acoustic moss
#

no match for hrl

harsh tundra
#

Going on trip with two people who love walking is a pain. Literally. Everything hurts.

Comparing my normal step counts vs today. 31k steps, almost 20km on foot

vale raven
#

.wa 20km to m

median domeBOT
vale raven
#

oops

#

oops x2

vale raven
#

What's your normal distance?

harsh tundra
vale raven
#

A 12 mile day is a normal weekend for me
5 mile route in the morning, around the block for lunch, 5 mile route again before bed

#

I've heavily fallen out of my routine, now I can barely get out of bed, but I used to regularly go a third time

#

I'm embarassed to see how far I've fallen
Now I'm lucky if my counter says 2 miles

harsh tundra
#

My normal step counts are usually 3-4k, idk the distance (I'd need to browse them day by day).
Some on the graph are skewed because I didn't wear my watch

If we do exercise with my partner, it's usually cycling, not walking

#

But the food was good :3 langos

grave cove
#

me out here with the 50 steps per day

jaunty wraith
fresh basalt
#

What cheese is that?

vale raven
#

That looks like sacrilege

harsh tundra
#

Idk, ask the Hungarians, we're just visiting XD

vale raven
#

Who puts cubed meat on tostadas?

fresh basalt
#

That's not a tostada

harsh tundra
#

Lángos (Hungarian pronunciation: [ˈlaːŋɡoʃ]) is a typical Hungarian food. Nowadays it is a deep fried flatbread, but in the past it was made of the last bits of the bread-dough and baked at the front of a brick or clay oven, to be served hot as the breakfast of the bread-baking day.

jaunty wraith
#

looks good

fresh basalt
#

Is the white base sour cream?

vale raven
fresh basalt
#

It's not quark is it?

harsh tundra
#

I got "farmer's" or something like that. Cream, onions, meat

jovial oriole
#

Yes, its about 0.00013% of my net worth (liquid)

#

So i just donated to charity

fresh basalt
#

motherfu....

#

I can't find a single langos recipe that doesn't just say "grated cheese"

#

any Hungarians in the channel? :P

jovial oriole
#

me

#

im hungry

grave cove
#

im not a hungarian but i am pretty hungry

fresh basalt
#

🔪

harsh tundra
jaunty wraith
jovial oriole
grave cove
jaunty wraith
#

yes

jaunty wraith
harsh tundra
#

Forgot to pause for the langos eating part, then finished the walk when we chilled in the park... And then I didn't start another tracking :c

grave cove
#

i am rapidly approaching your location

harsh tundra
#

Sure

#

We're far from home anyways

#

Oh, wait, I didn't have to zoom in, this route started from the post

grave cove
#

spiderman reference

harsh tundra
#

I also tried to befriend a crow... And a lot of crows appeared when they noticed food

hexed sierra
#

right at the scene of the murder

young shoal
#

bannable pun

quick ledge
#

!ban @hexed sierra

royal lakeBOT
#

@hexed sierra has an elevated role. Are you sure you want to ban them?

quick ledge
#

😔

hexed sierra
#

cancelledd

jaunty wraith
paper sequoia
#

No more accidental staff bans?

#

Or were they "accidental"

polar vigil
#

What?

harsh tundra
paper sequoia
#

Ye, but iirc some helpers were accidentally banned

harsh tundra
#

Rem was accidentally banned before becoming a helper...

acoustic moss
#

sure, "accidentally"

limpid lynx
paper sequoia
acoustic moss
#

vivek banned mina

limpid lynx
#

can you remove my voice verified role

acoustic moss
#

only admins can

limpid lynx
#

bruh

acoustic moss
#

leaving and rejoining would also work

#

why do you want to remove it

limpid lynx
glossy niche
#

i wrote multi threaded python code the other day taht i will push to master

#

i feel like this is rite of passage for becoming a real programmer

#

all those years of leet code have paid off

thick ore
glossy niche
harsh tundra
paper sequoia
#

(2 messages below the link)

harsh tundra
#

👍

#

I try not to scroll too much because I'm outside my country and using roaming

#

Btw

harsh tundra
#

Hungary

scarlet peak
#

who you with

#

i see other plates

harsh tundra
#

My partner and my best friend

scarlet peak
#

go enjoy yourself and get off your phone 🗣️

harsh tundra
#

We're all currently on our phones because we're stuffed and can't move XD

scarlet peak
sleek stump
#

hi guys

harsh tundra
harsh tundra
#

Hello from Gellért Hill!

hexed sierra
harsh tundra
#

Please do, I don't know if I will manage to get down

#

Sunset

meager sphinx
#

gyus i need spotify playlists , my music taste sux

meager sphinx
harsh tundra
meager sphinx
#

thanks for the recommandations 👍

harsh tundra
#

Thank Instagram for first suggesting it to me XD

#

Were waiting for the city to light up :3

rough sapphire
#

wish I could have a view like this on my city blobpain

harsh tundra
#

If you're ever in Budapest, then Gellért Hill is a must-go in the evening

#

Some lights are on

harsh tundra
meager sphinx
rough sapphire
harsh tundra
#

Going down now 👍

little sky
jovial oriole
#

@unborn dew

#

Yo what u doing here

unborn dew
#

How did you find me😳

limpid lynx
limpid lynx
unborn dew
fresh basalt
#

Discord even makes it pretty easy.

unborn dew
#

Too late, I've grown attached to it

limpid lynx
marble bay
#

you are bound to like atleast a few songs in there lmao

limpid lynx
marble bay
#

I shall not tell you what they are cuz rule 1

#

it's a fun egg hunt

limpid lynx
#

judging from the song names, this is the worst i found

#

another was she said plan b

marble bay
#

from the 100 discord shows

#

there's ~4000 more

limpid lynx
limpid lynx
marble bay
acoustic moss
#

100 songs and ive only heard 4 of them before 💀

limpid lynx
#

i thought my 500 song playlist was big

limpid lynx
#

have you listened to the whole thing start to finish?

#

obviously not in one sitting

marble bay
marble bay
#

as previously stated, I listen to music most of the time I'm awake

#

I don't usually put on everything though

acoustic moss
marble bay
#

I pick a few songs I'm in the mood for and loop em

marble bay
limpid lynx
#

guys drop how many people you have blocked on discord

#

i have 83

marble bay
#

4

limpid lynx
#

oof

acoustic moss
#

10

soft violet
#

I have zero users blocked.

harsh tundra
#

12

lament cairn
#

10

lament cairn
fresh basalt
#

It's less stressful than dealing with the blocked people.

#

A number in my blocked list for here are probably not even on the server anymore so I don't see any traffic from them.

limpid lynx
limpid lynx
fringe rain
#

I don't block people, I keep them as a reminder as to why I avoid certain places

limpid lynx
fringe rain
#

I'm not on that many servers

limpid lynx
fringe rain
limpid lynx
#

i actually accidentally left my friend's server lmao

fringe rain
#

Dang

#

I mean this and the Rust server are the only ones I like using

limpid lynx
#

i have 8

fringe rain
#

32

limpid lynx
#

only 1 open dm lmao

#
  • Hello
  • i just discovered putting a minus sign makes it into a point
meager sphinx
meager sphinx
meager sphinx
meager sphinx
paper sequoia
#

I'm trying to understand cloudflare... If I own a domain, say "example.com" but don't have a vps. I should be able to use cloudflare to self host some app, say fastAPI app, but wouldn't my IP be exposed there then?

lament cairn
paper sequoia
#

Yes I guess

lament cairn
#

"I guess" - that doesn't sound like a yes to me

lament cairn
paper sequoia
#

Having something run in my own computer and exposing to cloudflare

lament cairn
#

Either way, if you set it to be proxied, you'll be protected

paper sequoia
#

I'm not too sure exactly, I was trying to understand how it all works and quite confused

lament cairn
#

orange cloud = traffic goes through CF
grey cloud = no proxying, exposes IP through DNS

#

when it's proxied, your IP will be hidden. on DNS records it'll show cloudflare's ip, not yours

paper sequoia
#

So there would be no way for someone to know my IP if it's proxied?

#

Right, what about when the app is not running? The web should be down and again no one would see my IP?

raw orbit
#

thats crazy ironic

paper sequoia
raw orbit
#

nah nah i saw that pikachu

lament cairn
vale karma
#

Can anyone help me with my IT homework?

paper sequoia
lament cairn
paper sequoia
#

Do I need any configuration to router or anything for it to work?

paper sequoia
lament cairn
# paper sequoia Do I need any configuration to router or anything for it to work?

there's two ways to do it

  • expose your app to the internet with port forwarding and all that stuff, then set your domain's A record to your IP and the proxy status to Proxied
  • use cloudflare tunnel https://www.cloudflare.com/products/tunnel/

Connect applications, servers, and other resources to Cloudflare's network via encrypted outbound tunnels. No publicly routable IPs or VMs required.

paper sequoia
#

The tunnel would be the way to go I guess, that's the proxy one?

#

Oh.. I didn't see the edit

lament cairn
#

tunnel is just a way to make services available through cloudflare without having a public IP

#

like if you were behind CGNAT or something

paper sequoia
#

I see, so port forwarding is required. Then I likely should set up firewall rule to only allow cloudflare just in case

lament cairn
#

if you're going with the standard DNS way then yes you need to port forward

#

allowing only cf works, it's what I have set up

#

my webserver drops any non-cf connections

thick ore
lament cairn
thick ore
#

nginx ⁉️

lament cairn
#

nginx‼️

paper sequoia
lament cairn
paper sequoia
#

I might just be understanding things very wrong here...

lament cairn
# lament cairn i think i explained it badly, let me type a better explaination

both options will hide your ip
cloudflare tunnel tunnels traffic through a special service running on your server, which is why it doesn't require port forwarding
the DNS method hides your IP as long as the record is set to Proxied. for this, cf needs to be able to reach your web server over the internet with your IP. that's why it requires port forwarding

#

both methods will appear to the final user and in public DNS records as if Cloudflare theirselves were hosting it, but whenever someone accesses your site, CF forwards the request to your backend

paper sequoia
#

Ooh now I get it, in the end both are in that sense secure but one requires port forwarding and being sure it's set to proxied. Which one would you recommend?

lament cairn
#

Tunnel requires a bit of setup but I think it's more convenient as you don't have to touch your router settings

paper sequoia
#

That would be convenient

lament cairn
#

Tunnel runs in the background as a service

#
  • it guarantees requests will always go through cloudflare
paper sequoia
#

That sounds good, without domain though it would not work right?

lament cairn
#

which isn't the case with IP + DNS (unless you configure your firewall to only allow cloudflare ips which takes more work and blah)

lament cairn
paper sequoia
#

Ye figured, there are some record and stuff there

#

I think I'll try roll in to GitHub student again, to get a domain

lament cairn
#

you need to be able to change your nameserver to cloudflare's

#

does gh student allow that?

#

like, do you get a domain 100% for yourself, dns and everything?

vale raven
thick ore
#

oh man the gh student pack

thick ore
#

they give you a free .tech domain with DNS n stuff

paper sequoia
#

Also one thing I'm curious about is if the request to my server comes from cf, can I see the IP of who originally requested that? If so, can I somehow block IPs there?

vale raven
#

So yeah, you get everything that NameCheap offers

lament cairn
paper sequoia
#

I could also just get a domain for few bucks a year from namecheap

lament cairn
#

cloudflare is also a registrar

#

they're cheap. in fact, they're as cheap as it can get
the domains cost as much for you as it costs for them - no additional markup

paper sequoia
paper sequoia
#

I didn't know that

lament cairn
#

namecheap has first year discounts, then they get you with the renewal prices

paper sequoia
paper sequoia
lament cairn
#

well, technically yes since there's one more server between you and the user, but it should be minimal

lament cairn
thick ore
#

like that's a bad thing

#

lol

lament cairn
#

yeah lol

paper sequoia
lament cairn
#

exposing anything to the internet these days without cloudflare is asking to be ddosed

paper sequoia
#

I definitely need to re-do the security of my API to ensure nothing is leaked before exposing anything

lament cairn
paper sequoia
wanton delta
#

cloudflare would not have existed had humans acted civil

lament cairn
wanton delta
#

good point

lament cairn
#

actually cloudflare would have existed still, they're a CDN

wanton delta
#

o yeah

paper sequoia
#

I'm still figuring out if it's good idea to have docker containers and have those exposed to or do I need to run them locally completely

#

And if I do docker, do I need additional setup/security wise setup

#

I seen some being able to pull secrets out of containers if they are ran in place x, but if the request is forwarder by cf, is the content only?

#

Would one even be able to do network scan against the domain, for stuff like services running in it via nmap or something

lament cairn
paper sequoia
lament cairn
#

yes

paper sequoia
#

I been meaning to learn about that so this sounds good

#

Should I / Do I need any firewall rules there just in case?

lament cairn
#

ehhhh if you're going with tunnel no

paper sequoia
#

Sounds perfect!

lament cairn
#

you won't be exposing your web app to the public internet, it'll be a secure connection between you and cloudflare

paper sequoia
#

Right

#

Hmmm

#

And only basically the content of request is forwarded?

lament cairn
lament cairn
paper sequoia
paper sequoia
lament cairn
paper sequoia
#

Maybe I should protect the /docs endpoint with basic authentication

lament cairn
paper sequoia
lament cairn
# lament cairn I disable it in production
app = FastAPI(
        ...,
        docs_url=None if settings.environment == "prod" else "/api/docs",
        redoc_url=None if settings.environment == "prod" else "/api/redoc",
        openapi_url=None if settings.environment == "prod" else "/api/openapi.json",
        ...,
    )
paper sequoia
lament cairn
paper sequoia
#

Oh, closed API

#

The docs I serve allow testing the stuff directly in the browser and also show the server it's running in, so I might just close them completely

paper sequoia
lament cairn
#

simplest valid config looks like this

server {
  server_name example.com;
  listen 80;
  
  location / {
    proxy_pass http://localhost:8080;
  }
}```
paper sequoia
#

Huh, that simple

chilly beacon
#

guys suggest a good low load browser
for debian

#

firefox is terrible

lament cairn
#

oh, in tunnel you can specify what host and port the tunnel service should request when a visitor accesses your website. so it doesn't have to on port 80

#

debian? bad? no way

paper sequoia
#

What do you use for blocking IPs from accessing your API? Do you just set firewall rule to block them or just some middleware for it? If you do any rate limiting

paper sequoia
chilly beacon
#

i only have 4gb ram

paper sequoia
#

Oh and Thanks a lot for explaining this topic! It was really good and easy to follow, thanks for all the info. Thank you 😄

tardy rain
#

@solemn tulip joost got DQ'd

#

Over allegations

paper sequoia
solemn tulip
tardy rain
#

Invalid bet

#

If they don't compete I'm not paying

lament cairn
jaunty wraith
#

cat!

solemn tulip
#

like, discord electron? that uses a bunch of memory on its own

#

if it's about discord in firefox, aren't browsers usually pretty good at adapting to your machine?

#

i.e. it will try to adapt to the overall load to the machine and the available resources

lament cairn
#

in my experience firefox scales well with many tabs open
where chrome/chromium's ram usage explodes with too many tabs, firefox is fairly stable

vocal oyster
#

honestly people worry about RAM usage way too much

#

only worry if you reach 99% and programs just aren't releasing RAM

lament cairn
#

"unused ram is wasted ram"

vocal oyster
#

yes it is, you get decent speed ups by having browsers cache recently visited things

#

if the RAM is unused why not use it for low priority stuff like that

#

browsers can clear out old tabs and have them on standby almost if there really is not much RAM

#

but generally it is just a non-issue

harsh tundra
#

In the past (I'm thinking my high school days) it was literally a memory leak - the ram usage for Firefox would spike and slow down whole computer. Kill, start up - worked great again

low chasm
#

@acoustic fern for the most part, I didn't actively dislike RustRover - it didn't crash as often as rust-analyzer, for example. What really turned me off was the lack of being able to automatically run project wide analysis on your code, and then have the editor point out which files have those errors within the file tree, for example. It'd analyze the current file fine, but if I wanted a project wide analysis, I'd have to manually run one, and one thing I like about VSCode is that it highlights on the file tree which files have errors, so I can pretty quickly navigate to them. So, if I'm changing an API for example, I want to immediately know where in my code stuff broke, so I can jump to it and fix it. I wasn't fond of having to run the project wide analysis manually every time.

acoustic fern
low chasm
acoustic fern
low chasm
#

good luck

wraith hound
#

the experience with rust-analyzer and rustrover/intellij-rust is a mess. most people find r-a flawless (or at least pretty good), but for some folks it crashes constantly for no discernable reason.

#

but rustrover and intellij-rust have historically had their own set of issues iirc

#

i think they weren't super great at proc macros? but i'm not 100% sure on that

#

also rustrover is going to be paid eventually :(

low chasm
fresh basalt
#

github "the first one is free" pack

young shoal
#

just get a job

tardy rain
#

If you get a job everything becomes free

#

Your employer just pays for it

vale raven
#

You use your work account at home?

fresh basalt
#

c o r r u p t i o n

warped sentinel
#

Main issue for me is that all your work are belong to us for anything done with company time, resources or related to the company's business.

#

(overall definition, specific to each country/contract)

fresh basalt
#

That's why I always thought Google's "work on personal projects here, it's cool" attitude was sus.

vale raven
#

Everything I use at work, (that’s not ridiculously expensive*) I also pay for my own copy at home.
Not going to have all my shit disappear when I quit/get fired.
I also use it as a lab environment to test things out.

fresh basalt
#

That's probably why you have -$28 in your bank right now.

young shoal
#

💀 💀 💀

young shoal
#

well, for some definition of "amusing"

thick ore
#

just figured out how to use an nginx

#

it's very cool

uneven pine
#

nginx is great, at least compared to apache

#

I'm not a fan of the "proprietary" config format but it does work very well

lament cairn
#

better than whatevr tf apache has

uneven pine
#

XML

#

If I remember correctly at least

wary stump
#

ih

#

hi

#

why cant i speak in voice channel?

strange blade
#

You must reach the requirements listed in the channel.

#

I recommend being active in this server for a couple of days. Spamming will get you nowhere, and it might even get you voice-muted.

wary stump
#

ok thanks

#

Yes I know

strange blade
#

Pretty sure you're only supposed to be on discord when you're 13

wary stump
#

yes

#

thus i was kicked out of the server and then discrod

#

discord

#

i joined it in 2019

#

As i revealed my true age, they removed me

summer knot
#

oh, it's a mobile game called Onmyoji, I like the artwork and character designs

#

I'm not actually a big game player, but I found the art for it really excellent

dark epoch
jaunty wraith
#

the easiest way would be an autocommand to set ft=lua for luau files

chilly beacon
#

xfce4 looks trash

#

can i change my de without reinstalling my distro

jaunty wraith
dark epoch
#

ah, it works

dark epoch
rough sapphire
#

i am making a symbolic mathematics ai. its able to solve integrations, trigonometry and recently even geometry. if someone want to contribute to that project. they can ask me.

narrow quiver
#

I am writing a route as:

@app.post("/get-indices")
async def get_indices(
    job_id: int,
    indices: List[str],
    temporal_extent: List[str],
    spatial_extent: List[List[float]],
    max_cloud_cover: int = 30,
):
    # Define the field geometry as a GeoJSON feature
    fields = {
        "type": "Feature",
        "properties": {},
        "geometry": {
            "type": "Polygon",
            "coordinates": [spatial_extent],
        },
    }

    return {message: "some_result", status: 200}

and I am getting error like:

{
    "detail": [
        {
            "type": "missing",
            "loc": [
                "query",
                "job_id"
            ],
            "msg": "Field required",
            "input": null,
            "url": "https://errors.pydantic.dev/2.6/v/missing"
        }
    ]
}

I am sending everything in body from postman, not sure where i am doing wrong? Why is job_id being expected in the query when it shud be expected in the payload

rough sapphire
#
(((cos(x)^2)+((1+sin(x))^2))/((1+sin(x))*cos(x)))
(((2*sin(x))+2)/((1+sin(x))*cos(x)))
((2*(1+sin(x)))/((1+sin(x))*cos(x)))
(2/cos(x))``` my ai solved 10th grade ncert math book problem.
wanton delta
severe laurel
#

any way i could add an option to this list for a specific app to basically act like a shortcut?

jovial oriole
#

Dang

gritty zinc
#

it's possible because I've seen a powershell snippet that adds an "open in windows terminal" option there

#

involved regedit though

#

ah, not sure actually, it seems to be unblocking an existing one

harsh tundra
# severe laurel any way i could add an option to this list for a specific app to basically act l...

https://stackoverflow.com/questions/20449316/how-add-context-menu-item-to-windows-explorer-for-folders
The question itself is for folders, but the person links several things that they claim they tried and they're able to make it work for files. So I guess a mix of answers there (to understand the structure of related registry entries?) and the links provided could help?

cobalt remnant
#

I've encountered the first "bug" in my vscode offline downloader script
killjoy1221/dlvsix#1

median domeBOT
torpid slate
harsh tundra
grave cove
#

pretty sure the gh student pack gives you azure credits

torpid slate
harsh tundra
torpid slate
#

Like I m in uni. They didn't give us mail

#

So I m unable to claim student pack

harsh tundra
grave cove
#

your university doesn't give you an email?

torpid slate
grave cove
#

strange

#

well, at least in the US. maybe it's more common outside the U.S

torpid slate
#

Nahh... My uni sucks

grave cove
#

it is how it is

frozen crane
#

@torn python there's almost certainly going to be a third Dune movie. The first two were about the first book, and the third will be about the second book.
there are books after the second, but the second is the end of Paul's arc.

paper sequoia
dark epoch
#

Using neovim, i've installed a language server using mason, but how do i actually run this? I'm using lack of text theme being applied to the files as an indicator that the language server isnt running, whereas my .lua files have text theme applied

ancient minnow
#

Any js nerds here?

#

I'm trying to do some hacking thing where I request a specific url using fetch

#

But the source im fetching from actually wants has "cors" mode enabled

#

Now if the url exists it shows up in my chrome devtools as status code 200, if it doesn't exist it shows up as status code 400

lament cairn
ancient minnow
#

Here comes the weird thing, because I'm forcing no-cors on this url, fetch always return a response with code 0

#

But the preflight throws an error: net::ERR_ABORTED 404 (Not Found) if the url doesn't exist

#

I have tried to catch this error

#

I have tried to even make an event listener on console.error

#

But there is no way for some reason to check whether the url exists or not

#

For more clarification

#

Like you see I do 2 requests

#

1 where the url exists

#

And one where it doesnt

#

It only throws the 404 once

#

Chrome devtools network tab

#

For both requests

harsh tundra
paper sequoia
harsh tundra
#

My uni would give you confirmation document in Polish or English that you're a student upon request, it should be the same in any school

paper sequoia
#

I don't remember when that started tho, not a new thing iirc but wasn't when I first registered

paper sequoia
paper sequoia
harsh tundra
paper sequoia
#

I wonder when they started doing that

harsh tundra
#

Debit usually also works for those, you can even get virtual card that are pre-paid instead of connected to your account - so you just fill it with small amount and use it for online stuff

paper sequoia
#

In my case it was just school email and fill few fields on how you would use it and such, no other proof was required which was great and maybe crazy (this was like, what, 3 years ago now??)

paper sequoia
harsh tundra
#

People in my uni group would do the gh pack several times - because as long as you had uni email, the process was basically automated (no other proof needed) and we had several aliases, like surname+first letter of name@domain, name+dot+surname@domain, studentnumber@domain...

paper sequoia
#

Btw, do you use any of those virtual cards?

#

Trying to find some info about them in general to see if I could use them

lament cairn
#

check your bank app

#

my bank lets me create temporary and virtual cards

#

ymmv

paper sequoia
#

Alrd did, they don't seem to offer such afaik

#

Kinda sucks 😔

#

One I have heard about is "privacy.com" but yet to figure out trustworthiness, don't want to give random card information to random websites in hopes of receiving usable virtual card

#

But also, US only so.. kinda have to pass

pulsar heart
#

sea chanties are awesome

cursive salmon
civic pasture
#

Loooool

spare oriole
scarlet peak
#

@grave cove apologies for the ping but i feel i have to ask these:

  • should i use JS or TS?
  • does TS work with JS frameworks?
  • is there any stark difference between JS and TS besides strict types and typehints?
grave cove
scarlet peak
#

also do you know why this isnt working?

#
function digitize(n) {
    let L = [];
    for (const number in n) {
        L.push(number);
    };
    return L.reverse();
};```
grave cove
# scarlet peak ```js function digitize(n) { let L = []; for (const number in n) { ...

in doesn't do what you think it does:

Array indexes are just enumerable properties with integer names and are otherwise identical to general object properties. The for...in loop will traverse all integer keys before traversing other keys, and in strictly increasing order, making the behavior of for...in close to normal array iteration. However, the for...in loop will return all enumerable properties, including those with non–integer names and those that are inherited. Unlike for...of, for...in uses property enumeration instead of the array's iterator. In sparse arrays, for...of will visit the empty slots, but for...in will not.
Array iteration and for...in

Use a for...of loop instead:

const array1 = ['a', 'b', 'c'];

for (const element of array1) {
  console.log(element);
}

// Expected output: "a"
// Expected output: "b"
// Expected output: "c"
scarlet peak
#

because i'm passing it a number

#

but idk the equivalent of list() in js

grave cove
#

Are you trying to do a range thing?

#

(this is one of the reasons we use TS, btw, I can't know what type n is supposed to be)

scarlet peak
#

ah ok lemme switch to ts rq

#

what the fuck does this mean

#

OHHH

grave cove
#

array of what?

scarlet peak
#

wait im stupid its supposed to be a number returning an array

#

how do you define return types?

grave cove
#
function digitize(n: number): Array<number> {

}
#

I'm assuming you want to return an array of numbers

scarlet peak
#

yes

#

OHHH

#

yes

grave cove
#

i'm sure you can see many paralells

#
def digitize(n: int) -> list[int]:
  ...
scarlet peak
#

yeah

#

i was gonna do that

#

ok i see

#

but how do you convert between datatypes?

#

like list(), set() and int()

grave cove
#

depends on what the datatypes are

scarlet peak
#

ok, turning an integer to a list

#

in python

grave cove
#

how are you gonna do that

scarlet peak
#

i would do this

#

list(str(n))

grave cove
#

why

#

just do [str(n)]

scarlet peak
#

and ive already found out .reverse() does that

grave cove
#

in js you'd just do [n.toString()]

thick ore
scarlet peak
#

wait what

thick ore
#

["1", "2", "3"] vs ["123"]

scarlet peak
#

!e py n = 555 print([str(n)]

royal lakeBOT
#

@scarlet peak :x: Your 3.12 eval job has completed with return code 1.

001 |   File "/home/main.py", line 2
002 |     print([str(n)]
003 |          ^
004 | SyntaxError: '(' was never closed
scarlet peak
#

...

grave cove
#

yeah im assuming its just a single integer as a string

scarlet peak
#

!e ```py
n = 555
print([str(n)])

royal lakeBOT
#

@scarlet peak :white_check_mark: Your 3.12 eval job has completed with return code 0.

['555']
scarlet peak
#

💀

scarlet peak
grave cove
#

the idiomatic way is to use Array.from

scarlet peak
#

what does idiomatic mean

grave cove
#

conventional/best practice

scarlet peak
#

ah ok

grave cove
# scarlet peak how do i run TS files btw

compile it to js first using the typescript compiler using tsc myfile.ts, which will create a myfile.js which is the compiled javascript, then just run it with node myfile.js

scarlet peak
grave cove
#

ts-node is a tool that makes this easier by doing all of it for you, and automatically running your file when you save

scarlet peak
#

ohh thats what it was tryna run

#

how do i get ts node

jaunty wraith
#

there are also runtimes that run TS directly

scarlet peak
#
[Running] ts-node "c:\Users\user\OneDrive\Desktop\i hate programming\javascript (pain)\src\fuck.ts"
'ts-node' is not recognized as an internal or external command,
operable program or batch file.```
scarlet peak
#

just found it

scarlet peak
#

how do you convert between datatypes tho

grave cove
#

it depends on the datatypes

scarlet peak
#

string

#

wait

#

fuck

#

my brain is telling me to use map(int, rev_array) 💀

grave cove
scarlet peak
#

basically i have this returned array js [ '3', '5', '2', '3', '1' ]

grave cove
#

i guess you can also just do rev_array.map(parseInt)

scarlet peak
#

oh sweet

#

ohh

#

its iter.map()

grave cove
#

yes

scarlet peak
#

instead of map(iter)

#

ok im getting it

#

and then int() is parseInt()

grave cove
#

yeah

scarlet peak
#

with float() being parseFloat() as well

#

ok im starting to see it

scarlet peak
#

im getting fucking type errors now

grave cove
#

what's the error

scarlet peak
#
function digitize(n: number): Array<number> {
    let L = Array.from(n.toString());
    console.log(L);
    L.map(i => parseInt(i));
    return L
};```
#

ignore the file name

grave cove
#

it's not an in place operation

#

it returns a new list

scarlet peak
#

ah ok i see

#

shit stills makes no sense

grave cove
#

at least, not without the same type

scarlet peak
grave cove
#

you can reassign another number though

#

in your case, L is an Array<string>, so you can't do L = [1], because that's an Array<number>

grave cove
#

function chaining is idiomatic, here's the cleanest and most "best practice" version of the code:

function digitize(n: number): Array<number> {
    return Array.from(n.toString())
      .reverse()
      .map(i => parseInt(i));
}

console.log(digitize(123)); // [3, 2, 1]
scarlet peak
#

you can do that with methods?

grave cove
#

yes its very common

#

it works because JS/TS doesn't care about whitespaces

scarlet peak
#

ooh

#

nice

#

does python?

grave cove
#

not really

#

you have to wrap it in ()

#

so method chaining is not as idiomatic