#ot1-perplexing-regexing
1 messages · Page 99 of 1
Yeah true that but I personally haven't seen range being used in this way and the comparison looks explicit and clear.
idk, the range is as explicit
why are we excluding m == 0 tho
idk why that was changed
The problem states m,n are natural numbers.
do you take the convention of 0 not being a natural number?
Yeah 0 is a whole number but isn't natural.
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...
I represented it as 7000... + 555.... + 7
that's...a wiser choice
that way your summation index can range from 0 to n-1
which is nice
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
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
my working was just this
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)
Yeah true that but n in any case can't be zero. It was included just to keep the code short but you are correct.
whats your best submission yet?
113 bytes
by @acoustic moss
Will give it to him only I can have anytime lol. Also great try @crystal spruce, the approach was neat.
this tells us people on twitter arent very smart
This is really a great simplification.
Yeah no submissions via twitter just views only.
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
You should checkout the full paper, pretty interesting problems: https://jeeadv.ac.in/past_qps/2023_1_English.pdf
Can someone recommend a good laptop that doesn't cost too much which is good for a software eng/CS university course?
try searching youtube with your budget caption
prolly that will help the most rather than personal opinions of people
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.
Whyy lol
@crystal spruce @little sky What math topics would one need to be familiar with to solve this? Just wanting some direction
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
This particular problem is part of Sequence and Series. But you will need various other concepts to get to the solution.
Thanks for the tips
well i can
i'll take pepperoni with no toppings, thanks
nuh uh
Pepperoni is a topping
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
kyoob
look up the english IPA alphabet if you're not already using it
homebrew IPA
hebrew is very hard to read
is there a sensible ascii IPA flavor? 
India pale ascii
Pls, I should not still recognize that much tunic. It's been mooonths since I played it
bro got cooked
who sinbad
Sinbad was a mythical arab sailor and whatnot
I might have written a tad too much code to help me in figuring out the language 🥴
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
also, why I wrote that with a circle is beyond me 
real
wqow
kmn 😭
Beautiful code
I was obsessed with nesting classes
LMAO
from another project i made around the same time
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]])
beautiful
proper programming
OOP <33
this looks... ok actually
thats a W
i defo have some of those
wait I'm looking for my original pokemon program
i loved it so much
stairway to heaven
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
"""
Why?
reject google/numpy/pycharm docstrings
embrace arbitrary code strings
this is from a couple years ago, idk what i was doin
you were cooking
I used to write tests 🥹
What’re “tests”?
my tests was literally using print
and seeing if the thing was going where i wanted it to
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
The things you forget to update when you rename a function and submit a PR. 

I glanced at the right side!!
I just keep forgetting you have to click again to see all files
The right side?
just opened a file that started with this
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
Oooh...
git grep 👀
.xkcd 1053
Can it find removed stuff?
Or does it only search the current state?
It will find anything in tracked files. I think it respects the --staged flag too for looking at stage.
You got glasses?
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
See if you can get them to make an exception
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.
you can't be a pilot if you have glasses?
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
yeah I'd still give it a go
worst case scenario it doesn't happen, but what if it does?
You can
So long as you see perfectly when using them
I see
@steady jacinth hey pecky long time no see, how is the notepad coming along
exams and distractions are getting in the way
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
plz dont start doing that ever again
well you better not get distracted
do you know of git mv
Yes
But I always forget to use it
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 👀
I know git mv is necessary to preserve history as seen in, say, vscode
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)
I think git doesn't trace this info, but maybe I remember wrong
I don't know how git would even track that
Without you telling "I moved this file from here to there"
huh
git doesn't track moves, at all
Howdy! How do I go about writing a proof to the following lemma?
i think abel summation theorem definitely helps here
Oh that's clever!
stuff like mercurial does track it, and yes you need to explicitly tell it via hg cp and hg mv
iirc git does try to reconstruct some stuff like this based on diffs
Spotify when it drudges up my cringe shinedown playlist from 2015
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...
.randomcase staring down the barrel of a .45 🎵
STArinG dowN ThE barrel oF a .45 🎵
(i've never held a gun in my life)
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?
Meat will also kill you.
not if i kill it first
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.
Tara Stoinski, chief scientist of the Dian Fossey Gorilla Fund, answers your questions about primates from Twitter. Why do gorillas pound on their chest? How do apes communicate with one another? Why do chimpanzees have wars? Are there social hierarchies within primate groups? Answers to these questions and many more await—it's Ape Support.
T...
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.
would you rather be with a bear or with a monkey
What type of monkey?
i wasn't aware there were multiple types of monkeys
: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.
a bear can likely kill with a single swipe of its paw
there are bears that attack even when not hungry
torturing how?
i don't think sadistic behavior has been observed in monkeys. a few aquatic species, sure
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.
Why not?
A plethora of reasons.
i mean, zoos exist, and some of the exhibits permit touching
I have an entire YouTube channel of me and my dog petting a stray cat
I got to feed the giraffes at the zoo once
That was fun
Giraffes have gigantic tongues.
some critters are also less dangerous than others. you can treat a giant constrictor with less fear than a cougar, for example
Reptiles are dope.
When I was a kid I got to hold a long albino boa that was like 7 feet long
it greatly saddens me that a snake cannot hear itself being complimented. at best, the vocal tones might be soothing, though
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.
is that the dog in your profile
Sure
Teapot
418?
Are you little, short and stout?
I have a cat and she's really beautiful
I like her because she's so elegant and subtle
I just love it
spotify dj just played me bitch lasagna
t series quivering in his boots
Pay cat tax
Mmm nuh uh she's mine
no you're supposed to send pics
are you free rn
im trying to help someone but im not very good in python
they did #1238122399870881836
You want pics of my cat?
🥺
cat
Well she's actually not well and asleep
And nasty
no?
Idk wet raccoon smells bad imo
then just dry it lmao
fluffy triangle
😦 hope she gets better and gets lots of headpats and treats
loks very nice
bad robin
it kinda looks like @frozen crane 's cat
looks like the same breed.
👀 they must send cat pick now
Yes I've been taking her to the vet every week to check on her health, she's getting better, it's slow but consistent
can we get some cat pics
dem blue eyes ✨
he is so cute
he is the sapphire lion
🥺
i want a black cat with emerald green eyes
This channel has now been claimed by cats
whats his name
Hunter. I didn't name him.
cool
Has someone seen Wilfred the warrior cat, he's so cute ong
but why he outside tho
i was googling it
im not on social media so i didnt know about it
looks cool tho
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
whenever im in a channel, it dies real soon
Lol same happens with me on every other server
does he hunt anything
If I throw a mouse toy, he will get
sometimes he'll do a jumping catch
and if he sees a bird, he thinks about kill
does he kill
this was motivating for some reason
no
you need to be as motivated to accomplish your goals as my kitty is to devour every bird
people who ask that question sometimes have bad intentions, so it's better left unasked.
My github
true, do you not let him kill or is he well behaved
since when did github start having age restriction
I live on a non-ground floor of an apartment building. and the birds he wants to kill are on the balcony. but he can't get over the railing.
Everywhere
AFAIK online services (at least in the US) require a minimum age.
ah i see, but in a park or somewhere with birds on the ground, he goes?
I think that's federal law.
i meant an upper age limit
I could be mistaken.
no, I don't take him to parks
not a minimum age
cool
My mom's cat chitters at the birds outside the window.
She'll sit on the window sill and watch them.
is it black?
orange tabby
i see
the federal trade commission in the US has regulations about online services as they pertain to users under 13.
how many servers are y'all in?
im in 2- this and my irl friend group
Ah so it's an FTC regulation
coppa
i think it's child online privacy protection act
yeah
and the USA PATRIOT act is "Uniting and Strengthening America by Providing Appropriate Tools Required to Intercept and Obstruct Terrorism"
it's a nice name to be fair
🦅
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 🤔
no match for hrl
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
.wa 20km to m
12 miles?
What's your normal distance?
Km to metres XD
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
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
me out here with the 50 steps per day
why not more
That looks like delicious heart failure
What cheese is that?
That looks like sacrilege
Idk, ask the Hungarians, we're just visiting XD
Who puts cubed meat on tostadas?
That's not a tostada
looks good
Is the white base sour cream?
I'll get you some when we're done
It's not quark is it?
Yes
I got "farmer's" or something like that. Cream, onions, meat
motherfu....
I can't find a single langos recipe that doesn't just say "grated cheese"
any Hungarians in the channel? :P
im not a hungarian but i am pretty hungry
Okay, found photo of the place's menu
https://maps.app.goo.gl/mUyQmhXHwzDHpieWA mine was "countryside"
hi, pretty hungry
Why did you name me this way
are you hungrychat
yes
I was pretty hungry
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
i am rapidly approaching your location
Sure
We're far from home anyways
Oh, wait, I didn't have to zoom in, this route started from the post
spiderman reference
I also tried to befriend a crow... And a lot of crows appeared when they noticed food
right at the scene of the murder
bannable pun
!ban @hexed sierra
@hexed sierra has an elevated role. Are you sure you want to ban them?
Cancelled infraction.
😔
cancelledd
Hey look it works!
unfortunate
What?
If Edd was a mod+ instead of helper, I think that wouldn't matter
Ye, but iirc some helpers were accidentally banned
Rem was accidentally banned before becoming a helper...
sure, "accidentally"
haha stinky poop
#python-discussion message
This one is probably the only I can remember
vivek banned mina
only admins can
bruh
research purposes
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
master? ummm, you mean main?? where is the inclusive naming??
the m in master stands for main
But was Aboo a helper then? Or was it like Rem?
(2 messages below the link)
👍
I try not to scroll too much because I'm outside my country and using roaming
Btw
Food!
damn where you at
Hungary
yo awesome
who you with
i see other plates
My partner and my best friend
go enjoy yourself and get off your phone 🗣️
We're all currently on our phones because we're stuffed and can't move XD
with food like that, how could you not be?
hi guys
antisocial 😔
They tire me out every day we're together, I deserve some chill time
gyus i need spotify playlists , my music taste sux
oh wow that looks very beautiful 
Idk about play lists, but I have a nice song to recommend
https://open.spotify.com/track/55sWubOMWHdUPEPoxvaNbb?si=Go41nySZRO-xQgbCVxOjzg
Metal song about singer's cat 😂
hahaha I LOVE IT 😂
thanks for the recommandations 👍
Thank Instagram for first suggesting it to me XD
Were waiting for the city to light up :3
man that looks awesome 
wish I could have a view like this on my city 
If you're ever in Budapest, then Gellért Hill is a must-go in the evening
Some lights are on
holy shit this looks gorgeous

Check out my playlists: https://open.spotify.com/user/31mravw37zt5vxiy347zzdpjinfy?si=UU4QPZi2RUammIUnRByomg
Let me know if you like any.
thankfully I've got peak music taste
https://open.spotify.com/playlist/3v2wPsFezupKCcz5MwNGxi?si=mfEt4HnPTi2vnL8HNRn1Qw&pi=u-sYP3RdX5TVmL
https://open.spotify.com/playlist/7yQXa9TA8eAWJt91GTr4DX?si=IX_5Ivc9SS6G7A0oVXIKgg&pi=u-m_SHPu5ZSAuw
https://open.spotify.com/playlist/7oy3YegvcSvFo6bd8eUZ9k?si=B2F5VLFOTEqr_K1FYig8gg&pi=u-dUiwoYegTTKB
How did you find me😳
what is that username
holy shit this looks so good
It is the power of cringey usernames you came up with as a freshmen
You're allowed to change your handle.
Discord even makes it pretty easy.
Too late, I've grown attached to it
i can deduce the country you belong to, your gender and your approximate age with the amount of info you have given me
you are bound to like atleast a few songs in there lmao
...you good bro?
that is not the worst you can find in there 💀
I shall not tell you what they are cuz rule 1
it's a fun egg hunt
yea
what
100 songs and ive only heard 4 of them before 💀
i thought my 500 song playlist was big
fr
atleast ive got peak music in there
have you listened to the whole thing start to finish?
obviously not in one sitting
let me guess, bad habits, I ain't worried, heat waves idk
yea
as previously stated, I listen to music most of the time I'm awake
I don't usually put on everything though
scientist, bring me to life
I pick a few songs I'm in the mood for and loop em
currently it's a single song
heat waves, another love, centuries, shape of you, forget me, peaky blinders
guys drop how many people you have blocked on discord
i have 83
4
oof
10
I have zero users blocked.
12
10
at that point don't the "blocked message" things start to become a problem?
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.
none are from this server lol
zero
time to make it one 👽
i have some bots blocked too lmao
I'm not on that many servers
i used to be in many, now its only 2
how many friends on your friends list
i have 8
32
only 1 open dm lmao
- Hello
- i just discovered putting a minus sign makes it into a point
yo thx for the list , ill check it out
great !!
will check them out 👍
thanks a lot ✌️
thank you for this 👍
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?
by "self-host" you mean expose it with Cloudflare Tunnel?
Yes I guess
"I guess" - that doesn't sound like a yes to me
or do you mean making an A record pointing to your IP?
Having something run in my own computer and exposing to cloudflare
Either way, if you set it to be proxied, you'll be protected
I'm not too sure exactly, I was trying to understand how it all works and quite confused
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
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?
thats crazy ironic
Hold on..? Would both hide the IP or just the proxy one?
nah nah i saw that pikachu
only the proxied one
Can anyone help me with my IT homework?
I see, and with the proxy one I should be able to have some FastAPI app running locally that would show up in my domain in way or another?
sure
unless your web app/server leaks info about itself
Do I need any configuration to router or anything for it to work?
Hard to say, only thing I can think of immediately is the server section which shows the server it's running in, which likely would expose the IP
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/
The tunnel would be the way to go I guess, that's the proxy one?
Oh.. I didn't see the edit
tunnel is just a way to make services available through cloudflare without having a public IP
like if you were behind CGNAT or something
I see, so port forwarding is required. Then I likely should set up firewall rule to only allow cloudflare just in case
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
how o_O
hold on lemme get the nginx configs
nginx ⁉️
nginx‼️
Sorry I'm very new to all this 😅
So... Port forwarding is for the DNS? But to ensure my IP is hidden I need to use the tunnel, that is going to be like the proxy?
i think i explained it badly, let me type a better explaination
I might just be understanding things very wrong here...
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
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?
Tunnel requires a bit of setup but I think it's more convenient as you don't have to touch your router settings
That would be convenient
Tunnel runs in the background as a service
- it guarantees requests will always go through cloudflare
That sounds good, without domain though it would not work right?
which isn't the case with IP + DNS (unless you configure your firewall to only allow cloudflare ips which takes more work and blah)
nope, you need a domain to get started with anything cloudflare related
Ye figured, there are some record and stuff there
I think I'll try roll in to GitHub student again, to get a domain
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?
They don't give you the domain
They give you a 100% off coupon to NameCheap
oh man the gh student pack
ahh i see
they give you a free .tech domain with DNS n stuff
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?
So yeah, you get everything that NameCheap offers
yes, with the CF-Connecting-IP header
I could also just get a domain for few bucks a year from namecheap
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
They might be slightly more expensive, the domains I have looked for have been in range of 1.xx - 6€
Oh, interesting
I didn't know that
namecheap has first year discounts, then they get you with the renewal prices
Perfect! That allows some nice setup there. Does using CF slow done the requests much?
nope
I would likely just register for a year, so stays cheap for one tile purchase
well, technically yes since there's one more server between you and the user, but it should be minimal
the thing about buying domains from cloudflare is that you won't be able to disable cloudflare from it unless you transfer your domain to another registrar
yeah lol
So if I get from them, I'm stuck with them? But... Doesn't sound bad
exposing anything to the internet these days without cloudflare is asking to be ddosed
I definitely need to re-do the security of my API to ensure nothing is leaked before exposing anything
it's not bad at all, just something to be aware of
Ye, it's good to know
so it was a product of human savagery
cloudflare would not have existed had humans acted civil
yes, same for like all cybersecurity companies
good point
actually cloudflare would have existed still, they're a CDN
o yeah
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
the standard setup for production is using a reverse proxy like nginx
that reverse proxy then passes the request to the container
So it would be kind of like
Web visitor -> cf -> nging -> container and response in same but reverse
yes
I been meaning to learn about that so this sounds good
Should I / Do I need any firewall rules there just in case?
ehhhh if you're going with tunnel no
Sounds perfect!
you won't be exposing your web app to the public internet, it'll be a secure connection between you and cloudflare
nmap works on ips, if someone tried they'd just be running nmap on cloudflare
content, headers, etc
Ooh right because I'm not exposing my own network ip
I'll need to do proper inspection on all of that before exposing anything
I don't understand. you mean someone sending a request to your web app and fetching container secrets from there?
Maybe I should protect the /docs endpoint with basic authentication
I disable it in production
I didn't even think of that 🥴
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",
...,
)
Don't remember exactly, might be just my memory tricking me. I read bunch of stuff about docker security and best practices. That was just some tool I came across in GitHub
closed API
Gotta setup some similar then, does this by any chance be in public repo?
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
Do you happen to have any example configuration for nginx?
simplest valid config looks like this
server {
server_name example.com;
listen 80;
location / {
proxy_pass http://localhost:8080;
}
}```
Huh, that simple
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
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
I see, so I can basically pick any non accupied port there for it
2.1gb contained with only discord running
i only have 4gb ram
Oh and Thanks a lot for explaining this topic! It was really good and easy to follow, thanks for all the info. Thank you 😄
.bm Cloudflare self host thought and good explanation of that stuff just below this message
rip your bet
cat!
wdym only discord?
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
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
honestly people worry about RAM usage way too much
only worry if you reach 99% and programs just aren't releasing RAM
"unused ram is wasted ram"
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
At some point Firefox has some kind of memory leak and starts kinda being slow - you gotta kill it and start it up again
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
@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.
Interesting. Is that also the case for PyCharm and other IntelliJ IDEs? (I use PyCharm every day and yet somehow I can’t remember if it would point out errors for the whole project by itself)
I don't recall, I haven't used pycharm in a while.
Fair - thanks for the review! Shall keep it in mind if I try RustRover. VSCode+Rust Analyser isn’t quite doing it for me at the moment so I’ll probably try it RustRover but keep this in mind
good luck
fwiw if it's specifically vscode that won't cut it, rust-analyzer can be used anywhere that supports the language server protocol
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 :(
github student pack 🥺
github "the first one is free" pack
just get a job
You use your work account at home?
c o r r u p t i o n
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)
That's why I always thought Google's "work on personal projects here, it's cool" attitude was sus.
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.
That's probably why you have -$28 in your bank right now.
💀 💀 💀
you should see the other numbers, it's even more amusing
well, for some definition of "amusing"
nginx is great, at least compared to apache
I'm not a fan of the "proprietary" config format but it does work very well
better than whatevr tf apache has
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.
Pretty sure you're only supposed to be on discord when you're 13
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
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
Im new to neovim, i have a colour scheme that works with .lua files but not .luau, they are basically the same language, is there a way that i can force .lua colour scheme to apply to .luau?
https://github.com/morhetz/gruvbox
https://github.com/rafi/awesome-vim-colorschemes
the easiest way would be an autocommand to set ft=lua for luau files
i don't understand
ah, it works
thank you
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.
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
(((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.
nice
your ai speaks exclusively in perl
any way i could add an option to this list for a specific app to basically act like a shortcut?
Dang
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
something about this, probably: https://learn.microsoft.com/en-us/windows/win32/shell/shell-exts
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?
There's also this https://learn.microsoft.com/en-us/windows/win32/shell/context-menu-handlers (linked in answer's comments) - shows a lot of stuff, including cascading menus
I've encountered the first "bug" in my vscode offline downloader script
killjoy1221/dlvsix#1
😓this hackathon sucks how I suppose to get axure credit as a learner
What? Why are you replying to a random MS help link with Azure credits complaint?
pretty sure the gh student pack gives you azure credits
I thought it was general chat first time
That's
what I wanted to say after that
😓its in general not for hackathon specially
Like I m in uni. They didn't give us mail
So I m unable to claim student pack
It is. But why reply to my message where the only common thing is that it's Microsoft? Not even anything cloud related, quite opposite - it was a windows question...
😓idk why I replied

your university doesn't give you an email?
No
Yes
Nahh... My uni sucks
it is how it is
@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.
Can you not use non-school email if you provide proof you are student? I can just remember incorrectly, been awhile since last checked
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
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

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
I think they can, it's just that school email is easier to verify for github and they tend to accept it faster
Ye, makes sense. Now they have even started asking for credit card (or well any payment method to be added to account) + picture proof
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
I don't remember when that started tho, not a new thing iirc but wasn't when I first registered
We don't have such so... Re-newing that is pretty... Well, hard for me. There's tiny little spot in browser where it says the school name and your name, but I doubt it would be recognized, I feel it it would be somewhat automated system
Oh, right, UNI. Ye those would have 100%
Cc is usually needed for accounts on platforms themselves, it's common with any free stuff so people don't try to use it multiple times or abuse anything (cc info on file means they also have a name and a way to incur fines etc if needed)
That makes sense, I been a bit hesitant about renewing as I don't own credit card, I don't want any random stuff happening on there, credit would likely be easier to refund if needed
I wonder when they started doing that
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
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??)
I been trying to look into those virtual cards, would very much like to use those for one-time purchases, like domain, hosting, stuff from the net in general. But I'm yet to find any proper information on them or where to acquire them from
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...
Ahh, makes sense that it was changed...
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
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
privacy.com is good, so is revolut
sea chanties are awesome
I've been using revolut and much better than my country's alternative
Loooool
What grade did you get in your DS thingie
@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?
- You can start with JS but you will most likely want to move to TS as soon as possible. It prevents a lot of mistakes
- Yes, the TS compiler transpiles TS to JS and removes the types. TS is pretty much a standard, and all modern, mainstream frameworks support TS
- You get a better ecosystem with TS, most of your frameworks and tools will support it
ok ima start using TS then, thanks robin 👍
also do you know why this isnt working?
function digitize(n) {
let L = [];
for (const number in n) {
L.push(number);
};
return L.reverse();
};```
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"
tried it and got back: "n" is not iterable
because i'm passing it a number
but idk the equivalent of list() in js
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)
array of what?
wait im stupid its supposed to be a number returning an array
how do you define return types?
function digitize(n: number): Array<number> {
}
I'm assuming you want to return an array of numbers
yeah
i was gonna do that
ok i see
but how do you convert between datatypes?
like list(), set() and int()
depends on what the datatypes are
how are you gonna do that
i need to return a list of numbers in reverse order
and ive already found out .reverse() does that
in js you'd just do [n.toString()]
that's not the same btw
wait what
["1", "2", "3"] vs ["123"]
!e py n = 555 print([str(n)]
@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
...
yeah im assuming its just a single integer as a string
!e ```py
n = 555
print([str(n)])
@scarlet peak :white_check_mark: Your 3.12 eval job has completed with return code 0.
['555']
💀
"can be multiple" is what the question says
the idiomatic way is to use Array.from
what does idiomatic mean
conventional/best practice
ah ok
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
Extension for Visual Studio Code - Run TypeScript instantly.
ts-node is a tool that makes this easier by doing all of it for you, and automatically running your file when you save
there are also runtimes that run TS directly
[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.```
just found it
ok works fine thanks robin 👍
how do you convert between datatypes tho
it depends on the datatypes
rev_array.map(i => parseInt(i))
basically i have this returned array js [ '3', '5', '2', '3', '1' ]
i guess you can also just do rev_array.map(parseInt)
yes
yeah
what's the error
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
it doesn't let you reassign like that
at least, not without the same type
"not without the same type"
explain
essentially you can't define a variable to be of type number, then later re-assign it a string
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>
ah ok i see
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]
you can do that with methods?
.map(parseInt)

