#unix

1 messages ยท Page 41 of 1

lavish hemlock
#

Ok i see some responses

#

@rustic sky How do you see the total number?

dusk shadow
#

grep then pipe to wc -l

lavish hemlock
#

SSH key and TOTP is overkill lol

rustic sky
#

for some people, yes

#
joseph@cactus:~$ sudo zgrep "Invalid user" /var/log/{auth.log,auth.log.*.gz} | wc -l
105824
#

SSH key is not overkill by any means

#

on every host I operate the first thing I do is completely disable password authentication

dusk shadow
#

SSH keys are preferred, but i don't use them, but i should.

lavish hemlock
#

zgrep?

dusk shadow
#

zgrep is used to serach zipped files

#

hence the leading z

#

there are a few more, like zcat etc

lavish hemlock
#

@rustic sky Each time i use that command, it goes up by 2?

dusk shadow
#

people may be trying to get in now, trying a bunch of passwords, if it's from the same IP, you can block them, but that seems kinda futile

#

but, if you wanted to, you could try something like ufw reject from <IP> to any, just make sure that your not blocking a valid IP of course (like your own ๐Ÿ˜› )

rustic sky
#

Ohhhh I know why it's going up lol

dusk shadow
#

sudo

rustic sky
#

because when you run sudo command it logs something like ```
May 29 01:20:49 cactus sudo: joseph : TTY=pts/0 ; PWD=/home/joseph ; USER=root ; COMMAND=/bin/zgrep Invalid user /var/log/auth.log /var/log/auth.log.2.gz /var/log/auth.log.3.gz /var/log/auth.log.4.gz

yep
lavish hemlock
#

i don't get it

rustic sky
lavish hemlock
#

but anyway

#

105824

#

insane

rustic sky
#

it's searching for Invalid user

dusk shadow
#

it's telling you that someone ran sudo, which should be of concern if it wasn't you

rustic sky
#

yeah

lavish hemlock
#

i feel kinda ashamed from a google instance

#

really

#

google

#

i would expect them to be more secure than anything

rustic sky
#

huh?

#

it's not insecurity

dusk shadow
#

sadly, there's no global bad IP list, they are leases generally.

#

so if a bad person has it today, a good person could have it tomorrow

#

and vice versa

lavish hemlock
#

why can i not just block anybody that doesn't have a home directory in /home

rustic sky
#

it is doing that

lavish hemlock
#

oh

rustic sky
#

the bad user errors are that

#

if you want auto banning look into fail2ban

dusk shadow
#

i think he's saying he's in GCP

#

and why goesn't google just block these malicious users

#

magically

rustic sky
#

ah right, coming from GCP

#

yeah, it's hard to know from Google's end

lavish hemlock
#

all of the IPs come from china

#

i just wanna ban china

rustic sky
#

yeah, chinese proxies

lavish hemlock
#

yeah

rustic sky
#

don't ban china

dusk shadow
#

pwn: you can also add 2fa if you want

rustic sky
#

just setup fail2ban

lavish hemlock
#

i'll try

#

but the logs will still go through wont they

rustic sky
#

uhh

#

yes

lavish hemlock
#

Ok

#

Do you use google-authenticator?

rustic sky
#

yes

dusk shadow
lavish hemlock
#

If there's a way to setup login with my yubikey i'd prefer that @dusk shadow @rustic sky

lavish hemlock
#

Yeah i must of read it more than a 1000 times lol

#

Usage: ykman [OPTIONS] COMMAND [ARGS]...
Try "ykman -h" for help.

Error: No YubiKey detected!```
#

It is plugged in

solid path
#

Guys im using linux Ubuntu but for some reason when I use shortcuts while playing a game it exit the game screen,I updated ubuntu but its still happening,pls if you know anything about it help me,thx

safe remnant
#

For some reason, why does the tkinter look so bad in ubuntu

#

It makes me cry

#

๐Ÿ˜ญ

#

:sobs:

main olive
#

@lavish hemlock you got pcscd.service started and enabled?

#

systemctl status pcscd

past raptor
#

@safe remnant use gtk+ its much better

lavish hemlock
#

Yes it is running @main olive

#

Is it because i'm sshing to a remote server using PuTTY

#

how does the remote machine know i have my yubikey in

#

Do they mean sshing locally?

safe remnant
#

@past raptor I learnt pygtk, but i cant make out themeing

#

๐Ÿ˜ญ

main olive
#

@lavish hemlock the challenge-response architecture means it does not need to be coupled to function, and the server (issuing the challenge) and the client (with the yubikey) can be separate and function over IP, like how you log into your Google account using a yubikey

lavish hemlock
#

Ok

main olive
#

however

#

I'm not sure putty supports it

lavish hemlock
#

I seen it on a video

honest pasture
#

i'm moving hosting of my discord bot from a windows pc to a raspberry pi. i want to relaunch the bot as soon as it crashes

#

on windows i used a file containing a goto loop around a command to run the file

#

how would i do this in unix?

main olive
#

proper answer? you set up a systemd unit

#

otherwise, while true; do [bot command here]; done

#

alternatively, don't write code that crashes

honest pasture
#

it's the best way of keeping it up in case something goes horribly wrong

main olive
#

doesn't rewrite restart the bot on its own @main olive

#

?

#

rewrite?

#

put it this way

#

idunno

#

i had the same question years ago and as far as i remember i was told to use rewrite

#

run() will restart the bot once it catches any exception

#

@honest pasture

#

it should at least

honest pasture
#

@main olive I'm using rewrite

#

Idk if it does that, though

#

I'll need to check

main olive
#

yeah you can try raising an exception inside of any method

#

with raise keyword

#

run() is supposed to still continue working and not just exit out of

#

script

vagrant rune
#

@honest pasture discord.py has reconection logic implemented, so you'd want the process not to die

#

You could spin up a container with docker and run it with the option --restart unless-stopped

#

with that, your container will always restart if it crashes unless you manually stop it

fresh saddle
#

If you don't use docker you can set restart on failure on your service

vagrant rune
#

or use a process manager that controls your docker container

main olive
#
$ bash
bash: venv/bin/activate: No such file or directory

what could be causing this? its not in ~/.bashrc -- this happens any time i open a terminal or shell.

main olive
#

Doesnt happen in other user. Must be another config file somewhere

#

I suppose its time for a new user account if things are this messy... if anyone has any idea where to look lmk

#

I ran diff on the .bashrc in home to another users starter rc file. Its not there

fresh saddle
#

~/.bash_profile maybe?

main olive
#

from cat /usr/share/doc/adduser/examples/adduser.local.conf.examples/skel/dot.bash_profile I discovered this...

# When a normal (non-login) bash(1) shell starts, the following files are
# sourced:
#
#   /etc/bash.bashrc      - run by bash(1)
#   $HOME/.bashrc         - run by bash(1)

While other things are sourced in a login shell as told by that file, those are the only things that should happen from simply bash.

There is no bash_profile or equivalent though. I think the problem has to be in the etc fs, possible a permission thing maybe? I was editing user/group permissions and possibly by accident targeted the wrong things... idk, thats speculative since it doesnt explain the behaviour.

#

I will look

#

I think I am going to scrap this user acount and reinstall. I have learned a lot about better management of things since I installed this and its a mess now anyway.

#
drwxr-x---+   2 root    root    4096 May 30 19:32 virufac/

I undestand everything this says except for the + at the end

#

My next project I think is going to be automating my Linux system with python to be organized and backed up and better. I tend to make a mess on my own that I have to clean up when i play with new things.

main olive
#

usually people automate on linux with bash

#

not python

#

bash is basically whats loaded when you open a terminal in linux, so you better put time into learning bash basics

#

as to your question the + at the end means Access Control List and think of it as extension of already existing permissions in linux

#

its barely ever used but the purpose is the same, to set permissions on an object (file in this case)

#

like which user can access the file, which one can modify it and etc

#

it's considered additional and optional

#

so you never really see a plus here often

restive helm
#

Does anyone know how I can upgrade sqlite3 from version 3.22.0 to the latest version, 3.32.1?

#

This order, for some reason, didn't work:

sudo apt-get update
apt install sqlite3
sqlite3 -version
= 3.22.0

#

It'll say ''sqlite3 is already the newest version (3.22.0-1ubuntu0.3).'' - but that's untrue - since sqlite3's latest version is 3.32.1

fickle granite
#

well, that's probably the latest version that your release of Debian or Ubuntu has made available.

#

Often there are alternative apt repositories with newer stuff in 'em; read up about your distro to see

restive helm
#

(I'm using Ubuntu 18.04)

fickle granite
#

ow

#

that's ... ancient

#

you know your distro is ancient when there's an LTS version that's newer

#

yeah, unix admin makes for the sad

restive helm
#

I got it cause you know.... they told me its... you know... stable cryingcat

fickle granite
#

oh it's stable jerry ๐Ÿ™‚

#

at some point they'll drop support for it, and it'll be really stable ๐Ÿ™‚

#

I think 20.04 is the new LTS hotness

restive helm
#

So..... you recommend me updating my Ubuntu version?

fickle granite
#

you can poke around the web site to see which version of sqlite that includes.

restive helm
#

to 20.04? Do you think that will fix this sqlite3 problem?

fickle granite
#

dunno if it'll fix it; and even if it does, I can't advise you about upgrading, since I know neither the costs nor the benefits (apart from the one possible benefit of getting the newer sqlite)

#

you can poke around the web site to see which version of sqlite that includes.
this to see if at least that 20.04 incudes the version you need

restive helm
#

Thanks doc ๐Ÿ˜Ž hattip

fickle granite
#

๐Ÿ’

digital haven
#

Anyone aware of a terminal spell checker? I want something that I can use such as:

sc thign 

and it return the probably word that I meant , or maybe a list of them

#

when searching i'm finding stuff for vim , ispell etc, but I don't think this is what I'm after

trail grove
digital haven
#

thanks, i meant for actual english words though, rather than console commands

fickle granite
#

I don't even know of a good one for files ๐Ÿ˜

queen merlin
#

@digital haven Checkout aspell

#

it can spell check text files, but that also means you can redirect into it as well

#

with < ... or maybe pipe to it

digital haven
#

Can it run as a terminal command as I mentioned?

queen merlin
#

aspell is terminal command

#

on linux

#

what are you on

digital haven
#

Oh ok, cool

#

Mac os

queen merlin
#

if it isn't there by default you can probably get it with brew

fresh saddle
#

By default IJ generates shell scripts with the shebang /usr/bin/env bash, is that really safe to use? Because I did a quick browse through the Linux standard thingy, I found that the shell should be in /bin/bash but nothing about env

wooden night
#

@fresh saddle env looks up the command based on the PATH,so it will adapt to wherever bash is installed on this machine.

fresh saddle
#

Well yes, I know that, but for compatibility reasons, which one is the best to use?

wooden night
#

Well doing it that way ensures bash could be elsewhere?

fresh saddle
#

I mean, is there more distro that don't have bash in bin than distro that don't have env is usr/bin ?

#

Because env is not part of the standard

wooden night
#

I'm not sure.

gilded basalt
#

If you want maximum backward compatibility use /bin/sh

#

That will work on systems without bash that use other shells

fresh saddle
#

Well, I'm using bash only features, so I need to use bash not sh

gilded basalt
#

If you're targeting bash specifically using env is best practice

main olive
#

on most systems, bash will be in /bin. but not all.

fresh saddle
#

And env will always be in /usr/bin?

main olive
#

from what i've seen over the years, overwhelmingly yes

fresh saddle
#

Okay gotta use it then, thanks!

digital haven
#

how can i operate on the output of ls ?

#

for example, ls | grep -v <something>, I'd like to be able to treat that like find <stuff> -exec <do stuff>

main olive
#

why do you need to operate on the output of ls?

digital haven
#

idk, i wanted to delete some stuff i guess, in this instance

main olive
#

ie, why do you need ls over globbing?

#

generally, it's a bad idea to operate on the output of ls

digital haven
#

because there are multiple matches to remove

#

a single to keep

#

so I'd like to be able to do ls | grep -v match -exec rm {} \;

#

obviously that won't work

formal schooner
#

use find

main olive
#

you can also have inverse globs

formal schooner
#
find . | xargs -n1 rm

or something like that

digital haven
#

-> % ls | grep -v DE | xargs -L1 rm seems to do it ๐Ÿค”

#

you can also have inverse globs
oh ok , hrm

formal schooner
#
find -not -name '*DE*' -delete

i think that works too

#

you'd have to look up the specific syntax for gnu find

digital haven
#

i could use egrep and give a pattern, but i didn't wnat to bother writing them out

#

find -not, nice, didn't know about that

formal schooner
#

much safer in case you have weird malformed filenames

#

find in general is safer than ls

#

ls is for visual display only imo

#

if only because you can do more "inside" find

#

without having to pipe bad filenames around

#

but for 99% of use cases it doesnt matter

digital haven
#

find makes more sense, it's what i'd usually use for this kinda thing

quaint gust
#

Hi I was told to come here and need help as I am not good enough to understand this. I am using a Mac>
Check this out:
Bpower@tests-MacBook-Pro Django % which pip3
/Library/Frameworks/Python.framework/Versions/3.8/bin/pip3
Bpower@tests-MacBook-Pro Django % which python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3

I'll explain more, but you can read through this screenshot. I might need to switch my PATH, not sure. But I also am getting interesting Warnings when trying to install this virtualenv, and trying to get to installing a Django project

Please Help. thanks so much

main olive
#

@quaint gust don't use sudo pip

#

use the --user flag instead

#

using sudo with pip fucks up permissions

quaint gust
#

@main olive
Okay, so I should do:
pip3 install virtualenv --user ?

main olive
#

may i ask why you're installing virtualenv in the first place?

#

python3 comes with venv built in

#

python3 -m venv

quaint gust
#

@main olive
hmmm, isn't it needed to use Django or Flask?

main olive
#

no

#

those don't even technically require venv

#

it's just that using venv makes it all much easier to manage

#

but yeah, they also work with regular venv

quaint gust
#

I ran into erros trying to install Django, but also Python 3 in different areas, but mainly I am following this blog now and it says to install virtualenv, but I also thought you have to install a virtualenv to run Django and flask

main olive
#

nah

#

blog might be dated a bit

#

virtualenv used to be very popular some time ago, but it's been mostly replaced with the built in venv

quaint gust
#

Okay, well what do I do with the built venv? how do I know tha tis installed?

main olive
#

check out python3 -m venv --help

#

it tells you what you can do

#

here's a tutorial as well

quaint gust
main olive
#

yes, that's a normal usage text

#

check out the tutorial i sent

quaint gust
#

@main olive
not sure if you saw my first message, but this is the main reqason I came ove rhere: !!!

Bpower@tests-MacBook-Pro Django % which pip3
/Library/Frameworks/Python.framework/Versions/3.8/bin/pip3
Bpower@tests-MacBook-Pro Django % which python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3

#

I reading the tutorial now

main olive
#

i don't see an issue with that

#

that's just your system python installs

quaint gust
#

okay, somebody else thought there was..

main olive
#

i'm no macOS expert, but it seems fine to me

stray marten
#

guys, doing a > b is the same as b < a?

quaint gust
#

@main olive
it worked. I got Django installed as well.

#

thanks

main olive
#

@quaint gust ๐Ÿ‘

#

@stray marten not at all

#

a > b is the same as
> b a

stray marten
#

mmm

#

a > b means the output from a goes to the input of b

main olive
#

and a < b is the same as
< b a

stray marten
#

right?

main olive
#

no

stray marten
#

oh

fresh saddle
#

That's a weird notation blobthinkingdown

main olive
#

that means that the output of a is directed to a file named b

stray marten
#

ok

#

< is for input

main olive
#

if you want the output to be the input of another process, you use a | b instead

stray marten
#

ah

#

so

#
mkfifo FIFO
sort < FIFO &```
main olive
#

FIFO is a file

stray marten
#

so here u are crating a FIFO

main olive
#

a first in first out named pipe

stray marten
#

yes

#

and then

#

sort < FIFO &

#

what does this mean?

main olive
#

you are sending the contents of the file FIFO (the pipe) to be the input of sort

stray marten
#

the input of sort to be written on FIFOยฟ?

main olive
#

there should be more to this

#

some other process should write to FIFO as well, so sort can read from it

stray marten
#
mkfifo FIFO
sort < FIFO &
ls -l > FIFO```
main olive
#

yep

#

this is the same as ls -l | sort

stray marten
#

i dont understand the mid line

main olive
#

you set up sort to read input from FIFO in the background

#

then, ls writes to FIFO

stray marten
#

ah

main olive
#

which sort then reads in the background

stray marten
#

so u sort what ever is on FIFO?

#

and then u send the output of ls -l to FIFO

main olive
#

yes

stray marten
#

so FIFO has something and sort can sort it?

main olive
#

basically yes

stray marten
#

so FIFO is 24/7 running?

#

what ever it reads it sorts it?

main olive
#

well, it's a named pipe

stray marten
#

so after doing

#

ls -l > FIFO the output comes from FIFO?

#

FIFO is what is printing on stdout?

main olive
#

that just writes the output of ls to FIFO. unlike a regular file, FIFO is emptied as it is read (first in first out)

stray marten
#

okey

#

but FIFO is only 1 use?

main olive
#

no not really

#

it can last for an indefinite amount of time

stray marten
#

i cant do ls -l > FIFO twice

main olive
#

it's a special sort of file

#

sure, but you'll also need to set up sort again as well

stray marten
#

oooh

main olive
#

because sort stops reading after ls stops writing

stray marten
#

omg

#

is a bit tricky

main olive
#

yes

#

you won't use it too often in practice tbh

stray marten
#

so by doing sort < FIFO & i just make a new program that is blocked cuz FIFO is empty

main olive
#

exactly

stray marten
#

by the moment FIFO gets something, that program works, and it returns 0

main olive
#

and it blocks until it can read

#

yep

stray marten
#

so it has nothing to do?

#

like a zombie?

#

is that a zombie?

main olive
#

well, it's waiting for input

#

zombies are a bit different

stray marten
#

yes, but once he gets input

#

u said i need to do sort < FIFO again

#

just doing mkfifo FIFO, what is FIFO? i mean

#

it cant do anything

main olive
#

sort stops reading and starts actually sorting the input after it gets EOF from ls

stray marten
#

just wasting memory

main olive
#

it's just a special file

stray marten
#

mmm okey

#

FIFO is what is printing on stdout?
^

main olive
#

the > operator redirects stdout to a file (in this case FIFO)

#

so yes

stray marten
#

ok ok

#

FIFO still exists

#

i did nano FIFO

#

and xD

#

i think my shell crashed

main olive
#

haha, nano is waiting for something to write to FIFO

#

open another shell and do id > FIFO

stray marten
#

wait what?

main olive
#

well, nano is trying to read the file, but just like sort, it blocks until something writes to it

stray marten
#

okey, i did id > FIFO

#

but nothing happened

main olive
#

hmmm

#

it should have popped up in nano

stray marten
#

ah yes

#

but i need to update the nano shell

#

i did cat on the onther console

#

i dont understand

tawdry sonnet
#

So I'm looking to try linux mint, but there's some windows programs that I need to study, so I think my best option is to run a virtual machine.

I have no experience with a vm, but aside from performance, is there any notable differences between installing mint on a partitioned drive vs a VM?

main olive
#

VMs are generally far more sluggish than running it on real hardware, at least from personal experience

#

with some notable exceptions, like GPU passthrough, but that's not something you'll probably do/need to do

#

oh, you said "aside"

#

my bad, can't read

tawdry sonnet
#

Yeah performance is my concern. I'll be running vs code on it and doing all my programming.

pulsar fern
#

f

main olive
#

has anyone successfuly ran an alias defined in .bash_aliases with subprocess

#

the stack question gives the answer for when all the aliases are defined inside .bashrc

#

what if i've got all of mine in .bash_aliases tho

#

๐Ÿ˜”

formal schooner
#

sounds like you just want to write a shell script and run it from python...

#

i assume it involves either invoking bash with -i or explicitly sourcing the file somehow

#

.bash_aliases is nonstandard btw, its a convention but its not read or used by bash itself

main olive
#

yeah i was tryna wing it and try to get the aliases from .bash_aliases to be imported with subprocess but didnt work out

#

i will write the script in bash

#

then

#

thx

main olive
#

now aliases only work when expliticly mentioned inside of script

#
tool="myalias"
$tool arg1 arg2
#

but when importing from string, it doesn't recognise the alias no more

gilded basalt
#

Try adding shell=True to your subprocess call

#

@main olive

stable shale
#

I think this is where I ask questions. Either here or discord.py because it's a discord bot but I think it's an OS question -- not specific to the discord.py

Snippet is in pastebin https://pastebin.com/DtnamGYi

The code is supposed to get a filename from the dictionary, generate a temporary filename for a directory, make the directory, and copy the filename into the directory. The function works ONLY if I comment out the chmod at line 17. From tests, the directory exists all the way up to line 20 (using os.listdir()) to check the contents of the directory. Once I switch to the command line and do a ls on the destination directory, however, the newly created directory isn't there.

gilded basalt
main olive
#

yep... your current code has a (unintentional) command injection vuln

gilded basalt
#

I have no clue what tempfile_get_candidate_names() returns (presumably a string), but it looks like tempfile is doing some stuff internally that could be messing with things

#

It may be easier to just use tempfile.mkstemp() and specify the directory you want the tempfiles to be kept in via the dir argument

stable shale
#

From what I can tell... tempfile.mkstemp performs cleanup and I wish the directory to persist until cleaned up by an outside process, which is why I used _get_candidate_names and made the directory myself.

#

and I thought there was a reason I didn't use shutils but I can't, for the life of me, remember. Still doesn't explain the chmod issue, though.

gilded basalt
#

Unlike TemporaryFile(), the user of mkstemp() is responsible for deleting the temporary file when done with it.

#

so it won't delete the file or the directory

stable shale
#

chmod still needs to work because mkdtemp creates a directory that " The directory is readable, writable, and searchable only by the creating user ID."

gilded basalt
#

I'm curious why the directory isn't being created in the first place

#

Maybe try running ls as root to see if it's a permissions issue

stable shale
#

the directory DOES get created. I put a "print( os.listdir( destination ) )" at various points (after the mkdir, after the chmod, and after the message about the file being copied) and all places showed the new directory. When I switch over to another shell and do a "ls -lart destination" the new directory isn't there.

#

and if I comment out the chmod line, the directory persists after the function ends.

#

That's whats got me stumped

stable shale
#

It's almost as if the python process doesn't like the 775 permissions

main olive
#

should be fine

#

775 has the execute bit for all fields, which is what directories definitely need

#

so i'm actually kind of stumped on this

stable shale
#

You and me both. If I don't chmod the directory, everything is created (755) but since I need group writable, I tried to chmod it and boom, the directory disappears, no errors, no traceback, nothing

main olive
#

wtf

#

the process via analogous shell commands works fine, i presume?

#

oh, wait

#

@stable shale

#

you os.mkdir/chmod the temptag dir in /var/www/dl/{temptag}, but try to copy your file into /dest/{temptag}

#

i'm guessing you forgot to change it in the command

stable shale
#

No, I forgot to "hide" that dest=/var/www/dl

main olive
#

ID LKE THIS

stable shale
#

Ok. It has something to do with the permissions. I wonder if it's got something to do with discord.py. But if I change the chmod to 755 instead of 775, the directory persists

#

and if I set the chmod to 750, the directory persists AND has the 750 permission mask

#

and if I set chmod to 770, the directory disappears... so somebody somewhere has an issue with me setting group write on a directory created in a python script.

main olive
#

strange

stable shale
#

very

#

and yes, if I do the chmod in the command line, it works just fine, directory doesn't disappear, etc.

main olive
#

it seems to work as intended on my machine

stable shale
#

so it must be something in the discord.py structure

#

That's the only thing that I can think of that's different.

formal schooner
#

!d g tempfile.TemporaryDirectory

shy yokeBOT
#
tempfile.TemporaryDirectory(suffix=None, prefix=None, dir=None)```
This function securely creates a temporary directory using the same rules as [`mkdtemp()`](#tempfile.mkdtemp "tempfile.mkdtemp"). The resulting object can be used as a context manager (see [Examples](#tempfile-examples)). On completion of the context or destruction of the temporary directory object the newly created temporary directory and all its contents are removed from the filesystem.

The directory name can be retrieved from the `name` attribute of the returned object. When the returned object is used as a context manager, the `name` will be assigned to the target of the `as` clause in the [`with`](../reference/compound_stmts.html#with) statement, if there is one.

The directory can be explicitly cleaned up by calling the `cleanup()` method.

Raises an [auditing event](sys.html#auditing) `tempfile.mkdtemp` with argument `fullpath`.

New in version 3.2.
formal schooner
#

!d g tempfile.TemporaryFile

shy yokeBOT
#
tempfile.TemporaryFile(mode='w+b', buffering=None, encoding=None, newline=None, suffix=None, prefix=None, dir=None, *, errors=None)```
Return a [file-like object](../glossary.html#term-file-like-object) that can be used as a temporary storage area. The file is created securely, using the same rules as [`mkstemp()`](#tempfile.mkstemp "tempfile.mkstemp"). It will be destroyed as soon as it is closed (including an implicit close when the object is garbage collected). Under Unix, the directory entry for the file is either not created at all or is removed immediately after the file is created. Other platforms do not support this; your code should not rely on a temporary file created using this function having or not having a visible name in the file system.

The resulting object can be used as a context manager (see [Examples](#tempfile-examples)). On completion of the context or destruction of the file object the temporary file will be removed from the filesystem.... [read more](https://docs.python.org/3/library/tempfile.html#tempfile.TemporaryFile)
formal schooner
#

easier to use than the lower-level mkstemp

#

that said you have a very weird problem and i have no idea either...

fresh saddle
#

There's also NamedTemporary*

stable shale
#

It's only easier if I didn't need the directory to persist after execution. The only reason for using the tempfile routines is to get a unique, meaningless, nonstandard name without having to roll my own naming routine.

#

anyway, I'm just going to have to work around it. If the desired group id is changed in anyway (either explicitly with a chgrp in the code or implicitly with the setgid bit in the parent directory) the directory disappears when the function exits if the directory is also given group write. If I leave the group write off or if the gid of the directory isn't changed, the directory remains post execution. I do not understand it but there must be something weird in the setup the admins did. Some supposed security feature or something.

main olive
#

that's really fucking odd

#

i can't get over this @stable shale

#

i have no idea why this is happening and it disturbs me

stable shale
#

Yea.. makes no sense to me, either. I've done a few experiments and that's what it boils down to. The script is from a discord bot I'm tinkering with and that's one of the context commands. The script is running, right now, under my user account and it expects the directory to have my UID/GID (the main GID, I'm in the other group, too, but it's not MY group) if it has write permission.

stray marten
#

when u use mmap

#

is it brung to RAM memory?

trail grove
#

all memory usage in python is ram

#

any variable is held in memory, so yes, it uses RAM

digital harness
#

Why are certain tasks (noticeably file or I/O-related) faster in sh than python? Is there a way to get similar speed in python?

serene eagle
#

how do I find where my files are installed in ubuntu?

#

because I can't find it

#

Because I installed 2 discords

warped nimbus
#

Which files?

serene eagle
#

The discord files

warped nimbus
#

I actually do not know where specifically Discord installs to unfortunately

#

On linux anyway

#

You can use find to look for it

serene eagle
#

hmm then what about other files

pulsar bane
#

let me spin up my VM

#

and look for it

serene eagle
#

oh didn't know that's a command

warped nimbus
#

Yeah, I suggest you read the manual on it before diving in to using it

#

man find

serene eagle
#
discord
discord/common
#

These are the first two lines

#

So it's installed in a folder called discord?

#

I think I got it

warped nimbus
#

My guess would have been it's in ~/.local

serene eagle
#

How do I open files using the terminal?

#

Yeah sorry i'm real new to ubuntu

warped nimbus
#

If it's an executable file, just type the file path into the terminal and press enter

serene eagle
#

i'm trying to open the folder it's in

#

not run it

warped nimbus
#

Depends on which file manager you use. I don't know what Ubunu comes with

#

But in the terminal, you can just cd to the directory

serene eagle
#

i'm using the terminal

warped nimbus
#

then ls to list the files

serene eagle
#

yeah I cd into it and did ls

#

but I'm trying to open the folder

#

If I know what files are in it but can't edit them

#

it defeats the whole purpose

warped nimbus
#

You don't need to open a folder to edit the files

#

You can do it from your terminal

serene eagle
#

yeah but I don't know the commands

#

I can look it up lol

#

yeah I can do it

warped nimbus
#

Are you trying to edit a text file?

serene eagle
#

i'm trying to delete whole files

#

then I can reinstall discord

warped nimbus
#

rm deletes files

serene eagle
#

because I installed 2

#

and both of them works

warped nimbus
#

rm -r can delete a directory

#

Just be careful with those commands cause they permanently delete files

serene eagle
#

alright thanks

pulsar bane
#

also you could try whereis discord next time

serene eagle
#

find works just as well

#

Was able to find where the files are located

#

a folder called snap

pulsar bane
#

what find gets you may be differenbt

serene eagle
#

yeah whereis is a lot more precise actually

warped nimbus
#

Keep in mind it only searches certain, common/standard locations

#

Find can search anywhere

pulsar bane
#

^---this is true

#

but also one shouldn't manually try and delete files to "uninstall" something either

warped nimbus
#

Most of the time whereis is adequate

#

I agree, if discord was installed with a package manger

#

But some closed source apps have their own installers that do whatever

serene eagle
#

I am back on windows

#

but yeah it works

#

I was able to delete one of the discords

#

I can't delete the other one though

#

but it's fine

pulsar bane
#

i am not even sure how that happened

serene eagle
#

I do

#

I downloaded the .deg and the one from the ubuntu store

serene eagle
#

Does anyone know the issue here?

#

I'm not sure what It means by root folder

#

and it's Import Error btw

main olive
#

it doesn't say root folder

#

it says you need to be root, ie the root account (as in, you should probably run it with sudo)

#

and importerror is thrown when there's a failure to import a module

serene eagle
#

huh

#

oh ok

main olive
#

you probably want your venv to persist though

#

so you should use the -E flag with sudo

#

sudo -E python3 script.py or whatever

serene eagle
#

hmm yeah

#

yeah that works

#

thanks

#

what does -E stand for?

main olive
#

just tells sudo to not nuke the current environment

serene eagle
#

ah alright thanks

modern kestrel
#

@main olive any chance you can help . with terraform mate

#

or rather brew

main olive
#

dunno what terraform even is but i'd still be able to bounce some ideas around, what issue are you having

modern kestrel
#

im trying to uninstall it

#

but it wont go

#
โฏ brew uninstall terraform
Uninstalling /usr/local/Cellar/terraform/0.12.26... (6 files, 52.6MB)
โฏ rm $GOPATH/bin/terraform
rm: /bin/terraform: No such file or directory
โฏ rm /usr/local/bin/terraform
โฏ terraform --version
Terraform v0.11.14

Your version of Terraform is out of date! The latest version
is 0.12.26. You can update by downloading from www.terraform.io/downloads.html
โฏ sudo rm /usr/local/bin/terraform
Password:
rm: /usr/local/bin/terraform: No such file or directory
โฏ terraform --version
Terraform v0.11.14

Your version of Terraform is out of date! The latest version
#

like wtf

main olive
#

what does which terraform say

modern kestrel
#

i want to upgrade it but upgrading it doesnt work

#

/usr/local/opt/terraform@0.11/bin/terraform

#

ooh is this where it is?

main olive
#

yep

modern kestrel
#

thank you! i knew you'd help me haha

#

jeez been stuck on that for an hour

main olive
#

๐Ÿ‘

modern kestrel
#

Sent you a twitter follow

stray marten
#

why u cant use unnamed pipes for local independant processes?

serene eagle
#

my mic isn't working

#

does anyone know a fix?

#

I tried a lot of things

#

Nothing is working

main olive
#

"not working" in what way

serene eagle
#

it's not receiving input

main olive
#

not being detected? detected, but no audio is being recognised?

serene eagle
#

it detects that it's there

#

but it doesn't receive any audio

main olive
#

you tried unmuting it and turning the volume up with alsamixer?

serene eagle
#

never seen tha tbeofre

#

let me try it

main olive
#

it's a terminal command

#

when you open it up it should present you with a bunch of things

serene eagle
#

What do I do

#

I don't understand any of this

main olive
#

press the right arrow, are there more options than this?

#

one of them should say "mic" or something

serene eagle
#

nope

main olive
#

ah wait

serene eagle
#

Let me see

main olive
#

press f4

#

says "capture" on the top, as opposed to "playback"

serene eagle
#

here this is the other options

main olive
#

and after pressing f4?

serene eagle
#

this is everything

main olive
#

ok, wrong audio card maybe

#

press f6, what options are there

serene eagle
main olive
#

huh

serene eagle
#

Just these two

main olive
#

hmmmmmm

#

what does amixer get Capture say

serene eagle
#

what

main olive
#

it's a command

#

(amixer this time, not alsamixer)

serene eagle
main olive
#

what

urban merlin
#

@serene eagle Try installing pavucontrol and look through the settings there. I've found that some options only show up in it, not the system sound settings program.

serene eagle
#

I did install pavu control

urban merlin
#

You ensured all the settings were correct?

serene eagle
#

I tried every option there

#

Nothing works

#

I can hear stuff

#

but it won't get the inpput

lavish hemlock
#

can i secure my MySQL server besides password?!

main olive
#

secure against what?

#

a good starting point is to go over your sql users' permissions

#

and see whether they're the minimal required - ie, if your front-end only reads from a database and never writes to it, the user for it shouldn't have write permissions

#

further, going over your sql queries in your code to see whether you've got potential for SQL injection (so looking out for string concatenations or other formatting shenanigans) is a good idea - any statements with user input should be performed as prepared statements

lavish hemlock
#

Thank you @main olive

stray marten
#

@main olive one thing

#

if i have man1 | man2

#

how could i implement this by myself?

#

imagine i have man1 on a[0] and man2 on a[1]

lavish hemlock
#

@main olive No 2fa or anything like that?

#

private key

#

lol

sweet leaf
#

Is there any resource for best practices in setting up Python on Linux? I am trying to make a setup on Raspbian that I can SSH into for Python remotely. I struggled a bit before on my own since there were complications to where pip was installing things vs where Python was installed, and it wouldn't recognize what pip installed.

dusk shadow
#

@sweet leaf I haven't used Raspbian in at least 5 years ๐Ÿ˜ฆ Is there more than one version installed?

#

of Python

lavish hemlock
#

@main olive How do i change a users password? SQL Wave?

dusk shadow
#

@lavish hemlock I'm not sure I fully understand the question, do you want to change the password of an SQL user using Python? If so this might help: https://stackoverflow.com/questions/56648034/how-can-i-change-password-for-sql-login-to-database-using-pyodbc

lavish hemlock
#

@dusk shadow i am not using python

dusk shadow
#

oh, just in MySQL or something?

lavish hemlock
#

Ya

dusk shadow
#

assuming you have root maybe something like ALTER USER 'userName'@'localhost' IDENTIFIED BY 'New-Password-Here'; ?

#

er, assuming you have root on the DB, not the linux machine

lavish hemlock
#

Oh yes, i do i'll give it a try

#

Thanks

dusk shadow
#

@lavish hemlock np, hth ๐Ÿ™‚

sweet leaf
#

@dusk shadow Yeah it's got Python 2 and 3.7 installed by default? All I know so far is that I need to uninstall Python before reinstalling since you can't just update Python

dusk shadow
#

@sweet leaf so, you are trying ot use python3, and when you pip install something, it still reports the error?

sweet leaf
#

no, I haven't done anything yet. It's just in the past I have had trouble with getting pip installed things to get recognized in Python

dusk shadow
#

@sweet leaf if so, you need to use pip3 instead of pip, which is not intuative (for me at least, i ran into that a bunch of times)

sweet leaf
#

I'm moreso trying to learn the proper way of doing things before I try swapping things around

dusk shadow
#

if you have both versions installed, just remember there is pip for python2x, and pip3 for python3x

#

which was very confusing for me.

sweet leaf
#

so I should probably uninstall Python 3 and Pip3 first

#

then try to reinstall the latest version

dusk shadow
#

ehh, generally python3 is better, but if your running stuff on your pi, and the distro comes with py2, i dunno if i would.

#

b/c most other people that are developing code for the pi would probably be using py2, but if it comes with both, then that would be fine

sweet leaf
#

it comes with both

#

but I have no knowledge in Python 2 so I'm learning in Python 3

#

I'm just thinking it makes more sense to be on the latest version

dusk shadow
#

then that's fine. I wouldn't generally upgrade 'just because' just becuase you may have to install from source or something

#

and then you may have your package manager version and your source installation

sweet leaf
#

oh I was going to just go with whatever is on APT

dusk shadow
#

yea, that's should be fine generally

#

but apt may not have the newest, and upgrading to the newest might not always be good

sweet leaf
#

that's a good point

#

ok maybe I just won't touch what's already prepared on Raspbian and just figure out venvs instead

dusk shadow
#

if you want to just do development, you could try spinning up a VM with whatever version of python you want, a lot easier to recover from terrible things in a VM than on an actual platform like the Pi

#

also, if you have a windows machine, I am really enjoying visual studio code then install python in your windows box (assumign you don't need python for windows for any reason) very nice dev environment for me.

sweet leaf
#

yeah probably. I'm doing it mainly for learning how ssh works and whatnot

#

an idea was to use an iPad to SSH into the Pi remotely to use Python when I'm not at home to use something else

dusk shadow
#

A VM might be better for learning that, you can try more mainstream distros

#

also, for the pi, if you haven't already, checkout adafruit, they have lots of cool things you can do to addon to the pi GPIO ports, like LCD screens with buttons etc which you can then program with python

sweet leaf
#

Cool, I'll look into it

#

I want to get a proper Python setup going on the Pi first so I can remote into it

#

Probably not the easiest way to setup Python, but it feels worth learning

dusk shadow
#

that should generally already exist, if it already comes with py2 and py3, your good to go ๐Ÿ™‚

sweet leaf
#

yeah I'll just learn how to setup venvs to manage the packages

#

hopefully that'll solve any pip package issues

dusk shadow
#

are you having an issue with pip now?

sweet leaf
#

not now, but the last time I tried on a VM I did

#

basically the pip package wouldn't get recognized

#

since pip was installing to some location

#

that the default python installed wouldn't recognize

#

it was weird

#

and I tried pip3 too

dusk shadow
#

oh, the only other thing i recall was trying to use an external file, and trying to just import that, rather than calling the full path

sweet leaf
#

yeah it's that kinda stuff I ran into trouble with

#

I'd have to fully define the path

dusk shadow
#

hrm, you shouldn't have to do that, but if you get it again, post it, i'm sure someone can help, I haven't seen that kind of problem in awhile, but knowing altinstall and venvs is never a bad thing. ๐Ÿ™‚

#

you can also try python3 -m pip install <package> which should generally work.

sweet leaf
#

Yeah that resource looks like it should explain everything

#

I'll go through that when I try setting it up

modern kestrel
#

@main olive is the LPIC 1/2 a good place to get started with understanding Linux better?

pulsar bane
#

is LPIC after linuxs essentials?

#

you may want to get started with Linux Essentials if you aren't farmiliar with Linux at all

#

@modern kestrel

#

otherwise i think LPIC1/2 are good choices

main olive
#

@modern kestrel I'm not too familiar with LPIC personally, so I honestly couldn't say

#

sorry!

karmic saffron
#

How can I package my app (binary file) to distribute it with .deb? I would need a script that creates a .desktop file inside the .deb

serene eagle
#

Can anyone help me with an import error I am having?

#

I looked online but the site said to add vscode to path

#

but I can't really find it

serene eagle
#

I'm not sure why it is unable to import

#

wait the import error is fixed

#

I just needed to not open code as root

#

or admin

#

either one

main olive
#

LOL

main olive
#

I just needed to not open code as root
@serene eagle I don't think that's a fix, that just changes your PATH your bit so you don't get this error anymore

#

please don't run vscode as root

serene eagle
#

huh yeah

#

I know now XD

main olive
#

instead, open up the vscode internal terminal next time it happens (it's in one of the menus) and do python3 -m pip install -U discord.py

serene eagle
#

I have to install it again?

#

huh

#

oh yeah since you're here

main olive
#

this isntalls discord.py in the same environment as pylint is in

#

or whatever

serene eagle
#

So how can I get linux to run an exe file

#

I read something about

main olive
#

you use wine

#

what file is this

serene eagle
#

yeah wine that i heard about that

#

it's an exe file

main olive
#

what specifically though

#

does it not have a linux build

serene eagle
#

I don't think I can get anymore specific

#

I'm not sure what to say

#

It's a game file

#

if that matters

main olive
#

iunno, check out winedb to see what people have rated it (for wine compatibility, I mean)

serene eagle
#

how would I use wine though

main olive
#

wine mything.exe

serene eagle
#

alright

#

i don't need sudo?

main olive
#

no

#

don't randomly use sudo

serene eagle
#

I don't know when I should and shouldn't used sudo

#

I'm extracting a file

#

a .rar file

#

but the progress bar doesn't even show up

#

It just extracts one file

main olive
#

if you don't know, you probably don't.

serene eagle
#

Yeah...

#

Isn't it obvious... I said I didn't know so yeah I don't....

summer trail
#

@serene eagle I believe xx was saying that if you don't know for sure that sudo is required, you shouldn't use sudo. Using sudo somewhere where you didn't need to can lead to really difficult to debug issues, like config files or directories inside your home directory being owned by root - and that's to say nothing about the security issues of running untrusted code as root, or the fact that root can break an operating system in a way that a regular user can't.

main olive
#

exactly this

#

sorry, wasn't too clear on that

serene eagle
#

huh that is very interesting

#

thanks

sharp tapir
#

I think this question fits here?

When I use Pexpect on ubuntu, every expect or sendline leaves gibberish in my terminal, not as a response but actually in the command line and I have to delete it every time, anyone know why that might be happening?

#

code is

import pexpect
import sys
import signal

def makeserver():
    child = pexpect.spawn('bash Server', encoding='utf-8', logfile=sys.stdout)
    child.expect('Server started')
    print('Success!')
    return child

child = makeserver()```
main olive
#

thats not gibberish

#

it's an ANSI escape sequence, probably trying to draw colour

#

whatever is drawing your prompt doesn't seem to be supporting it

#

but it should work fine when executed as a script from a regular shell

#

@sharp tapir

sharp tapir
#

That makes sense, thank you!

humble onyx
#

hey guys I want to ask a general question here. I am not really satisfied by the answers from google.

Why linux sucks in gaming? You write your game in C or C++ or whatever and compile it for both platforms windows and linux. What can go wrong unless you use OS specific calls like write read?

main olive
#

OS specific calls

#

thats exactly what goes wrong

#

graphics are os specific iirc

humble onyx
#

I am not sure if I word things correctly but what is keeping developers from using POSIX standart library calls like fopen instead of direct system calls like open(I know they are just wrapper around the sys calls) for example?

main olive
#

wrappers are slower

#

There's nothing wrong with Linux that would make gaming less suitable for it

#

^

#

people just dont do it

#

But it has a much lower market share (for desktop PCs) so publishers and studios just don't put resources towards supporting Linux

#

because why would they, if no gamers use linux

#

dead loop

#

but steam proton exists now :3

humble onyx
#

so is it all about wrappers being slower so they have to use direct syscalls?

main olive
#

i mean thats why

#

somewhat

#

but like

#

xx said

#

so few people use linux for gaming, why bother?

humble onyx
#

I am interested in low level programming so I just asked myself. They have the source code why not compile it for linux as well. I underestimated the power of direct system calls I guess.

main olive
#

i mean also file paths

#

there's all sorts of things that are different

#

and i mean

#

there are cross platform game dev sdk's

humble onyx
#

I get it now

#

thank you

main olive
#

I am interested in low level programming so I just asked myself. They have the source code why not compile it for linux as well. I underestimated the power of direct system calls I guess.
@humble onyx
it's not about compiling. Most games are written with such a level of abstraction that they can be compiled for Linux no problemo with minimal tweaking. The issue is actually providing support for an OS which they wont get much money from

#

you have to pay more for QA, testing, extra development time, etc

#

Most dev studios find there is no point

weak island
#

Hello I'm trying to convert my bash script into a python script as a fun way to learn it, this part of the script it identify which linux package manager the user is using and install the packages using the appropriate one, how could I do it in python? ```declare -A osInfo;
osInfo[/etc/debian_version]="apt install -y"
osInfo[/etc/fedora-release]="dnf install -y"
osInfo[/etc/arch-release]="pacman -S --noconfirm"

for f in ${!osInfo[@]}
do
if [[ -f $f ]];then
package_manager=${osInfo[$f]}
fi
done```

warped nimbus
#

Create a dictionary for those 3 values

#

Then you can use pathlib to check if each file exists inside a for loop

weak island
#

thanks Mark I'll give it a shot

warm raft
#

I've made a simple python script that repeats a specific task every X seconds for Y amount of time. i've now added arguments for X and Y with argparse but i don't know how i would name the arguments and the flags.

is there a standardized unix-way on naming them? i know that watch uses -n --intervall for the interval, but i can't think of other programs that would have X and Y

main olive
#

int = interval?
time = time to repeat?

warm raft
#
def main():
  while True:
    task()
    time.sleep(X)

t = summonTask(main())
sleep(Y)
t.killTask()```
#

kind of runs like this

main olive
#

any reason you're using --flags and not positional arguments?

warm raft
#

no, i just prefer flags

main olive
#

i mean it is more memorable

plush sparrow
#

I'm looking to create a PKGBUILD package. But my package contains some systemd services (and timers) that needs to be run as root so I wanted them to be placed in /etc/systemd/system/name.service, but this place is owned by root, and when you install a package makepkg -i PKGBUILD you are required to run that as non-root. So what do I do then? ๐Ÿค” . I've looked at other PKGBUILD files on the AUR and fx. Docker is placing it in /usr/lib/systemd https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/docker

warped nimbus
#

Don't they run with root by default?

main olive
#

makepkg -si escalates to root as needed

warped nimbus
#

You can also specify a user in the service units

#

Do you only care about the location for semantics?

plush sparrow
#

Yes.

#

arh thanks @main olive

#

What will happen when I install it via the packagemanager then? Thonk

I suppose pacman will be fine because I run that with root privileges.

#

but fx. yay I see being problematic.

#

I need to plookup the install command inside package() I think it doesn't do what I think it does lul

main olive
#

yay also escalates to root as needed

plush sparrow
#

arh nice

#

well then that's a good solution I think.

#

time for some man install

#

it tried to remove the service with what I had written lul

main olive
#

๐Ÿ‘ rtfm is always a good idea

plush sparrow
#

yeah but I didn't know what to lookup, then I just tried man install and what do you know stallman_sweat

#

I think my mind is damaged:

-D     create all leading components of DEST except the last, or all components  of
              --target-directory, then copy SOURCE to DEST
#

It works, but I don't understand why.

#

I have 2 services and corresponding 2 timers.

#
    # Install the systemd files
    install -D -m 644 "${_content}/etc/systemd/system/${pkgname}.service" \
    "${pkgdir}/etc/systemd/system/${pkgname}.service"
    install -D -m 644 "${_content}/etc/systemd/system/${pkgname}.timer" \
    "${pkgdir}/etc/systemd/system/${pkgname}.timer"
    install -D -m 644 "${_content}/etc/systemd/system/some-name-notify.service" \
    "${pkgdir}/etc/systemd/system/some-name-notify.service"
    install -D -m 644 "${_content}/etc/systemd/system/some-namenotify.timer" \
    "${pkgdir}/etc/systemd/system/some-name-notify.timer"
#

this seems unnecesarrily bloated.

#

oh yes.

#
install -D -m 644 "${_content}/etc/systemd/system/" \
    "${pkgdir}/etc/systemd/system/"
#

instead of all that, that's what -D means ๐Ÿ™ƒ

#

I just didn't understand .. except the last, ...

plush sparrow
#

Great talk FeelsOkayMan

spice whale
#

ill have to watch that @plush sparrow what specifiically did they touch on if you have the moment to share salient points (i prefer to read than watch long drawn out conversations about technology) lol

plush sparrow
#

It's merely a chat about old times and parts of Ken's life.

#

Unix history I would say.

#

Since it's Ken's history hehe

#

But keynotes:
ken's early days before bell labs, multex, unix, pipes, grep, chess.

spice whale
#

@humble onyx If you are interested in low level languages you need to simply go teach yourself assembly and be done with it, code theory relating to machine languages is too difficult to explain to a person who is literally just interested because the dynamics of making literal register calls and the mileau of special use cases of upper and lower level register calls (im still learning technical conventions sorry if i dont call them by their proper names) are extremly complex in theory and practical use cases.

IF you are able to develop a sense of parsing control for ascii commands you may be able to learn to parse ascii or utf-8 or utf-16 code respectively directly into machine readable scripts or executables (although i personally have much more success with parsing this type of lanugage to an interpreter than literal logical coding)

Either one are powerful options

The question is simply this, what are your development goals, do you want to make games, do you want to make databases and do database analysis, do you want to work with ai and make neural networks, do you want to work on code for theories sake and be a business analyst for a company sharing technical insights with high level programmers and explaining to the business people what they should fund to improve their bottom line

The choice is yours, but you have to make a decision about where you are going, not just following a whim and interest. It has been said before that this field is for the career enthusiast but we all must learn to pace ourselves, this field is super interesting and it is easy to get burnt out.

Not my wisdom there but goal setting is

Hopefully that helps give you some insight into what you should do with yourself if it doesnt you have some hard thiniking about which direction in life you want to go and what your goals should be for the next 5 - 10 -15-20 years.

happy hunting ๐Ÿ˜„

#

thanks @plush sparrow i have read a considerable amount about the early days before we had tools and hardware that self verifiedd hahaha long time ago, hell back when i first got involved most of the software was coming out of russia for hardware acceleration (im not anywhere near as experienced as these guys hahaha)

plush sparrow
#

What I like about the old timers is they are so humble.

#

It's so refreshing

near scroll
#

Is there a straightforward guide on the Python website on how to install the latest release 3.8.3 in Ubuntu?

I can't find anything explaining how to install it, the Python website downloads just point to a source package. I was hoping for something straightforward like how the Node.js website points you to specific instructions on how to install in Ubuntu.

If that's not the case then any opinions on the most straightforward way to install? 3.8.2 is installed by default, system package managers seem like a mess (like omg how many packages do you really need to install to get python 3.8.3?)

Maybe I should just use pyenv or Docker?

main olive
#

you shouldn't touch the system python installation

#

you might accidentally break OS internals by manually upgrading

#

just use pyenv instead @near scroll

stray marten
#

guys, how can i use grep to get only what i want from another command output?

formal schooner
#

@stray marten try grep -o

stray marten
#

but

#

i get the result from ps -je

#

so how can i get only the processes with 1 session id?

humble onyx
#

@spice whale Hey thank you for the answer. I know x86 assembly and low level stuff I am personally doing this kind of things for quite a bit. I just didn't know that games need OS features for optimization so it isn't easy to write a portable smooth game.

#

I've never developed a game neither do i want to lol

main olive
#

why are you ignoring my responses @humble onyx

#

it is not difficult to create games which are portable

#

those OS features are abstracted away from any game developer

humble onyx
#

I am not ignoring your responses sorry

main olive
#

via the library/platform/etc what they happen to be using

humble onyx
#

somebody said that library calls are slower

#

so developers targets a specific platform for marketing

main olive
#

they're not slower to such a considerable amount that it would somehow affect gameplay

#

like, even something like virtualizing entire function calls within games using Denuvo et al adds only slightly noticeable overhead

humble onyx
#

@humble onyx
it's not about compiling. Most games are written with such a level of abstraction that they can be compiled for Linux no problemo with minimal tweaking. The issue is actually providing support for an OS which they wont get much money from
@main olive What do you mean by support then?

main olive
#

Interaction with the GPU, for example, is in most games handled by the graphical runtime they use, such as Vulkan. Vulkan handles interacting with drivers (which is somewhat OS specific) all by itself, which means developers don't need to worry about that.

By support I mean that they would still need to do QA etc for each platform they release on. That costs money. It's an useless use of money if nobody's going to be playing on Linux anyways

#

Not just for the release itself, but every future patch, library updates, etc

#

the business overhead is much more significant than the technical overhead :)

humble onyx
#

Developers can compile the game for any platform with the help of high level abstraction it is not that hard at all but it requires time and money even for a single dolar it is a waste of time if nobody is gonna be playing on linux is that what you are saying?

main olive
#

pretty much

#

the amounts are of course higher than a single dollar but yes, that's the gist of it

humble onyx
#

okay now I totally get it thank you

near scroll
#

Thanks @main olive i'll use pyenv

stray marten
#

@main olive , could u somehow help me with something that is a mix between linux and C?

main olive
#

what specifically?

stray marten
#

ping me when u are free please @main olive

plush sparrow
plush sparrow
formal schooner
#

yikes lol

#

thats actually an interesting point, is alpine entirely GNU-less by default (other than the kernel depending on GCC)?

#

i kind of hate this guy but his dwm video on window swallowing is great and that's a feature we should have in other tiling wm's

#

also this guy does some holier-than-thou video about how academic statistics is wrong because NHST

#

nice try asshat, statisticians have been criticizing and debating about NHST literally since it came into existence

#

it does look like he makes a lot of interesting and potentially high quality content

#

but these video thumbnails and titles are insufferable

plush sparrow
#

Hot takes @formal schooner

formal schooner
#

if anything i'm criticizing his hot take on statistics

patent osprey
#

How would I copy the first few letters of a file. I need to copy until 4 numbers.

So like this: file: Vogt2017_ehhwjqn-E37dhdb
Copy: Vogt

tiny lava
#

wdym

#

like you have a string with the file name?

patent osprey
#

Yes

tiny lava
#

just slice it, since strings are indexable in python

patent osprey
#

So the whole problem is that I have 1000 .pdfโ€™s and I am making a bash script to kinda sort them

#

This is what I have so far and I have to manually type in the first few characters of the file to get it working

#

I want to automate that

plush sparrow
#

๐Ÿ“ธ

patent osprey
#

Any ideas?

frank sorrel
#

Are you using python to copy the first 4 letters?

patent osprey
#

No I am not

#

This will be a bash script to do everything

#

If I can somehow use python in a bash script then that would be ideal

formal schooner
#
read -r -d'' PY_SCRIPT <<EOF
import os
print(os.listdir())
EOF

python -c "$PY_SCRIPT"
#

recommended? no. possible? absolutely

#

you can use heredocs and shell parameters as a low-rent templating engine

patent osprey
#

Explain what that code means

#

I am new to coding

formal schooner
#

more sanely,

echo Vogt2017_ehhwjqn-E37dhdb | head -c 4
patent osprey
#

But the problem with that is that it wonโ€™t work for what I need

formal schooner
#

even better

filename=Vogt2017_ehhwjqn-E37dhdb
echo ${filename:0:4}
#

then what do you need?

patent osprey
#

These are some of the names

#

They are different lengths

formal schooner
#

i thought you just needed the first 4 characters

patent osprey
#

No up in till the 4 numbers

formal schooner
#

ah

#

out of curiosity how are you generating the filenames?

patent osprey
#

I am not I torrented 1000 pdfโ€™s

#

And now Iโ€™m sorting them

#

Kinda

formal schooner
#

so this is output from a command like ls or find?

patent osprey
#

Ls

#

ls (sorry I am on mobile for discord)

formal schooner
#

and what do you want to do with the output?

patent osprey
#

I think I have an idea

formal schooner
#

e.g. you can do something like this

get_authors() {
  while read filename; do
    if [[ "$filename" =~ '^[[A-Za-z]]([0-9]{4})' ]]; then
      echo "${BASH_REMATCH[1]}"
    fi
  done
}

find ~/Downloads/ -type f -name '*.pdf' | get_authors
patent osprey
#

Canโ€™t do the [0-9] because it wonโ€™t account for _ and - and / etc

#

I think what I could do is make a variable and count up until I get a number

#

Then print out that many characters

formal schooner
#

well that isn't what you explained

#

so you want until the first 4 digits or the first underscore or dash?

patent osprey
#

Here 1 sec

formal schooner
#
get_authors() {
  while read filename; do
    if [[ "$filename" =~ '^([[:alpha:]]+)(?:[0-9]{4}|[_-])' ]]; then
      echo "${BASH_REMATCH[1]}"
    fi
  done
}

find ~/Downloads/ -type f -name '*.pdf' | get_authors
patent osprey
#

Yes I think that will work

#

Until the first 4 numbers

formal schooner
#

but you just said it doesn't account for dashes and underscores

#

you mean you want dashes and underscores if they come before the first 4 numbers?

patent osprey
#

Yes

#

I want the dashes and underscores

formal schooner
#

ok. then at this point you just have to construct the right regex, you can see the general method above

patent osprey
#

Yes I can finish it, thank you

formal schooner
#
^([A-Za-z_-]+)[0-9]{4}

maybe this

patent osprey
#

I will try that

formal schooner
patent osprey
#

Will do

formal schooner
hollow linden
#

Guys does linux support rltk 8821CE Wireless LAN 802.11ac PCI-E NIC ?

plush sparrow
#

Short answer is yes

#

What distro do you want to install?

#

Something that's actively maintained and has been in the last 1.5 years then yes.

#

Ubuntu < 18.04 then no.

#

@hollow linden

lost quarry
#

Hi, I think this is the right channel for this question.
So, even when I'm in a virtual environment, pip is running from my global environment (is that the right terminology?)

Running xubuntu out of a VM. when I say which pip I get the path to pip in my virtualenv. But when I actually run pip, it runs globally. If I set PIP_REQUIRE_VIRTUALENV=true in .bashrc and activate the virtual env, it won't even let me run pip. So it's obviously not running pip from my virtualenv. Anyone know why this is?

surreal scarab
#

@hollow linden If you can't find linux native drivers for it, or if it doesn't just work, you can look into ndiswrapper.

serene eagle
#

can anyone help with detecting audio from microphone

#

I've had this problem for a long time but can't fix it

#

now I really need to fix it

hollow linden
#

@hollow linden If you can't find linux native drivers for it, or if it doesn't just work, you can look into ndiswrapper.
@surreal scarab I see, I will try it and tysm!

#

@plush sparrow Oh I see

#

@surreal scarab So It will work if it's supported in windows 10 right?

#

But could I install it on vm too?

#

Guys virtualbox gives error when launching my Linux vms . The error :

(VERR_NEM_MISSING_KERNEL_API).
VT-x is not available (VERR_VMX_NO_VMX).
#

i think it's because I recently changed my PC user folder

#

And edited stuff in regedit too but still it gives error

#

And even when I create a new machine the error still exists

hazy basin
#

Is ok when reversed(my_str) sending me address of memory ?

surreal scarab
#

@hollow linden If you're running linux in virtualbox with w10 as a host, I'd say that you need to use the w10 drivers in w10 and use an appropriate setting in virtualbox to piggyback off the Windows side of things. You probably only want the linux drivers or ndiswrapper if Linux is what you're booting into in the non-virtualbox sense.

hollow linden
#

Oh so if I wanna dual boot linux I need ndiswrapper right?

surreal scarab
#

Not necessarily. Aim for the linux native drivers first.

prime gate
#

Hey, sorry if this is the wrong place to ask, but I was wondering if anybody is familiar with running Python code directly inside of a BASH script...I was thinking of using a here-doc...is that even possible?

the snippet of Python is this, and it works perfectly in Python 2 which is what the old system I'm writing this for is running:

import csv

with open('test.csv', 'wb') as csvfile:
    filewriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
    filewriter.writerow(['lastname', 'givenname', 'email', 'telephone', 'citizenship', 'company', 'birthdate', 'birthplace', 'gender'])
    filewriter.writerow(['J', 'D', 'dj@c.com', '1231231234', 'CA', 'Company', '197X-XX-XX', 'France', '1'])
    filewriter.writerow(['M', 'C', 'cm@c.com', '4564564567', 'US', 'Company', '1996-XX-XX', 'Canada', '1'])
hollow linden
#

Oh I see

surreal scarab
#

If they don't exist, or don't work or whatever, ndiswrapper is your fallback.

#

I don't see why you couldn't run a py script with an invocation of the main python executable in bash.

#

@prime gate

prime gate
#

the main thing is that I sadly need all the code to exist within a single file

surreal scarab
#

Aha.

#

Off the top of my head, you could extract data to somewhere writable.

#

Then run it.

prime gate
#

I think this can be done with a here-doc, but I've never tried it and just wanted to see if anybody had

a Google search yielded no results actually, but maybe I'm just searching for the wrong thing

surreal scarab
#

I've seen something similar. Storing binary data in a bash script.

#

Seems you can echo/pipe stuff into python in bash and it'll work.

prime gate
surreal scarab
#

I was able to do echo 'print(โ€œhi")' | python and have it work.

#

Python being a 3.x version there

#

@prime gate Aha. Look at python's -c command line argument.

main olive
#

What is the significance of these versions? https://docs.docker.com/engine/install/ubuntu/

You can ctrl-f To install a specific version of Docker Engine to get to the part where it talks about them. I dont really understand what they are all for, it seems they have more information that the version of ubuntu i am familiar with

Distributor ID: neon
Description:    KDE neon User Edition 5.19
Release:        18.04
Codename:       bionic
warped nimbus
#

It's the version of docker. It has the same significance as versions do for any other programs. Newer versions may have more features or bug fixes (or introduce more bugs lol)

#

You can read the change log to get specifics on the differences between versions

elder orbit
#

i am trying to make a compositing window manager in python, and i am wondering if there is any explanation on how to do that

#

(please mention me when replying)

#

rn the only thing i figured out how to do is move windows based on cursor or key presses

spark plover
#

@elder orbit I actually dont know much about compositing window managment

#

whats like... the core feature?

elder orbit
#

the window manager can manipulate the windows in any way, using stuff like opengl. transparency, shadows, animations, etc need a compositor, or a compositing wm

#

one example is the compiz wm

elder orbit
#

any ideas?

#

i am asking because everyone seems to use XRender, but XRender doesnt seem to be availible in python xlib

#

but i seen someone saying that it can be replaced by opengl

#

but not really sure how

#

(like, all the examples i seen used XRender)

cunning skiff
#

@elder orbit take a look at the Qtile project it is a window manager built in Python. You might be able to get involved

#

If nothing else you can read the source code and work it out for yourselve.

So I guess it's up to you. You can re invent the wheel or get involved with that.

I have heard good things about Qtile

elder orbit
#

qtile isnt a compositing wm tho

#

at least iirc

cunning skiff
#

I am not clued up on the differences just I know this project exists and thought maybe you should check it out as you might not need to start from scratch or you can see how they do things. Just bringing it to attention if it is not what you are looking for leave it. I

main olive
#

Calling Linux GNU/Linux or GNU+Linux is insanely stupid

#

not just because of the practical stupidity of saying โ€œGNU/Linuxโ€ all the time

#

but also because the whole debate about including GNU in the name is fueled by hubris and jealousy

#

no other open source project demands there name in the name of another project

#

and yet GNU repeatedly asks that

#

neglecting the fact that many systems run linux kernels a lot of which have no GNU software whatsoever

#

Whats next X11/KDE/GNU/Linux or Wayland/KDE/GNU/LINUX

#

I hope this struck a chord with the 2 people who actually call it โ€œGNU/Linuxโ€

plush sparrow
#

Actually

formal schooner
#

@main olive i call it GNU/Linux because i like to acknowledge how the majority of my command line environment, and large portions of my career, depend heavily on GNU software

#

it's equally baffling how eager people are to reject GNU for this or that reason

#

stallman's ego is not a good reason imo

main olive
#

A lot of my work needs tool that use x and wayland

#

should it be x11/linux?

#

personal significance is this test then

formal schooner
#

no, also why do you care so much

main olive
#

oh some dumb neckbeard kept yelling at me

#

yeah thats it

formal schooner
#

๐Ÿคท if X was meant to be an operating system but instead got tacked onto someone else's kernel and everyone basically forgot that X was X it would be different

#

i'm not saying GNU or the FSF did everything or even many things right...

main olive
#

We can agree that there are some scenarios where calling it GNU/Linux is justified

#

but there are a ton where it isnโ€™t

formal schooner
#

yes, for example my and most people's linux systems are certainly GNU-heavy

main olive
#

true

formal schooner
#

the world runs on GNU Coreutils almost as much as it runs on Linux itself

main olive
#

but honestly no other open source project begs to be pegged onto the name of a system so much honestly

formal schooner
#

no, but no other open source project is currently run by richard stallman except emacs, and emacs as a project doesn't need the ego validation

#

well i guess stallman is out

main olive
#

yeah stallman...

#

his reputation fell off a cliff and then blew up

formal schooner
#

his reputation was already kind of in the dumpster tbh

main olive
#

yeah really

formal schooner
#

i think a lot of people were very eager for a reason to cancel him

main olive
#

why should a significant app need to have to be part of the name though

formal schooner
#

because otherwise it gets no acknowledgement

main olive
#

man pages

formal schooner
#

meh

main olive
#

the name of the program