#voice-chat-text-0
1 messages ยท Page 235 of 1
At low or high tide
both.
the website back-end is a singular Rust binary, no microservices
Wait what?
cost of writing a separate auth service is not worth it
already read that and implemented
twice
it worked
both times
anybody know what create mask and directory mask values need to be set in samba config to make shared dir writeable?
(if this wasn't clear enough for whatever reason, I'm adding it not trying to add, I don't need any help)


memories
bump
ah sorry , good luck with that ๐
the hardest part was debugging an invalid client secret, because error messages from Discord are bad
I also managed to get Discord API to return 500
500 is on their side, right?
yes
you're talking about token not secret
secret is server-side
even though it's called client secret
client_id and client_secret are app-specific (accessable by a developer)
app (server) sends requests with a client_secret
to get a token
ya
pfft
so u do have a issue with that
thats fuuny
the issue was that I had an invalid client_secret for whatever reason
but the API doesn't tell that
oh
ya cause it dont find that client i think
egh
httpx.post("https://discord.com/api/oauth2/token?]").json()
ok bye guys it's been fun
'grant_type': 'authorization_code',
yes
or refresh
that's what makes one error go away
u need to pass it
most all other errors are classified as invalid_client
import requests
API_ENDPOINT = 'https://discord.com/api/v10'
CLIENT_ID = '332269999912132097'
CLIENT_SECRET = '937it3ow87i4ery69876wqire'
REDIRECT_URI = 'https://nicememe.website'
def exchange_code(code):
data = {
'grant_type': 'authorization_code',
'code': code,
'redirect_uri': REDIRECT_URI
}
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
r = requests.post('%s/oauth2/token' % API_ENDPOINT, data=data, headers=headers, auth=(CLIENT_ID, CLIENT_SECRET))
r.raise_for_status()
return r.json()
check this
another non-invalid_client error is invalid_grant
what this
and invalid_grant actually says what went wrong
{'error': 'invalid_grant', 'error_description': 'Invalid "code" in request.'}
0-0
compare to:
{'error': 'invalid_client'}
there's an apparent difference in the level of detail
what this may be potentially caused by:
invalid client_id
invalid client_secret
wrong input encoding (non-application/x-www-form-urlencoded)
missing code
and the error is the same
iirc, token-use errors are more descriptive
GitLab has CI
that's all I know
I use Gitea's CI because I'm a masochist Gitea uses less system resources
(that one is just act runner mentioned eariler here)
- it's GitHub-compatible in parts
JS web frameworks often do SSR
yeah, jinja is server-side
Next.js and other do some both-sides logic
Next.js can render parts of the page on the server side, iirc
no idea either
haven't benchmarked which is faster
it's likely a trade-off
giant ignore-everything file
(except for .idea)
.idea is partially ignored
That always confused me
.idea is like .vscode
it has project-specific settings
Rust's log crate is still at version 0.4.20
I wonder how long it'll last
my employer likely doesn't know I have a GitHub account
- it's near empty
complete audit
self-host
Mattermost
that's what we had at school
that one is self-hosted
I completely forgot I used to host it too
they shouldn't
at least in url
usually if it runs php, there is a way to have urls without .php render the php file anyway
and, iirc, that's default
Ah right right
yes
and same for php legacy
URL: index.php
back-end: Next.js
quite common sadly
(because of using URLs with extensions at all)
I think it's okay-ish for .html/.htm
for static sites which can be opened from the filesystem
yes
webkit
jscore
Rust exists because of Firefox's web engine, iirc
That sounds right
if it renders HTML and not only TeX it's probably quite new
TeX is, like, around 45 years ago, or something like that
"just imagine what web would look like if TeX won over HTML"
location / {
root html;
index index.html index.htm index.php;
try_files $uri $uri.html $uri/ @extensionless-php;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9123;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location @extensionless-php {
if ( -f $document_root$uri.php ) {
rewrite ^ $uri.php last;
}
return 404;
}
that's how i did it in nginx
that also removes .php from URI, if I understand correctly
yep
i have no context as i joined in halfway btw but what was this about?
using php with a next.js backend? o-o
the context was:
site used to use PHP
didn't have web server properly configured
had all links end with .php
the site got updated to whatever else
all links still end with .php for compatibility
(common web situation)
does it need to end with .php or both work?
cuz i don't see why having both be valid wouldn't work
((not anything I personally work with))
if it was me i would probably just make it so its valid both with and without .php
@rugged root allegedly, there's also a problem that US has traffic circles as a more common thing
there can also be "we're a serious Enterprise. we were certified to use this specific URLs. we can't allow users to access anything else."
Christopher D. Reynolds, 34, has been charged with OVI, failure to control, and obstructing official business.
Stay informed about Youngstown news, weather, sports and entertainment! Follow WKBN on our website:
i can see that being a thing but i do think its a bit dumb
from a user experience perspective its always easier to not use an extension on the url and its also it feels lesser like accesing a website from 2001, meanwhile any other piece of code that might be trying to access an old url with .php or something it would work too
yes
oh, Nextcloud finally doesn't have .php in the URLs
I just noticed
might've been changed a couple of couples of versions ago
nice
meanwhile a project that I help hosting:
[win_shares]
path = /home/sazk/win_shares
browseable = no
create mask = 0775
directory mask = 0700
valid users = sazk
still can't write from win vm
someone's uni course is 20 years behind
btw i recently learnt that all opengl and glsl i learnt till recently and made projects with were all legacy opengl as people still teach legacy opengl for the sake of ease in courses even to this day so i just learnt how to convert all my code for my physics engine to opengl 4 and spent hours already and it looks shit and now i have to figure out how to make it so you can choose between opengl and direct3d for rendering T-T
my smb config ๐
but i still can't write to the dir from my win vm
or, rather 20 years + however outdated it was at the time
how are you?
Im good tryna sleep but cant
My sister just gave birth so im stoked to meet the baby tmroww
congratz to her ๐ฎ
Hamster?
Boy
Probably ha- ah okay
๐ other...
Thank u
why browse when u can curl
> everything they like
and everything they don't like
well i can't play deip.io on curl when i'm bored or just look at fancy animated websites using javascript
altho i can do curl parrot.live
i still use the links browser ๐ซฃ
Learn something new every day
web Vim
so you can't sleep cuz you're excited to meet the baby? but if you don't sleep you will oversleep and it will take longer for you to meet the baby?
just use tridactyl
GitHub recommended this to me at some point
I installed and haven't really used it
๐ณ oh geez u got a point there i better sleep like RIGHT NOW
Did you fail
Dude, how would we be talking to her otherwise
goodnight xD
tridactyl ext + ff is better.. more options and has dns over https
you use vifm?
XD but nah its more like i out-waked my biological clock curfew so now i cant sleep. U know. One of those things.
qutebrowser doesn't have dns over https
I don't really have a need for a better file manager (anything other than whatever the system has as default)
well looking at a screen won't really make it better i guess you could just turn on some audiobook or something and try laying down with eyes closed while listening?
i personally have this weird thing i do when i can't sleep where i listen to any horror game playthrough by someone while trying to sleep xD its kinda fun
Must it be horror game?
Wont jump scares awakens you?
for me if i am working on a linux machine i just pull my config file in and i have nvim just work out of the box
if i am deploying on a machine i try not to leave anything i have to do on the server machine or if i have something i need to fix i do it on my maching, push it to git remote and then pull on server
i guess it should ye idk why it doesn't for me xD
@untold cargo https://javascript.info
"can't pick a framework => use all frameworks"
try all frameworks*
fuck frameworks
want to learn for === job ? look at jobs around you and learn according to that : try all and pick what you like or don't use any
if it's for dealing with data/state, then, yes, it should probably be in a framework-agnostic library
i've been recently getting work from clients who don't want a bunch of node_modules in their workspace.. so vanilla js it is
Wild
well i do the same but i do charge extra for vanillajs as its more effort
for front-end-only frameworks node_modules is only compile-time thing
i think by frameworks he means more like next/nuxt/remix
"full-stack" ones
ye probably
Here in Malaysia if you give birth in a gov hospital itโs gonna cost u like rm60 which is 10usd ish. But in private hospitals its gonna cost rm3k at least.
well then that's just server-side JS
nothing to do with frameworks
I use Next.js with 0 server-side JS
(static export is a thing)
so just ssg?
I heard travelling nurses can make a lot of money in the states
that's just react
yes
yes
react is closer to libraries than frameworks
and Next.js there does the frameworky things
Oh i should rly just sleep now. Bye everyone. Nice seeing u again @woeful salmon
๐ goodnight, was nice to see you again too, i just recenrly started regularly joining here again was wondering where you've been xD
after the thread thing
i think its not the same no? pretty sure it populates the html with all the stuff that isn't dynamic?
apart from just react it only does layout logic, if I understand correctly
and routes
I don't use dynamic (parameterised) routes at all
for client-specified parameters -- query string
did u try zig in aoc?
How nice of you to think of me ๐ฅน was just been busy with life but iโll probably be popping in here more often so iโll see u around
Ok i will sleep now forreallz
Source code: Lib/queue.py
The queue module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely between multiple threads. The Queue class in this module implements all the required locking semantics.
The module implements three types of queue, which differ only in the order in which the entries are retrieved. In a FIFO queue, the first tasks added are the first retrieved. In a LIFO queue, the most recently added entry is the first retrieved (operating like a stack). With a priority queue, the entries are kept sorted (using the heapq module) and the lowest valued entry is retrieved first.
i paused on aoc, i got side tracked hard, learnt 3d modelling, learnt pixel art and basic animation and art principles, got better at making sound tracks for my games and then updated my opengl knowledge and found myself implementing another physics engine
see you later than ๐ gnight
if you have producer-consumer logic, queue
^ this is what i call productive procrastination
and share no state across threads
... apart from whatever the runtime requires you to share
also
why not async
since it's still Python <=3.12 with GIL
๐ imagine doing atomic reads and writes to a json file at runtime from multiple threads
does it matter if your reads and writes are atomic tho? ๐ฎ
idk if you were saying that to me or not tho
"the only atomic write you're going to get is truncate/delete"
iirc, Python doesn't provide proper atomic writes for files
or writing to a temporary file and just doing a single write to the file?
we do have tempfiles in python
write on whatever is returned from open is not atomic
!stream 249616904254128148
โ @viscid scaffold can now stream until <t:1703868869:f>.
write can partially succeed
if it's threading in Python, it's probably better to have a singular fd, I guess
but it's impossible to store data reliably in a single json file, as far as I know
it requires auxiliary files for durability
with open(tmpFile, 'w') as f:
f.write(text)
# make sure that all data is on disk
# see http://stackoverflow.com/questions/7433057/is-rename-without-fsync-safe
f.flush()
os.fsync(f.fileno())
os.replace(tmpFile, myFile) # os.rename pre-3.3, but os.rename won't work on Windows
found this
yes, that's using an extra file
There's a temp file library built in I think...
yeah when i said atomic write i meant using a temporary file
Oh right right
it'd be used around that whole block
^ @rugged root
Dude
xD
HOW AM I FAILING SO BAD
if I understand correctly:
flush flushes program (user) buffers
fsync flushes filesystem (kernel) buffers
happens
in Rust, drop fsyncs, I think
os.fsync() method in Python is used to force write of the file associated with the given file descriptor.
In case, we are working with a file object( say f) rather than a file descriptor, then we need to use f.flush() and then os.fsync(f.fileno()) to ensure that all buffers associated with the file object f are written to disk.
whereas in Python __exit__ only flushes
(I think)
What makes the descriptor different?
?
Well what I mean is like... doesn't the object have the descriptor as a part of it?
I'm just not understanding why it needs the double action then
flush doesn't and shouldn't fsync
fsync doesn't and shouldn't flush
they serve a different purpose
flush commits the application buffers, so app crash doesn't lose data
fsync commits the kernel buffers, so system crash doesn't lose data
I'd expect so, yes
Okay, that makes sense
well, filesystem buffer
which is normally kernel-space, I think
Sounds right
and conveniently ignores all the errors
CORS:
just use a proxy. just use a proxy. just use a proxy.
๐คฃ the number of production websites i've seen which just allow * in cors is amazing
this reminds of the time someone tried to convince me smtp.js is a good library
for context of how bad it is: it's in-browser
it's sending all credentials through XMLHttpRequest to smtp.js servers
i know what it is
i saw a medium article on it a while back
instantly did not care cuz it sounds useless
even if it was secure
it's not just useful
it's actively harmful
Yarp
sharing credentials with both smtp.js and all users
i gotta go now ๐ cya guys
Right?
What's the issue?
this is the current output from the browser
it comes as a apigateway event, is a post request
a form, in the frontend
i'm working with the frontEnd guy rn ty so much
someone should build multi node container management system
Your pain from my puns feeds me
afternoon
How goes it
it goes great, moved onto learning java. did you just get admin?
Nah, been admin for a while. Stepped down for a time due to life stuff, but I'm back
For a long while
Been admin most of the time I've been on the server, come to think of it
i got confused by your nickname ha!
Yeah there was a joke that just carried on to most of the admins
(context is talking about enterprise bs)
whats happening btw
helo
some hot takes here LOL
@stable geyser ๐
!voice ๐
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
hello
@dreamy relic ๐
I need some help understanding something with print not working
im trying to automate some simple tasks
all of them lol
I had to add time sleep in order for it to print in console
no errors when i run the scrips
they print when I add sleep
here
correct
yes
3.10.1 py btw
what/
?
oh, VSC
I just run it with python console
the sleep 4
the first one, if you remove the time sleeps
second one is still a work in progress
when you remove the time.sleeps?
pass: game
welcome gamer
music started
pass: game
welcome gamer
music started
Discord started
google opened
CPU Execution time: 0.0 seconds
Have fun!
thats... frustrating lol
ill give that a try
from vsc?
ohh, idk how to do that
I just run the file
thats the file open with python
ill remove the times and see
its working now.... wft lmfao
maybe I have to close the VSC instance before trialing my stuff
right? lol
trust, I was using subprocess and that was a nightmare to do this simple task
I mean... yeah lmfao
ahhhh
ty
cause the next question is why there is a space between the webbrowser.open and os.startfile()
in the terminal
like as if theres a \n
it does it with both os.startfile and subprocess
lmfao
facts
try with what?
python -U
pass: game
welcome gamer
music started
Discord started
google opened
CPU Execution time: 0.0 seconds
Have fun!
in what context/where?
im having a hard time hearing you sorry
sorry, talk to me like im 4years old... where does that -u go?
in the command when running the script
ohhhh
so open your folder that contains your script and then run cmd promt from that folder and then use the cmd that segfault mentioned
you see the command being run here at the top, looks like
C:/Python310/python.exe "..."
just add a -u after python.exe and run it manually
C:/Python310/python.exe -u "..."
still space
itd be so much easier to talk lol
is what it is
im going to fix the pathing for the elif and see if that space happens there too. be back
np, will do!
looks like every time I open an aplication I get a space inbetween. dothe \ characters act like special characters? I read that somewhere, but putting two \ would cancle the character format?
@limber copper
sorry for ping ;-;
os.startfile('C:\\Users\\jayda\\AppData\\Local\\Programs\\Microsoft VS Code\\Code')
lol
im so confused about this stupid space
try using / instead of two \ it should work also the same but only the \ once usually will be considered as special not two \
the double space moved to the bottom now. changed the \\ to /
oh well.
at least the prints are working
that was my main issue lmao
VSC for the win
by chance, have you ever worked with selecting open windows/key use(like a macro)? my plan for this project is to start on boot once you login. I want to format the different programs and pages between three monitors. just not sure what direction to head for that.
I found subprocess and was a complete dumpster fire for this specific application
@young beacon ๐
What's a one-eyed kitten's favourite toy?
||Yarrn.||
!voice ๐
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Welcome @naive obsidian ๐
!voice
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
bc it needs some permisson trouble
open-sourcing parts of it
nice. did you get reconnects going?
my snek has pooped :(
other than that, I added:
Elo rating
Discord auth
flags
chords
yes
and, as a consequence of how it works it syncs across all tabs within a session
oh nice. feature or bug?
noice
I'll soon publish a generic version of that system
(it replays all events whenever a new connection appears)
"session" being shared across devices when using discord auth
Just ask your question here @languid rose
i dont think it pings if you edit but im not sure
Good to know
you can google it dont trust me
iirc, it renders as ping but doesn't notify
i got this message from a bot about voice trouble :Voice Gate failed
You are not currently eligible to use voice inside Python Discord for the following reasons:
You have been on the server for less than 3 days.
You have sent less than 50 messages.
yeah thats what i thought
i couldnt speak i guess
you need to be a server member for at least 3 days and sent at least 50 messages (but dont spam). just like the message said.
You'll get there
(code will be here)
https://github.com/parrrate/ruchei
rust, cool.
trying to make it as composable as possible
https://github.com/parrrate/ruchei/blob/main/examples/ws-buffered.rs
https://github.com/parrrate/ruchei/blob/main/examples/ws-bufferless.rs
(two echo servers with different buffering strategies)
.concurrent, .multicast_buffered, .multicast_bufferless, .echo are provided by the library
i kinda wanna make a text editor LIKE neovim but also like nano
so it doesnt have modes
!voice
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
imma brb for a min
before i go
say goodbye to snek
snake
YEAH
she says goodbye to u too :)
:)
first is slightly cursed in how it operates
it uses a linked list instead of a VecDeque for queuing messages
singly-linked with writable tail
likely not
I try to avoid allowing any user-generated content (nicknames, messages, etc.)
it is a website, and it was playtested a bit already
it's very non-scalable for now
guys if u are a good py programmer or know about hacking dm me
im making a team โค๏ธ
Fuck Bug ๐พ
distributed matchmaking and ratings is the hard part, I think
(for scalability)
Elo is already there
synchronising it is difficult
MacOS is closer to Unix, I think
Elo, from DB's point of view, is a series of change-two-values transactions
it's easy to express if there's already a system to handle them
read rating_1 rating_2
calculate
write rating_1 rating_2
so, yeah, that seems simpler than matchmaking
there must always be a single server handling a (player, lobby) pair
so, I guess, multi-server setup would be like this:
ask the cluster for a server already dealing with the pair
if not found, claim it
if the claim failed, start over
lobbies themselves can be distributed
whenever a pair is found, one of two servers would become responsible for handling the game
"gambling investing"
it's closer to what hedge funds do
which isn't exactly investing
too volatile
Feel like buying Bitcoin? Go to Binance The Rainbow Chart is not investment advice! Past performance is not an indication of future results. You can not predict the price of Bitcoin with a rainbow! It is meant to be be a fun way of looking at the historical long term price movements, disregarding
miners are guaranteed to lose money, so I guess that's where the "gains" are coming from
there are ways to make mining beneficial through making the process depending on validating the chain
i.e. to make an algorithm which (probabilistically) breaks down if there's a lost block
miners rn aren't really validating anything
(not required)
they're just signing the thing with "I've spent work trusting this chain, please prioritize it"
well, finance generally too
crypto just makes pump-and-dumps easier
I've tried designing a system that fixes some of the issues
but I don't have research time and budget to analyse how viable it is
I need to find the properly formatted meme
I can't find it
I've sent it once here and once in another server
but getting through thousands of messages would be suboptimal
likely very high margin
because demand
cloud was high margin from basically the beginning
with AWS financing the success of the rest of Amazon
that thing was partially the reason I started using Rust
and in the end the cryptocurrency aspect of it became less important for me
implementation in Rust rn has nothing to do with c.c.
(unlike Python implementation)
i hate talking about crypto cause it gives me flashbacks to that one time i dabbled in it.

I guess (lobby,player) nodes should be connected to match nodes too
Hey @rugged tundra ๐
@vocal basin have you ever been part of a reading group on Discord?
@abstract rock bro, i've muted you
oh, ok idk there is noise come from my side
i'm trying to remember life before discord
Hi, people around the world, I would like to know how is your region doing regarding hiring in Software industry, specifically with the fresher (with 0yr Full-time experience)
hello
Heyo
I think it's pretty slow at the moment.
are you familiar with os.startfile()?
What did you want to know about it?
im using it in a simple automation script, however when I launch discord with it, blackbox takes over and doesnt complete the loop
import webbrowser
#import subprocess
import time
import os
st = time.process_time()
et = time.process_time()
res = et - st
tries = 3
while True and tries > 0:
choice = input("pass: ")
if choice == 'game':
print("welcome gamer")
webbrowser.open('https://www.youtube.com/watch?v=EUQe85b5VgQ&list=UULFJBpeNOjvbn9rRte3w_Kklg')
print('music started')
os.startfile("C:\\Users\\jayda\\AppData\\Local\\Discord\\app-1.0.9028\\Discord")
#subprocess.Popen("C:\\Users\\jayda\\AppData\\Local\\Discord\\app-1.0.9028\\Discord")
print('Discord started')
webbrowser.open('https://www.google.com/')
print('google opened')
print('CPU Execution time:', res, 'seconds')
print('Have fun!')
time.sleep(10)
elif choice == 'code':
print("welcome coder mem")
time.sleep(4)
webbrowser.open('https://www.youtube.com/watch?v=EUQe85b5VgQ&list=UULFJBpeNOjvbn9rRte3w_Kklg')
print('Music started')
webbrowser.open('https://stackoverflow.com/')
print('Hecking started')
os.startfile("C:/Users/jayda/AppData/Local/Discord/app-1.0.9028/Discord")
print('Discord started')
os.startfile('C:/Users/jayda/AppData/Local/Programs/Microsoft VS Code/Code')
print('VSC opened\nCPU Execution time:', res, 'seconds''\nHave Fun!')
time.sleep(10)
else:
tries = tries - 1
print("incorrect")
blackbox?
does the Discord UI open too?
yeah, you should probably be using subprocess.Popen with proper parameters
It doesn't block the rest of your script
I was using that, however blackbox still takes over... tho, I wasnt using parameters
Popen detaches by default, iirc
while going over the subprocess docs I came to the conclusion it was more for sourcing info and relaying that back, or thats what I took from it?
stdout=PIPE, stderr=PIPE, stdin=PIPE
also, is there a way to hand off those programs back to windows?
for example, when running this and those programs start in py, when you close the py UI, it closes the programs
subprocess.Popen(
r"C:\Users\jayda\AppData\Local\Discord\app-1.0.9028\Discord.exe",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
start_new_session=True,
)
ill check this out
start_new_session=True to avoid closing everything when the script is interrupted
you can also run the process headlessly using a -headless flag
if you don't want the window popping up
GYATTT
the idea is to eventually use something like a key input to win+dir to place the windows in different monitors
does the bot do requests to the API or is there a message broker in between?
okay
for interactive requests to the bot, there are message/work queues (rabbitmq, beanstalkd)
at which point it's probably a good to have already been having the bot and web as separate containers
it took me some time to find this
because I didn't know what to look for
AQMP has support for RPC itself
via reply-to and correlation-id
yeah, just remember this when you need anything more complex~~, so Rabbit doesn't get angry at you~~
well, if it's a dashboard, it might make sense to send requests to the bot
so the reply is up-to-date
profile = await sync_to_async(Profile.objects.get)(discord_id=interaction.user.id)
some parts of Django ORM are async already, seems like
https://docs.djangoproject.com/en/5.0/topics/async/#queries-the-orm
the bot can query the Django API
is the bot accessing the DB directly?
with Django ORM?
so just whatever SQL engine there is
import asyncio
import inspect
from django.core.management.base import BaseCommand
from django.db import models
from accounts.models import *
from typing import Optional
from asgiref.sync import sync_to_async
import discord
from discord.ext import commands
from discord import Option
import json
import requests
from discordbot.models import *
bot = discord.Bot(intents=discord.Intents.all())
@bot.event
async def on_ready():
print(f'Logged in as {bot.user} (ID: {bot.user.id})')
await bot.wait_until_ready()
total_members = 0
for guild in bot.guilds:
total_members += guild.member_count
print(total_members)
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{len(bot.users)}"))
class Command(BaseCommand):
help = "Run the discord bot"
def handle(self, *args, **options):
print("Start running the bot")
bot_settings.save()
bot.run(
'')
you should probably replace requests with httpx at some point
(for async support)
discordbot.models contains Django models, right?
so it is using the ORM
probably warning
not error
Today I'm starting a new project to handle a discord community. It's going to use Python, Django and then later on discord.
In this episode we look at the database design, and I show how my thinking goes before I've even cut a line of code, in particular, a third normal form database diagram, and then straight into the models.py file to code ou...
the stricter approach would be to have internal API routes specifically for the bot to use them
so there's no Django-related code in the bot at all
new_guild = await sync_to_async(Guild.objects.create)(
guild_id= guild.id,
guild_name= guild.name,
guild_icon= guild.icon,
guild_owner_id= guild.owner_id,
)
(these shouldn't be in bot code normally)
from django.core.management.base import BaseCommand
from django.db import models
from accounts.models import *
from asgiref.sync import sync_to_async
from discordbot.models import *
!e crash
@cursive gust :x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | crash
004 | NameError: name 'crash' is not defined. Did you mean: 'hash'?
!e import random
def generate_word(min_length, max_length):
letters = "abcdefghijklmnopqrstuvwxyz"
word = ""
for _ in range(random.randint(min_length, max_length)):
word += random.choice(letters)
return word
random_word = generate_word(3, 7)
print(f"Your random word is: {random_word}")
@cursive gust :white_check_mark: Your 3.12 eval job has completed with return code 0.
Your random word is: xgndka
please use #bot-commands
Unable to convert 'snekbox' to valid command, tag, or Cog.
!source
!source e
Run Python code and get the results.
I've extracted the event replay from the game
https://github.com/parrrate/ruchei/blob/main/src/fanout_replay.rs
"not because of Java. because of Oracle"
I've never used Java for an actual project
"managed to get out of working for Oracle -- already a success story"
this broke the code
it opens the webbrowsers, but breaks when trying to open discord
while True and tries > 0:
choice = input("pass: ")
if choice == 'game':
print("welcome gamer")
webbrowser.open('https://www.youtube.com/watch?v=EUQe85b5VgQ&list=UULFJBpeNOjvbn9rRte3w_Kklg')
print('music started')
#os.startfile("C:\\Users\\jayda\\AppData\\Local\\Discord\\app-1.0.9028\\Discord")
subprocess.Popen(
r"C:\Users\jayda\AppData\Local\Discord\app-1.0.9028\Discord.exe",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
start_new_session=True,
)
print('Discord started')
webbrowser.open('https://www.google.com/')
print('google opened')
print('CPU Execution time:', res, 'seconds')
print('Have fun!')
time.sleep(10)
I could have implemented it wrong tho
I thought the first param had to be in a list?
breaks in what way?
not necessary
the py file closes and discord doesnt open
I haven't used it in a long while
...\app-1.0.9028...
also, won't this break every time Discord updates
I found that meme
How did you remember to continue searching for this?
while looking for this
try replacing PIPE with DEVNULL
context:
Bryan Cantrill calls both Oracle (or sometimes its ex-CEO, Larry Ellison) a "lawnmover" for the lack of care and other stuff
"no, lawnmover doesn't hate you, it can't hate you, it doesn't care"
ุณูู ูู ุนูู ุฌุงูุฏู ุจุณ
no
also, that file path name is pretty unrelated
future problem.. Discord updates quite often.
THIS, ALL OF THIS
I wrote a music bot in autocode (node.js with HTTPS handoffs), and it was every freaking month something was breaking. between yt, spotify, and discord.
The joys of using other people's shit ๐คฃ
let currentInfo = await lib.discord.voice['@release'].tracks.retrieve({
guild_id: guild_id,
});
I just kept releasing the version lmao. fixed allot of my issues
then it was up to the lib to fix their stuff for discord
discord sometimes gets voice connectivity issues
(which~~, apart from usecases you shouldn't be asking for help on here,~~ affects stuff like TTS bots)
you are a beautiful human being
no, those issues ill go to the proper guild lol
thank you again
of this sort:
https://github.com/Rapptz/discord.py/issues/9277
now im going to go figure out how what you implemented worked
hiding why?
@earnest crag
don't hide. put a token for the access
or don't create a route at all
or deny it in the proxy
from browser?
if it's from browser, you can't hide it
!stream 939245274126250015
โ @earnest crag can now stream until <t:1703969303:f>.
the user sees all the traffic
@earnest crag this is browser-side, right?
the JS
then you can't hide the traffic
do you want to restrict which user sees what?
for that you need authentication
no code highliting
@earnest crag where is sign-in/sign-up?
it's a part of premium ๐
authentication for "who is who"
authorization for "who can do what"
int x = 5;
thats not a good feature to put behind money
cus i can just code on my editor and then copy and paste
if you wanna do it manually you have to parse the code
yeah i publish all of my codes under AGPL :))))))))))))))))))
wait whats that
its GPL but more
more what
more gpl stuff. idk ๐
The Affero General Public License (Affero GPL and informally Affero License) is a free software license. The first version of the Affero General Public License (AGPLv1), was published by Affero, Inc. in March 2002, and based on the GNU General Public License, version 2 (GPLv2). The second version (AGPLv2) was published in November 2007, as a tr...
@earnest crag cookis are browser based
the brower keeps track of them
yep
js is easy
no, not their site
thats even easier
they both provide an element that you can interact with
you can place it wherever necessary
@wind raptor screen share pls
!stream 939245274126250015
โ @earnest crag can now stream until <t:1703969986:f>.
@earnest crag quick question. where are you from. you sound like a eastern european
you have to change the element an your html
what are you storing text in? <textarea>?
div ๐
come back! you are my only hope
are you using npm or just pure JS?
scss ?
just adding classes and scripts should be enough
<textarea class="prism-live line-numbers language-html fill" id="ihtml" style="--height: 50vh"></textarea>
<script src="lib/bliss.shy.min.js"></script>
<script src="lib/prism.js"></script>
<script src="lib/prism-live.js"></script>
you also need to download prism.js
in the lib dir
well actuly you have to put in static/lib/
wherever you chose to put them
you can change it something else
select all
dude. this page has a crypto mine or something. my cpu is not happy on it ๐
it's minifying JS/CSS in-browser, apparently
worked fine for me
๐ thats awesome
these two
("download js" and "download css")
select all
Prism Live: Lightweight, extensible editable code editors. A work in progress, try it out at your own risk (and report bugs!) ๐
it's a theme I think
A work in progress
(maybe not)
U dont need the live thing
yes. thats correct
seems working
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="prism.css" rel="stylesheet"/>
<link href="lib/prism-live.css" rel="stylesheet"/>
</head>
<body>
<div class="box">
<div class="editor">
<textarea class="prism-live line-numbers language-c fill" id="ihtml" style="--height: 50vh"></textarea>
</div>
</div>
<script src="lib/bliss.shy.min.js"></script>
<script src="prism.js"></script>
<script src="lib/prism-live.js"></script>
</body>
</html>
<script src="lib/bliss.shy.min.js"></script>
<script src="prism.js"></script>
<script src="lib/prism-live.js"></script>
prism you already have
ye bt what is bliss
this is the whole thing
.
// The code snippet you want to highlight, as a string
const code = `var data = 1;`;
// Returns a highlighted HTML string
const html = Prism.highlight(code, Prism.languages.javascript, 'javascript')
not for live
yeah
Be back in a bit.
just add classes to the existing textarea
took that from a project that's >3 years at this point
I don't remember how to configure --height properly
in the original code I had it at 40vh because there it was fine
it may potentially be resizable without that parameter
yeah, removing --height makes it auto-resize
it might also not work because prism-live isn't live enough
okay, if that doesn't work, then use ace.js
I don't know
I don't think it's necessary
just used it to pull text out of it
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
you can also
steal take editor code from there
whatever the specific language says
snake_case camelCase
PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.
More information:
- PEP 8 document
- Our PEP 8 song! :notes:
in Python, camelCase isn't used at all
CLASSES
PascalCase not camelCase
for classes
in JS it's fine-ish to use snake_case because JS has no rules
"try prism.js until you realise it can't work, then switch to ace"
Prims.Live might have stuff to reload
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CodeChest</title>
<link rel="stylesheet" href="../static/styles/snippet_editor.css" />
<link rel="icon" type="image/x-icon" href="../static/assets/logo.png" />
<link href="../static/lib/prism.css" rel="stylesheet" />
<link href="../static/lib/prism-live.css" rel="stylesheet" />
</head>
<body>
<textarea class="prism-live line-numbers language-c fill" id="ihtml" style="--height: 50vh"></textarea>
<script type="module" src="../static/scripts/snippet_editor.js"></script>
<script src="../static/lib/prism.js"></script>
<script src="../static/lib/prism-live.js"></script>
</body>
</html>
as the kids say, "๐"
async await
it's okay in JS
mostly
try to reduce it
JS isn't as smart as other languages which optimise useless async away
each (async()=>{})() creates a promise
and each promise is like a task (JS is proactive with handling running, even without await it will start)
eh
in hardware
close to it
while
in Verilog, stuff you describe might actually run in parallel, in some sense
if LIGHT a LIGHTBULB
10 sec DELAY
IF if LIGHT a LIGHTBULB2
10 sec DELAY
GO TO WHILE AGAIN
just because it doesn't allow multi-level sequential dependency
or something like that
Rust's futures are somewhat good for learning how async works/can work
parts of regulal C code may run in parallel
even if you use one thread
thanks to pipelining
C also doesn't really care what order you put statements in
it's almost free to do whatever it wants as long as it's logically correct in a single-threaded setting
require('./utils.js');
require('./../static/lib/prism.js');
require('./../static/lib/prism-live.js');
ammmmmmmmmmmmm
good enough availability
won't run on Internet Explorer though
it's minified
or add a script tag dynamically
(note: it almost never works)
((for security reasons))
var my_awesome_script = document.createElement('script');
my_awesome_script.setAttribute('src','http://example.com/site.js');
document.head.appendChild(my_awesome_script);
var const
!stream 939245274126250015
@mint fjord@cobalt fractal gimme steam perms
pretty please
all I want is stream perms for xmas
@sly jolt poke!
its looks like one
what's going on with y'all
nothing apparently
Looks like it to me
"Fire people who prefer languages like Rust."
Okay?
"Restrict backend languages to Python or C..."
Backend of what?
"Always use C instead of C++."
Also okay?
@whole bear run away it's OOP
@desert vectorGIMME SCREENSHARE PLS
sry CAPS have it on from minecraft
I'd have to be there to make sure you weren't streaming anything bad
and I'm at work
so I can't really be there
sorry mate
MY CODE ISN'T BAD
ITS CLEAN
it may not be, but I can't join to verify that
for(int y = 0; y < image.getHeight(); y++){
String row = "";
for(int x = 0; x < image.getWidth(); x++){
int pixel = image.getRGB(x, y);
int a = pixel >> 24 & 0xFF;
int hex = pixel & 0xFFFFFF;
String s = " ";
if(!name.contains("rgb") || a == 0) colorArray[y][x] = "!!!!!!";
else colorArray[y][x] = String.format("%06X", hex);
if(a > 0) s = "โโ";
row += s;
}
Really @rugged root
@acoustic urchin ๐
export class snippet {
constructor(
snippet_id,
name,
code,
short_desc,
full_desc,
favourite,
snippet_list_id
) {
this.snippet_id = snippet_id;
this.name = name;
this.code = code;
this.short_desc = short_desc;
this.full_desc = full_desc;
this.favourite = favourite;
this.snippet_list_id = snippet_list_id;
}
display(where, callback) {
if (where) {
const snippet_div = document.createElement("div");
snippet_div.className = "snippet";
if (this.favourite) {
snippet_div.classList.add("favourite");
}
where.prepend(snippet_div);
const name_div = document.createElement("h3");
name_div.innerText = this.name;
snippet_div.appendChild(name_div);
const short_desc_div = document.createElement("div");
short_desc_div.className = "short_description";
short_desc_div.innerText = this.short_desc;
snippet_div.appendChild(short_desc_div);
const tags_div = document.createElement("div");
tags_div.className = "tags";
snippet_div.appendChild(tags_div);
snippet_div.addEventListener("click", () => {
callback(this.full_desc, this.snippet_id);
});
} else {
console.error("Error: 'where' is not defined");
}
}
}
if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
module.exports = snippet;
}
response:
ADD TO PATH
@rapid flame
python -m venv env
source env/bin/activate
pip freeze # should be empty
pip install numpy
pip freeze
Build cross-platform desktop apps with JavaScript, HTML, and CSS

Longhouse.c line 4145
struct class {```
UINT size;
UINT style;
int extra_bytes;
int extra_window_bytes;
HINSTANCE icon_executable;
HICON icon;
HCURSOR cursor;
HBRUSH color;
LPCSTR menu;
LPCSTR name;
HICON small_icon;
while vs for
numpy.while
16
9
0.65
sum
+-*/
What's faster, a for loop, a while loop, or something else?
We try several different ways to accomplish a looping task and discover which is fastest.
โ mCoding with James Murphy (https://mcoding.io)
Source code: https://github.com/mCodingLLC/VideosSampleCode
SUPPORT ME โญ
Patreon: https://pa...
99 + 1 =100
2 + 98 =100
1 - 100
1+ 2 +3 + 4
99+ 1 =100
2 +98
@rapid flame
Yo @olive hedge What did we do?
SCSS
tkinter
@whole bear me gonna annoy you for projects and stuff in a month ^-^
!stream 717749310518722691
โ @whole bear can now stream until <t:1703987766:f>.
!voice ๐
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Hi
Btw do you play genshin?
My phone just becomes like a hot pan when I play
My PC is potato ,so can't play
My phone is better than my pc
My pc is 1 year old
I got i5 11 gen maybe
But I don't have a dedicated GPU
Btw how long you coding?
Cool
Me coding from 1 year ,but I am not expecting to be in computer field
Hmm twice a week(
Imma play something,bye
Ye imma play genshin
Btw can I stream my game here?
Just wana share my experience
!stream 1057874033925967933
โ @wispy spade can now stream until <t:1703994766:f>.
Imma rejoin
Hii @somber heath
A 30 minute video about opening up a text box and typing something into it for later, made for people who watch videos about doing that rather than just getting work done.
00:29 Requirements
4:10 Zettlr, VNote, and nb
5:48 Zim
7:50 QOwnNotes
12:31 The end of pretending this is about productivity
14:48 Emacs
21:18 Neovim
25:59 It never ends
27:1...
`123
5 + i
x = 5+i
y 3+xi
x + y
sum( x y)
return x.real + y.real "+" x.notreal + y.notreal
x = sum(x, y)
w3schools
class Main