#unix

1 messages · Page 45 of 1

jade mulch
#

it says os is not defined

fresh saddle
#

You need to import it first

#

(and please don't use the r-word like this)

warped wing
#

is there a windows equivalent for linux $pwd

#

oh found it its %cd%

worn apex
#

to print it or like as a variable?

#

nm

dull nymph
#

i wonder how aws have so many ip addresses that they give out servers for free

fresh saddle
#

They probably got a huge ip range

fiery tulip
#

You can run a curl script to get them dynamically

sturdy umbra
#

Hi guys! I understand the gist of creating virtual environment for every single project. I know the process of install pip, virtualenv -> create a new environment using virtualenv -> activate that environment and install let say Django for web dev project.

SO what should I do before all these to make sure everything runs as smooth as possible? And yet find it challenging to wrap my head around with:
(1) installing different version of python,
(2) alias and stuff,
(3) pip installation,
(4) personal working directory path vs /usr/bin/python, etc.

formal schooner
#

You can usually stick with 1 version of python at a time

#

You don't typically need special setup

#

You can start to come up with shell aliases and things as you get more comfortable

#

apt install python3 python3-pip python3-wheel python3-venv is all you need on debian for example

#

Whereas on windows and mac usuall pip and wheel and venv are included with the main python installation

#

(Debian likes to package things in smaller pieces so you can omit them if you really know what you are doing)

#

So a new project basically consists of ```bash
mkdir my-project
cd my-project
python -m venv ./venv

Then you just `. ./venv/bin/activate` and you are good to go
sturdy umbra
#

@formal schooner thus the path where I installed Python doesn’t really matter right?

formal schooner
#

as long as its in your PATH yes

sturdy umbra
#

How do I find out where it is?

#

Googling it and will DM you if I have problems. 😊

trim girder
#

which python

river estuary
#

I created the below class that uses inotify to watch and notify of file changes. I designed in a way that a user can enable, disable and re-enable it again if needed. Because the infinite for loop in the start function results in it blocking the whole thread, I decided to create and execute this function in a separate thread. All this works nicely until I disable and re-enable the watcher again by explicitly calling the stop function first and then the start function. The main thread where all the business logic resides and from where I am explicitly calling these functions is blocked. I think this is because the start function is executed in the main thread rather than in the separate thread when I explicitly call it.

Does anyone know how I can make sure that this function is executed in the thread that I am creating in the Watcher class rather than in the main thread?

#
... imports ...

class Watcher:

    def __init__(self, file_paths):
        self._i = inotify.adapters.Inotify()
        self._is_watching = False
        self._watched_files = set()
        self.modified_files_queue = queue.Queue()
        self._thread = threading.Thread(target=self.start).start

        if file_paths:
            if not isinstance(file_paths, list):
                file_paths = [file_paths]

            self.add_file_to_watch(file_paths)

    def start(self):
        self._is_watching = True

        for event in self._i.event_gen(yield_nones=False):
            if not self._is_watching:
                break

            (_, type_names, path, filename) = event
            print("PATH=[{}] FILENAME=[{}] EVENT_TYPES={}".format(
                    path, filename, type_names))
            self.modified_files_queue.put(Path(path))

    def stop(self):
        self.remove_files_from_watch(list(self._watched_files))
        self._is_watching = False
    
    def add_file_to_watch(self, file_path):
        if file_path not in self._watched_files:
            self._i.add_watch(file_path, inotify.constants.IN_MODIFY)
            self._watched_files.add(file_path)

    def remove_files_from_watch(self, file_path):
        if file_path in self._watched_files:
            self._i.remove_watch(file_path)
            self._watched_files.remove(file_path)
#

p.s. I tried moving the logic that deals with creation of the thread in a separate method and calling it before calling the start function when re-enabling the watcher, but that increases the number of threads in memory and I couldn't find a way of killing the old method before creating a new one..

tender plinth
#

Hello, I just built a linux kernel but when Im trying to boot into it with qemu , I somehow havent set the root password and hence not able to go root with it , is there a default password because remounting the fs as rw also requires me to be root

formal schooner
#

@river estuary you wrote .start instead of .start() when you do self._thread =

#

not sure if that's in your actual code or just a mistake here

#

is the inotify object thread safe?

river estuary
#

I think it is (not at my desk rn) because it runs in the seperate thread when its first enabled, but when I disable it and then enable it agaib by calling stop and then start, it executes in the main thread.

formal schooner
#

so when you disable and re-enable the watcher, the main thread becomes blocked?

river estuary
#

Correct, note that to re-enable I am explicitly calling the ‘start’ function. This makes me think that the function is getting executed in the main thread rather than in the separate thread.

formal schooner
#

can you "start" a thread twice?

main olive
#

I was looking to install Ubuntu encrypted with LUKS with dual-boot on my Lenovo ThinkPad by following https://askubuntu.com/a/293029 by Flimm or https://www.mikekasberg.com/blog/2020/04/08/dual-boot-ubuntu-and-windows-with-encryption.html by mkasberg. The issue I noticed now was that "The Lenovo BIOS WMI interface currently only supports enabling UEFI with Secure Boot. Enabling UEFI without Secure Boot or with the Compatibility Support Module(CSM) is not supported" . How can I work around this and still install Ubuntu encrypted with LUKS with dual-boot? Mike for instance in the tutorial said "I disabled Secure Boot. I’m not sure if this is absolutely required, and you can try leaving it on or re-enabling it when you’re done if you want." Many others too have noted that disabling secure boot is needed. Thank you.

river estuary
#

can you "start" a thread twice?
@formal schooner not sure if thats possible but I will give it a try in the morning and get back to you.

vernal crystal
#

it's a weird mixture of a lot of stuff, but maybe someone has done something similar

north lance
#

I want to make a wireshark-like packet sniffing proxy in python, ideally something I could append to proxychains.conf, and analyze my traffic in real time. I've done some searching around and found this: https://www.tutorialspoint.com/python_penetration_testing/python_penetration_testing_network_packet_sniffing.htm, however I'm not sure where the data is coming from

river estuary
#

can you "start" a thread twice?
@formal schooner I've just tried this, but it throws a runtime error RuntimeError: threads can only be started once

tender plinth
#

Hello, I just built a linux kernel but when Im trying to boot into it with qemu , I somehow havent set the root password and hence not able to go root with it , is there a default password because remounting the fs as rw also requires me to be root
anyone has any insights on this?

fresh saddle
#

Are you in the sudoers group perhaps?

tender plinth
#

No Im not actually

fresh saddle
#

Guess you're screwed then

#

You have to boot another distro, chroot into it and set the root password/add you to the sudoers

tender plinth
#

is there some way I can set a root password while configuring my kernel through makefile's menuconfig?

fresh saddle
#

No you can't, the root password is set in /etc/passwd or /etc/shadow, it has nothing to do with the kernel lemon_pleased

tender plinth
#

ah thanks @fresh saddle , I actually forgot that I could provide permissions in the init shell script to give me root perms , thank u once again

fresh saddle
#

Any time! lemon_pleased

wind adder
#

Hi

#

I need some help parsing a unix file, there's a ~R and ~Y character that are in blue

#

which I am trying to catch with a regex on a windows system

#

They dont show up in that same format, and after they are pased they become an upside down question mark. Do you know a way to capture these characters with REGEX

#

my current solution is to isolate what character they are not.. and capture them, but this is not a good solution for us, as there will be otehr character we might ignore in the future.

#

Any help appreciated.

viscid sage
#

any reason not to just do a unix2dos @wind adder ?

wind adder
#

Thing is we can only manipulate the file through this informatica tool

#

and there we can only use regexes

#

otherwise have to get the unix team involved

viscid sage
#

ah, gotcha.

#

where do they show up? line endings?

wind adder
#

Yes, but there's some in between words aswell

#

thats what we want to avoid

#

like the name O~RHannasey

#

where the ~R is blue

#

I think they might just be different styles of apostrophes

viscid sage
#

gotcha ... so your tool looks like it's not a UTF-8 compliant tool lol

wind adder
#

Yes sadly

#

eitehr that or the unix file is UTF-16

#

but we can only store UTF-8 chars in db

viscid sage
#

do you match on those if you just do regex for those puncuation characters?

wind adder
#

no

#

They're behaving a bit different on the clients too, like on oracle its just showing up as upside down question marks

viscid sage
#

what if you set up a negative match for all [a-zA-Z0-9]

wind adder
#

but python it is Angstrom and then upside down questionmarks

#

We are doing that currently

#

But the data sets are huge

#

we might be cutting off some characters we want to capture

#

and that can be handled

#

only the upside down question mark is making some process fail down the line

viscid sage
#

i mean, those things are easy to add to the negative match though (the ones you want to be able to process)

wind adder
#

Yes that is true, I have done this for now.

#

I was just curious if there was a way to regex a specific utf char

#

like with unicode

viscid sage
#

i think you can, but it depends on the regex parser if it knows how to do that

wind adder
#

So I could just do some tests and see which unicode captures the exact chars

viscid sage
#

there are a LOT of possibilies with unicode though ... not sure brute-forcing it is a good spend of your time lol

wind adder
#

oh okay

#

like if its below 1mill its okay u know

#

we got a lotta computation power to waste lol

viscid sage
#

if you can find out the regex parsing engine your tool uses, it's not hard to figure out what flags you need to provide to do unicode lookup

#

(if you can that is)

wind adder
#

oky sure, I think thats a good idea, i will look into it

#

we can informatica should disclose this

#

Thanks for your suggestion

viscid sage
#

i've not heard of that tool, but yeah, if you have support, it's a pretty simply doc lookup or support ticket 😄

wind adder
#

Hey

#

@viscid sage As far as the informatica tool goes

#

It should be using the Oracle 12 regex engine

#

everything on informatica we can usually query for on oracle or with plsql code

regal tundra
#

can anyone help me out in using rhel 8 for 32 bit windows 7 that whether it can be installed and run properly or not???

viscid sage
#

wait what?

#

i'm not sure what you just asked @regal tundra

#

are you trying to run RHEL8 in a VM? or a container? or installing along side your windows? or installing it instead of your windows?

warped nimbus
#

Maybe WSL? Just guessing here.

#

Oh, Windows 7. That's a no.

#

Must be something else then

warped wing
#

im struggling to change default user on WSL ubuntu
ive found this https://winaero.com/blog/set-default-user-wsl-windows-10/ but it says to use ubuntu config but when i try to do that it says that ubuntu is an unidentified command and where.exe ubuntu cant find anything i thought i could do wsl config but it says thats not a command

Here is how to set the default user for WSL in Windows 10. The instructions are given for Ubuntu, OpenSUSE Leap and SUSE Linux Enterprise Server.

viscid sage
#

yeah ... i though WSL as well ... but then remembered that RHEL doesn't even have a WSL image yet lol

warped wing
#

oh i think i found it i have to do ubuntu2004 since thats the version i have

shut adder
#

i hav windows

fallen flint
#

I have a python script which works on macos but I want it to work on my laptop with linux without me having to install all the dependencies myself on my linux machine. Is there a way to do this?

warped nimbus
#

write down the dependencies in a requirements.txt file and distribute it with your script

#

Then you can use pip3 install -r requirements.txt

#

That's a simple option. You can also properly package your app and create a distribution, like with setuptools.

fallen flint
#

I searched this up and this seemed to be exactly what I was looking for, thx!

vapid vine
#

Hey there I have a question

#

So I have a mac

#

And I was wondering if there was a way to restrict my terminal from using the python2 version of pip

main olive
#

pip3?

shadow musk
#

Hey, I wanted to try out a new thing I learned: chmod +s [filename] but I don't really see how it works, I read that it was supposed to make a file executable and if I run it, it will be run with the owners user id instead of your user id. But when I tried this, I couldn't get it to work, I've logged in as root, made a new file which contained:

#/bin/bash

bash -p

and set the flag, then I went back to my non-root user and ran the file, problem is that when I ran id I haven't seen any new groups or uids present, is there something I'm missing?

#

ping me for the answer please, thanks

formal schooner
#

@shadow musk did you try just putting id in the file?

#
#!/bin/bash

whoami
groups
id

then chmod +s that file

main olive
#

@formal schooner @shadow musk linux ignores the +s flag on script files like that

#

even on executables like manually compiled C code

#

too

#

some older kernels will permit that flag to work though!

formal schooner
#

oh interesting i didnt know that

#

where does +s work then?

main olive
#

on older kernels

#

on newer ones it only works on executables that come in

#

with the installation iso

#

as far as i understand

#

like /bin/passwd

#

even kali distros of the last years disallowed it

#

despite having root as a default user

#

that says something

heady shore
#

Does kali still have root as default? I thought they switched

formal schooner
#

interesting, is that because there was some attack where you could put +s on a file when you weren't the owner?

main olive
#

@heady shore they switched in the latest release

#

2020 one

#

@formal schooner yes security reasons

warped wing
#

can i use multiple linters in a python.nanorc if yes whats the syntax for that?

#

and why does running pylint linter when no errors are present produce an error?

#

no errors are present meaning there is nothing to lint

quaint bluff
#

what's the best place to save file on Linux and Mac?

fresh saddle
#

On your home folder? (~)

formal schooner
#

@quaint bluff i have a ~/projects directory

quaint bluff
#

i don't want to create folders

formal schooner
#

so i have ~/projects/projectA/... where i put all my projects

#

i also have ~/tmp and ~/misc

quaint bluff
#

my script is creating file

formal schooner
#

where i put random junk, tmp for temporary things and misc for uncategorized things

#

ah

#

what kind of script? who is meant to use it?

#

what kind of file does it create?

quaint bluff
#

other people. it is a plugin for cross platform program. it is creating svg file. i already met some problems with windows with saving file in program files folder

#

windows has documents folder

#

i wonder what mac and linux have

formal schooner
#

oh. normally a command line tool should give the user the option to specify the output location

#

yes you can use $HOME but i dislike programs that don't let me choose where to save output

worn apex
#

mac and linux also have documents folders

#

windows and linux both have special functions [shell known folders, and xdg user dirs] to get the location of it, i don't know if it can ever be different on mac

formal schooner
#

true, ~/Documents is pretty common

#

there isn't an XDG base directory specification equivalent for ~/Documents but there is XDG_DATA_HOME which should be ~/.local/share by default

quaint bluff
#

yes you can use $HOME but i dislike programs that don't let me choose where to save output
@formal schooner
i will delete the file, after I upload it to program, i promise

formal schooner
#

@quaint bluff if the file is temporary use $XDG_CACHE_HOME

#

which is ~/.cache by default

quaint bluff
#

hmm

#

yes, file is temporary

#

is $XDG_CACHE_HOME a unix only thing or python have a special name for folder of temporary files?

formal schooner
#

you can also create a truly temporary directory with the tempfile module

#

XDG_CACHE_HOME is moslty a gnu/linux thing yes. the xdg basedir spec is published by the Freedesktop organization

#
import platform
from pathlib import Path

if platform.system() == 'Windows':
    output_dir = Path(os.environ['USERPROFILE']).joinpath('Documents')
else:
    _cache_dir_default = Path(os.environ['HOME']).joinpath('.cache')
    output_dir = Path(os.getenv('XDG_CACHE_HOME', _cache_dir_default).joinpath('my-app')
    output_dir.mkdir(exist_ok=True)

for example

quaint bluff
#

wooow, tempfile is a part of python

#

this is great

formal schooner
#

yep

#

!d g tempfile.mkstemp

shy yokeBOT
#
tempfile.mkstemp(suffix=None, prefix=None, dir=None, text=False)```
Creates a temporary file in the most secure manner possible. There are no race conditions in the file’s creation, assuming that the platform properly implements the [`os.O_EXCL`](os.html#os.O_EXCL "os.O_EXCL") flag for [`os.open()`](os.html#os.open "os.open"). The file is readable and writable only by the creating user ID. If the platform uses permission bits to indicate whether a file is executable, the file is executable by no one. The file descriptor is not inherited by child processes.

Unlike [`TemporaryFile()`](#tempfile.TemporaryFile "tempfile.TemporaryFile"), the user of [`mkstemp()`](#tempfile.mkstemp "tempfile.mkstemp") is responsible for deleting the temporary file when done with it.

If *suffix* is not `None`, the file name will end with that suffix, otherwise there will be no suffix. [`mkstemp()`](#tempfile.mkstemp "tempfile.mkstemp") does not put a dot between the file name and the suffix; if you need one, put it at the beginning of *suffix*.... [read more](https://docs.python.org/3/library/tempfile.html#tempfile.mkstemp)
formal schooner
#

!d g tempfile.mkdtemp

shy yokeBOT
#
tempfile.mkdtemp(suffix=None, prefix=None, dir=None)```
Creates a temporary directory in the most secure manner possible. There are no race conditions in the directory’s creation. The directory is readable, writable, and searchable only by the creating user ID.

The user of [`mkdtemp()`](#tempfile.mkdtemp "tempfile.mkdtemp") is responsible for deleting the temporary directory and its contents when done with it.

The *prefix*, *suffix*, and *dir* arguments are the same as for [`mkstemp()`](#tempfile.mkstemp "tempfile.mkstemp").

[`mkdtemp()`](#tempfile.mkdtemp "tempfile.mkdtemp") returns the absolute pathname of the new directory.

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

Changed in version 3.5: *suffix*, *prefix*, and *dir* may now be supplied in bytes in order to obtain a bytes return value. Prior to this, only str was allowed. *suffix* and *prefix* now accept and default to `None` to cause an appropriate default value to be used.... [read more](https://docs.python.org/3/library/tempfile.html#tempfile.mkdtemp)
formal schooner
#

mkstemp might be the one you want

worn apex
#

@formal schooner the documents folder isn't guaranteed to be named documents

#

best way to get documents folder on windows is to instantiate an IKnownFolderManager

#

[i've been working on a module for doing that in a cross-platform way, actually]

#

and the XDG specification for documents etc is to load ~/.config/user-dirs.dirs

#

[~/.config is XDG_CONFIG_HOME]

#

and that file will say sh XDG_DESKTOP_DIR="$HOME/Desktop" XDG_DOWNLOAD_DIR="$HOME/Downloads" XDG_TEMPLATES_DIR="$HOME/Templates" XDG_PUBLICSHARE_DIR="$HOME/Public" XDG_DOCUMENTS_DIR="$HOME/Documents" XDG_MUSIC_DIR="$HOME/Music" XDG_PICTURES_DIR="$HOME/Pictures" XDG_VIDEOS_DIR="$HOME/Videos"

#

apparently on mac you're supposed to execute applescript "return POSIX path of (path to documents folder) as string"

#

can't test that right now

formal schooner
#

oh yeah i forgot about those

#

thats not part of the basedir spec though right?

#

or is it

worn apex
#

i think it's a different spec

#

also even though the file looks like a shell script defining environment variables, it has to be that exact syntax to work

#

i.e. XDG_WHATEVER_DIR equal double quote dollar HOME slash [whatever] double quote

#

no $variables anywhere else but $HOME/ in beginning

onyx kestrel
#

I have some c program that also works with python. Like, there is a Py_Initialize() from #include <Python.h>. However, it always start up with the system default python 2 version, but I want to use python 3. I've tried setting PYTHONHOME, PYTHONPATH but to no avail. I feel like it should be easy to configure python version but I'm just not getting it

warped nimbus
#

Do you have the python3 headers installed?

#

Are you saying that your program is being compiled with Python 2 headers? Or what do you mean that it "starts up" with python 2?

#

Does that even respect those environment variables?

onyx kestrel
#

No, looks like I did not have the headers. Yes it does run with Python 2.
I just took a look at the make file, and I see a python-config. Seems like I need to set this to be python3.8 config or something.

heady shore
#

How does one make a sed expression delimmed by ;s execute in a certain order?

#

I'm not sure how it determines order by default, but it doesn't progress through each expression one by one

feral heron
#

Anyone got steps for changing operating system to linux

#

hardware split two operating systems.

pulsar bane
#

@feral heron do you have 2 storage volumes or are you trying to dual-boot on a single storage device

worn apex
#

@heady shore what's an example of it not doing what you want and what you expect?

formal schooner
#

@heady shore it runs the entire program for every line of input. so if you have s/a/b/; /b/d that will first substitute a for b, then delete the line if it contains b.

#

more specifically it copies each line of input to the "pattern space" and runs commands on the pattern space until the program ends, then sends the contents of the pattern space to the output

feral heron
#

dual boot on a single storage devie

#

device

#

@pulsar bane

feral heron
#

hello

clever skiff
#
cd src && make all
make[1]: Entering directory '/vagrant/redis-6.0.6/src'
/bin/sh: 1: pkg-config: not found
    CC Makefile.dep
/bin/sh: 1: pkg-config: not found
make[1]: Warning: File 'Makefile.dep' has modification time 1.3 s in the future
    CC adlist.o
/bin/sh: 1: cc: not found
Makefile:315: recipe for target 'adlist.o' failed
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory '/vagrant/redis-6.0.6/src'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2

I hope that this is the right channel, but when I try to compile redis-server I get this, and if I use apt-get it installs an old version

fresh saddle
#

You apparently need to install pkg-config and cc

clever skiff
#

Can I apt install them?

fresh saddle
#

It looks like it

clever skiff
#

Ok, thanks, will try

#

@fresh saddle It says unable to locate cc

#

Or did you mean gcc?

But even without installing it at least I got a different error:

(.venv) vagrant@vagrant:/vagrant/redis-6.0.6$ make
cd src && make all
make[1]: Entering directory '/vagrant/redis-6.0.6/src'
    CC Makefile.dep
make[1]: Warning: File 'Makefile.dep' has modification time 1.4 s in the future
    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:10: fatal error: jemalloc/jemalloc.h: No such file or directory
 #include <jemalloc/jemalloc.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:315: recipe for target 'adlist.o' failed
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory '/vagrant/redis-6.0.6/src'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2
#

It seems like the cc not found problem isnt present here

fresh saddle
#

Maybe you should check the build steps again, in case you are missing a dependency

clever skiff
#

Like the install steps?

#

Only dependencies working gcc and libc

#

Might need to check if libc is there

prime atlas
#

apt already has it as a package, apt install redis-server

fresh saddle
#

It won't be up to date though

#

The repos are only update twice a year

prime atlas
#

yeah but it is good enough

#

apt has 4.0.9 and latest stable is 6.0.6 so yeah i guess if you really want to be up to date build it yourself

lusty tartan
#

Hi 👋
May I know if i can ask questions here regarding Virtualbox + Xubuntu + python installation?

frank sorrel
#

If it fits the channel description then I'm sure you can

heady shore
#

Go for it.

lusty tartan
#

Thanks

#

So I’m learning programming with python and try to use it in VM and Xubuntu 18.04. I had v2.7 as default version.
Then I follow a guide online to update to 3.8. And I ended up with 3.6 and 3.7 too. So 4 versions together.
I tried to install MU python editor and it didn’t work and I thought I have some many versions. And I deleted 2.7 then 3.6, 3.7.

I tried to google and reinstalled again everything. But nothing worked out. Went through Stackoverflow and AskUbuntu for similar problems, I tried different command lines, when someone said “this command line worked for me”. I tried them all,command after command and ended up in deep rabit hole, whenever I try to install something there will be different kind of errors.

So far when I do the following commands, they are showing like the following:

$ python bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: No such file or directory

python3 --version Python 3.8.5

$ python --version bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: No such file or directory
Does anyone know how to restore everything or the best way to install python again? Should I delete my VM and creat another one?

Sorry for the lengthy post 🙏

#

$ whereis python python: /usr/bin/python /usr/bin/python3.6m /usr/bin/python2.7 /usr/bin/python3.6 /usr/lib/python3.8 /usr/lib/python3.7 /usr/lib/python2.7 /usr/lib/python3.6 /etc/python /etc/python2.7 /etc/python3.6 /usr/local/bin/python3.8 /usr/local/bin/python3.8-config /usr/local/lib/python3.8 /usr/local/lib/python2.7 /usr/local/lib/python3.6 /usr/include/python3.6m /usr/share/python /usr/share/man/man1/python.1.gz

$ which python3 /usr/local/bin/python3

warped nimbus
#

I don't use Ubuntu but it was likely a bad decision to remove the default Python version

#

Typically, the OS relies on the default Python version for some features.

fresh saddle
#

I think ubuntu doesn't rely on it, at least the base packages

#

It is a bad thing anyway

warped nimbus
#

I suggest you start over with a fresh VM. Leave 2.7 or whatever the default is alone. Then, install Python 3.8 only.

#

You have several options to install it

#
  1. Build and instal it from the CPython source code
  2. Install it via a PPA (if I remember correctly, deadsnakes is the popular one)
  3. Install it via pyenv
lusty tartan
#

Yep I learned it the hard way @warped nimbus 😦 and also found out something called Anaconda version and another one virtual...something can create a safe and isolated environment. After all this I will try to learn how to do it 😦

fresh saddle
#

pyenv will also compile it from source

warped nimbus
#

Anaconda is indeed another option.

#

If you're fine with having to install extra stuff (in the sense that, even if you use miniconda, you still have to at least install conda) just to get Python, then go for it.

#

Using a PPA is probably the simplest option

lusty tartan
#

Yes today I also learned that Anaconda is little heavy and I don’t need many things there as a beginner.
Thanks god i use a VM , i can just delete it and make a new VM

#

Thanks for your help!

heady shore
#

Ubuntu does not rely on Python, no. You did not need to make a new VM, but that works. The deadsnakes PPA is the quickest to update IIRC, right now it is on 3.8.

#

apt-apt-repository ppa:deadsnakes/ppa
apt-get install python3.8

lusty tartan
#

Thanks for the input @heady shore , I tried apt-apt-repository ppa:deadsnakes/ppa too. The first time it worked, then I deleted all version I believe then installed again. When I type that again it gave me error that I couldn't find answer on google. People provide commands that didn't fix. So I guess I was in a big mess

heady shore
#

How were you deleting said versions?

lusty tartan
#

I couldn't remember but I was trying different commands and after I tested it didn't showup when I try python or python3 or python --version...but there was only 1 stuck there but it had many thing missing I believe 😦 I'm so noob and I deleted everything now. That VM has nothing important too.

frozen field
#

so i made this little script to change my terminal colors from the shell: https://hastebin.com/uyihetumew.py
however there's a few things i don't quite like about it, maybe you can help me out here...
first of it outputs the data in a different order (seemingly random) than the original config.
secondly it only captures the actual data from the original config. any comments are lost.
these two things alone really hurts readability of the file and make it difficult to maintain/edit.
and lastly: isn't it actually horrible practise to be modifying live config files like this? i suppose i should do some form of validation before i write it back?

like the alternative i could think of would be locating the place in the config where these settings live, and replacing the raw text data, but it seems like there could be all sorts of things interfering with that approach

ember isle
#

Not sure if this fits #tools-and-devops a bit more but I currently have a Manjaro + pyenv + system python setup on my machine. Would it be generally more favorable to install tools like pipenv and poetry using pacman in this case? afaik the shebang for said tools points to /usr/bin/python anyways so there shouldn't be any conflicts with pyenv

formal schooner
#

@ember isle pacman is fine yes. pipx is another option

#

It's good to keep these things isolated. however if you install any of those tools in your pyenv pythons, pyenv might install shims and things might get messy if you don't have system python activated in pyenv

#

Since poetry is a build tool there's a valid argument to be made that it should be version pinned per project anyway

heady shore
#

Anyone know how this occurs?

#

Each newline of output has increasing whitespace behind it

#

It's spaces, not tabs.

viscid sage
#

i've seen weird shells do that before

heady shore
#

This is in RXVT

#

ZSH + RXVT

#

I know I broke it somehow, but I'm trying to figure out how.

viscid sage
#

yeah, i don't use rxvt, so not sure how to help there. My guess is the way it's parsing \n characters, but 🤷

heady shore
#

I broke the IO with a weird getch() I believe... Trying to replicate it

clever skiff
livid vortex
#

hey guys, just joined. I'm trying to run a python script on startup on my Linux laptop. The custom command works perfectly, but the script's purpose is to print some information and startup commands run silently. Anybody know how I can make Linux open a terminal window for that script? I google this and I get a lot of the wrong question

heady shore
#

You don't need to open a terminal on startup to do so; use a cron job

livid vortex
#

what is that

heady shore
#

@livid vortex Open your crontab file by running crontab -e.
To run a script on reboot you want to use the reboot flag, so you'd add a line like this:
@reboot /path/to/your/script/

livid vortex
#

sorry could you explain what crontab is

heady shore
#

It's basically a scheduler for your system. You can put entries in it that get run at specific times

livid vortex
#

I am very new to linux. Where would my script go in this example

heady shore
#

First, you wanna edit your crontab file, run crontab -e in your terminal

#

Let me know when you've got the crontab file open in your editor of choice 😄

livid vortex
#

Before we continue I just wanna be sure we are on the same page what I'm trying to accomplish

I turn on the laptop, and a terminal window opens with my script running (I need to see the print statements, running silently serves no purpose for my task)

heady shore
#

Ah, I see. You would probably have to use anacron to accomplish that, or maybe put it in your startup apps for your DE?

livid vortex
#

see I am so new to linux I have no idea what any of that is

heady shore
#

Cron's @reboot runs on boot, it doesn't wait for a WM, so you probably wouldn't be able to open a terminal

#

Gotcha @livid vortex. What flavor are you running?

livid vortex
#

Elementary Os. I tried two things

Added startup line "python </home/user/documents/myprogram.py>
Made custom command that does the same thing

Both of these do in fact run my program (I had it create a file to prove it) if I call them on startup but the terminal does not open for me to watch it.

#

I'm a little surprised I can't just open the terminal with some text/command automatically pasted similar to a command line argument

heady shore
#

What term is it? Most terms support that.

livid vortex
#

its just called Terminal, whatever comes default on Elementary

#

basically I need the opposite of executing a command silently (pop up terminal if none is open)

#

but since startup commands probably technically run in a terminal, just a hidden one, it doesn't make sense to need this.. I just thought it would be cool :( lol

#

could I accomplish this by installing a second terminal?

desert plank
#

hi mans and womans

#

let's say I have a venv somewhere, and let's say I make a script that uses a module that isn't in the main global python but it is in the venv

#

would starting the script with #!/foo/bar/venv/bin/python work?

#

even if u haven't activated the venv?

livid vortex
#

@heady shore I got it; I installed gnome-terminal and found I can run commands when opening that

desert plank
#

Welp tested it and it works

#

at least it can open load modules, didn't test it thoroughly

heady shore
#

Sorry for not responding, had to attend to something @livid vortex. Glad you got it working! 👍

livid vortex
#

you were very helpful despite my replies lol

heady shore
#

You might want to look into RXVT as well, that's my favorite terminal. Requires some setup but it looks great and is pretty handy once you get your config right

#

Cheers, happy to help

clever skiff
#

So I am trying to setup redis to work with my django applicationg in vagrant:
I am having troubles with the request taking too long so I am guessing I have it wrongly configured:

#

Vagrant seems to be running on 10.0.0.2

CHANNEL_LAYERS = {
    'default': {
        'BACKEND': 'channels_redis.core.RedisChannelLayer',
        'CONFIG': {
            "hosts": [('10.0.0.2', 6379)],
        },
    },
}

These are my channel layers,
In my vagrant file my guest is set to 8080 and host to 5656, I am not sure how I should run my redis-server

#

Could anyone help with that?

#

And vagrant is connected to 127.0.0.1

#
WebSocket HANDSHAKING /ws/chat/test5/ [10.0.2.2:61864]
WebSocket DISCONNECT /ws/chat/test5/ [10.0.2.2:61864]

The problems I keep having

#

I am not sure which ports/addresses I am supposed to change and what they do, if anyone could help I would be thankful, please tell me if I am posting this in the wrong channel.

main olive
#

Anyone here decent with Regex?

#

Let's say, my pattern was as follows:
s(al|en|end)
Works great for:
sal
sen
But for something like "send", it'll only pick up "sen", ignoring the better option (end)

fresh saddle
#

You should be able to simply put end before en, or use s(all|end?)

main olive
#

@fresh saddle That was what I ended up doing, was wondering if there was a neater way to ensure en or end with a preference for the latter

wet vale
heady shore
#

As a normal OS? You mean, installing it?

#

The best you can get with everything on the USB is persistance

wet vale
#

How about using another usb with the installer.iso on it to install kali on the other usb?

wet vale
#

Probably something wrong happened when installing grub-install at the start of the process. @main olive

cursive rune
main olive
#

How to solve this?

#

Yeah i know there are some solutions on9 but i am noob in these things. Please help.

muted sandal
#

what is kernel development guys?

fresh saddle
#

@main olive try opening a terminal and type sudo grub-install /dev/sda

main olive
#

Is it possible with ubuntu live mode because i have nothing left in my system?

#

@fresh saddle

fresh saddle
#

Yeah sure

fresh saddle
#

Hey, what's up?

fresh saddle
#

I don't think you've been hacked tbh

#

It sounds really too random

fallow mist
#

Yeah i know there are some solutions on9 but i am noob in these things. Please help.
@main olive how new is your computer ?

#

had a problem with grub because of efi

main olive
#

That problem solved

#

Got new one @fallow mist

fallow mist
#

which one ?

main olive
#

System got freeze everytime while i am using it

#

Or everytime when i am updating nvidia graphic driver ... Thts also a headache.

#

@fallow mist

fallow mist
#

might be a hw issue

pastel bear
#

so i'm trying to use gnu screen in order to run a program on a remote server through ssh, but it would always seem to time out or something after a few hours, is there any way to stop that so that it keeps running?

#

@ me if you have an answer

tiny lava
#

Its not screen timing out

#

its the program itself

#

Just make a bash script that loops running the program

main olive
#
alias junglejim="TMP=$(mktemp -d);cd $TMP"
#

I also enjoy these for obvious reasons

alias venvinit="python3 -m virtualenv venv"
alias venvact="source venv/bin/activate"
#

I'm sure you guys have some clever ones

#

This one is neat

# Generate Output and the pipe to `{cmd} | pastedump`
alias pastedump='curl --upload-file - "https://paste.c-net.org"'
main olive
#

I also enjoy these for obvious reasons

alias venvinit="python3 -m virtualenv venv"
alias venvact="source venv/bin/activate"

@main olive there's virtualenvwrapper for these and some more features

#

I've heard of that but havent looked at it yet.

thorny sage
#

hello everyone

#

i currently have a command line tool

#

and i want to make sure that a command doesn't work if a user hasn't run a command before

#

for example

#

package_name supercharge

#

and only if they run that command before, this should work

#

package_name superpower

main olive
#

well, command 1 could create a file (via touch probably)

#

and command 2 only goes forward if that file is present

#

or set an env variable

#

so you get a state

thorny sage
main olive
#

thanks

#

Tampoco hablo ingles mucho :3

thorny sage
#

Yeah, just check out the post and that explains it all @main olive

main olive
#

Yeah, just check out the post and that explains it all @main olive
@thorny sage bien ya lo veo muchas gracoas

#

gracias*

thorny sage
#

@main olive would you mind checking it out

#

It really is an excellent package manager

main olive
#

well already I see what it's about

It really is an excellent package manager
@thorny sage

thorny sage
#

Are you interested in checking it out @main olive

#

I developed it all on my own, and I would appreciate any feedback

#

If you would want to contribute please DM me 🙂

main olive
#

If I fit it and give you comment on this, for me it would be an honor to be able to help you in your development and make it more appropriate for the user.

formal schooner
#

@thorny sage this is like Homebrew? how does it automatically update your PATH without modifying an init/rc file?

#

what does this mean?

Last but not least. Turbocharge apart from being able to install packages also installs applications! It also tests the command line equivalent for the applications and launches the applications quietly in the background for you, making sure that they work too!

#

the package installers are hardcoded into the python source?

#

this is an ambitious project and i admire your enthusiasm. i recommend taking a look at how Homebrew is designed

opaque ginkgo
#

@thorny sage reddit post's link got removed

thorny sage
#

@thorny sage this is like Homebrew? how does it automatically update your PATH without modifying an init/rc file?
@formal schooner i have completely updated the code, and it's not hardcoded anymore. With the suggestions of a friend, I have changed the code and now we can add more packages into TurboCharge with ease. Most applications have a command line equivalent to them in Linux, including Opera and Visual Studio Code, which allows them to be tested for installation : ) .

#

@opaque ginkgo yeah, sorry about that : (

#

@main olive absolutely. I would request you to dm me so we can see how you would like to contribute : )

#

Guys if anyone over here has experience with distros of Ubuntu which don't use apt is the app installer, and would like to contribute to a package manager in the works, please dm me

viscid sage
#

@thorny sage distros of Ubuntu that DON'T use APT don't exist. All Debian derivatives use APT.

thorny sage
#

exactly, thats why i am working on support for pacman and stuff

#

but for now, we have a very small dev team, thats why I am requesting

viscid sage
#

Now, distros of Linux that don't use APT, different story (yum/dnf for RHEL derivatives, pacman for arch derivatives, zypper for OpenSUSE, etc...)

thorny sage
#

yes @viscid sage would you be interested in helping out extending support to these other distro's? We have a very small team at the moment, and it's rather hard to do so much

#

if so, I would appreciate it if you could DM me : )

viscid sage
#

I love the enthusiasm, but there are already a few projects that are just shell script wrappers (see ansible).

thorny sage
#

checked out ansible, so is that for making it compatible with all the distros of linux?

viscid sage
#

Huh

thorny sage
#

it's a development tool right?

#

we are also working on multithreading, so in that way, you can run multiple instances of turbocharge unlike homebrew

viscid sage
#

Ansible is a system configuration management tool developed by redhat

thorny sage
#

true

#

lol new to dev tools would you mind telling in a bit more detail?

viscid sage
#

But also, you can't multithread APT considering you can only have one active instance of it running at a time.

thorny sage
#

correct

#

we have found a workaround

#

i would not prefer to say here though if you understand : )

viscid sage
#

I don't understand because your code is public, so it's an unnecessary hoop I refuse to jump through

thorny sage
#

would you mind dm me @viscid sage

viscid sage
#

No thx

thorny sage
#

cool

#

thanks for the ansible suggestion : )

#

i appreciate that

#

has anyone here installed the turbocharge package manager?

muted sandal
#

hey guys do you know how to solve this error in linux

#

user is not in the sudoers file

#

i got some thing like that

viscid sage
#

yeah, you need to add yourself to one of the groups that are allowed to do sudo

#

@muted sandal

muted sandal
#

dude that thing is like i cant sudo myself or root

viscid sage
#

first su - then cat /etc/sudoers, look for something like the SUDO or WHEEL or ADMIN group, once you know that group, /usr/sbin/usermod -aG <GROUP> <USERNAME> && exit then newgrp <GROUP>

muted sandal
#

icant sudo itself

viscid sage
#

right ... su - or su root changes your user to the root user

#

then you can do root things, like add your user to the sudoers file lol

muted sandal
#

icant su root also

viscid sage
#

what error?

muted sandal
#

authencation failure

#

lol

#

dude i am using ubuntu

#

its the same password for

viscid sage
#

sounds like you are using your user password rather than the root password

muted sandal
#

mm what to do then?

viscid sage
#

either use the root password, or you are going to have to reinstall or do a root password recovery (which isn't fun)

muted sandal
#

well fun i am fucked some how

#

i am going for reinstall

viscid sage
#

probably not a bad choice

#

note your root password next time

muted sandal
#

well pal

#

you know how to install arch linux

#

????

viscid sage
#

it's well documented

#

if you don't want to go through the trouble of reading them, just use Manjaro

muted sandal
#

oh

#

so manjaro is that same like as arch

viscid sage
#

manjaro is "arch made easy"

#

same thing as arch, except they provide an installer

#

still uses the AUR etc...

#

i dont' personally like arch distros BECAUSE of the AUR

#

but that's just me

muted sandal
#

AUR?

viscid sage
#

Arch User Repositories

muted sandal
#

whoa

#

ok

viscid sage
#

the AUR is a software repo wereby any user and submit a package to it ... and there have been a number of cases where some of those packages are malicious

#

and a number of cases where they are just broken

muted sandal
#

ok

#

that is the packages developed by community

viscid sage
#

yes

muted sandal
#

dude will you help me learn linux

#

i learned the basics and more

#

but i need to master that man

#

some how

#

i dont get some thing specific help in that

#

u seem like a pro some how

viscid sage
#

lol ... i've been using *nix for like, 20 years, so I guess i'm ok with it

muted sandal
#

what the

#

20 years

#

what are you a linux dev

#

20 years great man

viscid sage
#

my first PC OS was RHL back in '98

muted sandal
#

what age are you

viscid sage
#

32

muted sandal
#

oh my god

#

you started linux in 10 year old

#

you are really great

#

ok man

#

how to be pro like you

viscid sage
#

lol ... i lucked out in having a close family friend that did tech

muted sandal
#

well i am not that luck to be like that man

#

some how with your experience can you teach me man

#

atleast say what should i do

viscid sage
#

my advise is to use it, and then learn the things you run into trouble with

#

you said you learned the basics, so just use it

muted sandal
#

yeah

#

i am using that now

viscid sage
#

and generally ... find a distro that you like and stick with it

#

there will be times you need to cross over, but generally, the differences are minimal

#

Personally, I use Fedora

muted sandal
#

whoa greatman

#

dont mind me asking this one

#

will you accept my friend request

#

you are some how great man

viscid sage
#

but mostly because most of the work I do is on RHEL/CENTOS systems. If I was mostly working on DEBIAN/UBUNTU, then I would go that route, if work used SUSE, I would run OpenSUSE, etc...

muted sandal
#

i never had support like you

#

i never had support at all man

#

youspeaking here its like a legend bro

viscid sage
#

that is what this room is for. I would rather not take these discussions offline because you probably aren't the only one that can benefit from them

muted sandal
#

that is some matured one bro

#

i really inspire you pal

#

i can imagine how you are great in coding stuff

viscid sage
#

been around the block in that realm too

muted sandal
#

when i become 32 i want to be more than how pro you are now man

warped wing
#

does a curses related question fit here?

muted sandal
#

curses?

warped wing
#

curses library

muted sandal
#

i dont know that one man

#

i am sorry after all i am just a noob

#

@viscid sage hey so for now where to head next man

#

i kinda heading over to linux sys admin and then linux system programming man

#

is that ok?

viscid sage
#

@warped wing probably, what is the question.

#

@muted sandal seems like a good path to me.

#

For sysad, take a look at the CompTIA Linux+, LPIC I, and RedHat RHCSA certs @muted sandal

warped wing
#

thats the code

#

and my problem is the arrows do not work

#

i managed to locate the issue

#

after i stdscr.move(new_y, new_x) i clear the screen so its discarded

#

i think i need to make t change the y and x and then when it prints the contents stdscr.move(y,x) as well

#

i think this solves this issue

vast orchid
#

where can i get help of vps?

warped wing
#

can i make curses disable ctrl-j and ctrl-i?

#

because they do some funky stuff

#

and id like them to have different meaning

fleet forum
#

So if I have a Chromebook with chrome os

#

That's managed

#

If I copy the os, then eventually reinstall it back, will it save the fact the device is managed?

cyan depot
#

where is the windows channel at

tiny lava
#

@fleet forum you probably won't be able to boot from a different OS at all. If you could though, it would depend on how you copied the OS

fleet forum
#

Why so?

#

Is it because the hardware only works with chromeos?

tiny lava
#

No because generally they lock down the mechanisms used to boot into another OS for security and integrity purposes

#

If it's like a school Chromebook, then unless your IT department is completely incompetent it should at least be more than trivial to get another OS booted

fleet forum
#

IT department?

#

What's that

#

Nah we have no IT department. The government just send out butt tones of Chromebooks and I'm tryna figure an easy way I can play play Minecraft and stuff the last couple days without bricking the Chromebook

#

It's essentially a manager device that's it

#

So like if somehow I can copy the managed device os and then replace it, it would be great

viscid sage
#

@fleet forum no you can't, they are managed via MAC address. As soon as your new install of chrome came online, it would be managed by the same group again

tiny lava
#

If you installed a different OS tho it would work

#

Developer mode will probably be disabled though

green iron
#

Hey guys, can we run a Linuxmint application on Ubuntu??

robust cave
#

do you have an example? there aren't many Linux Mint application if at all, most of them work across all linux distributions

robust cave
#

I don't think that will not work on Ubuntu unfortunately, it's developed by the Linux Mint team to work on the Linux Mint distribution

fleet forum
#

@fleet forum no you can't, they are managed via MAC address. As soon as your new install of chrome came online, it would be managed by the same group again
@viscid sage oh great, so if I wipe the Chromebook, install a different os and then reinstall chromeos, it'll become managed again?

fresh saddle
#

Your Mac address won't change, you'd have to temper it

#

Which is think is behind rule 5 at this point

green iron
#

@robust cave so it won't work on Ubuntu?

robust cave
#

@robust cave so it won't work on Ubuntu?
@green iron you can try, but there's no guarantee, especially since the actual program itself is in beta

green iron
#

Oh, okay

#

I got an error

#
 File "/usr/lib/python3/dist-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace XApp not available
fresh saddle
#

Yeah, it looks like a distro error

green iron
#

oh, okay

#

i wish they release it for ubuntu in future

rocky plank
#

hello. I recently switched laptops and installed Arch in it with dual booting

#

my issue here is that I didn't have an audio manager, so I installed pulseaudio by instinct

#

basically my issue is that it's not really making any sound, both channels are muted and I can't get any sound of it, like if I pressed the mute button that comes with the laptop

#

any idea of what could be happening?

robust cave
#

what are you using to control pulseaudio? is your mute button on the laptop properly bound? (ie. if you're using a window manager rather than a desktop environment, chances are you have to bind it yourself)

rocky plank
#

I use pulsemixer (CLI tool), mute button is F1 on a Thinkpad T495

#

but it's crazy; I think that since I installed GNOME on the older PC it had it bound automatically

robust cave
#

so you have GNOME running on the thinkpad?

rocky plank
#

so you have GNOME running on the thinkpad?
@robust cave I expressed wrong; I HAD gnome on a Compaq laptop

frank coral
#

hello, is it a good practice to export variables in bah scripts? I'm affraid of cluttering my system with that, or having a name which would name a variable used elsewhere

rocky plank
#

I fixed the issue; didn't have my user on the audio group

summer trail
#

@frank coral export is the command to create an environment variable, which will be passed down implicitly by processes descended from the one you run it in. You should only export something if you need to share it with child processes.

frank coral
#

Ok, thank you for you answer @summer trail So what's the difference between exporting and creating an .env file? If I export variables manually in the shell, are they lost If I close it?

summer trail
#

Yes, they are. They're only inherited by child processes.

main olive
#

uh hope this isnt in the wrong channel

what do i use for variable command line args in python? say suppose $ ./script.py file1 file2 ...

i can use argparse for fixed number of args, but how do i take in variable number of args with it? did i miss it in the docs?

nimble panther
#

irrc, you have to specify in nargs parameter

main olive
#

yep sorry just found out

#

thanks

nimble panther
#

oh ok then

#

np

main olive
#

I've got a small Linux problem if anyone can be bothered to help. First time using Linux and I've got absolutely no idea how to set new env variables.
Usually on windows you could use the GUI

#

Tried to enter ~/.profile on the terminal but it says permission denied

#

export NAME=some/var/value doesn't work either since os.environ.get() returns nothing

somber stirrup
main olive
#

I am trying to set username and password for the site

#

and an api key

#

so they're not hard coded

somber stirrup
#

ah yes that's exactly what dotenv is made for

main olive
#

So linux itself can't do that?

remote orchid
#

Guys how can I change my snaps location?

#

It saves everything to /snaps whereas it should save to /home/username/snaps

remote tapir
#

lemme see

#

try installing without sudo?

remote orchid
#

lemme try ]

remote tapir
#

see if it allows you

remote orchid
#

no it doesnt

#

asks anyway

remote tapir
#

why do you want to install in home dir?

remote orchid
#

coz i dont have much memory in root

#

like 2 GB left

#

whereas home has 28

#

I installed linux just for fun

remote tapir
#

i doubt if you can even do that

remote orchid
#

i doubt if you can even do that
@remote tapir I believe i can, it is linux

main olive
#

ok Linux is driving me crazy. How do you people deal with this?

#

I keep changing VSCode's python path to /usr/bin/python3.8

#

keeps reverting

#

everytime I run the code

formal schooner
#

@main olive i don't use vscode, but this sounds more like a vscode issue than a linux issue specifically

#

is there some setting box where you choose the path for the current python?

main olive
#

yes, I put /usr/bin/python3.8

#

Tried with /usr/bin/python3

formal schooner
#

and it keeps changing to something else? or are you getting errors?

main olive
#

teh path doesn't change. It's as if vscode just ignores it

molten wedge
#

that means there's no python in /usr/bin/python. Here's what you should do:

#

type which python in the command line, then copy paste the output into the python interpretor box in bottom left. Thats will set vscode to use the global python installation.

main olive
#

~/Documents/Python/ms-train$ which python
/usr/bin/python

molten wedge
#

if you need to use a virtual environment, you need to first create a virtual environment, then activate it and then follow the above steps

main olive
#

Yeah it still recognizes python2 instead of 3

molten wedge
#

~/Documents/Python/ms-train$ which python
/usr/bin/python
@main olive do you have a setting.json file in the current directory? Normally, when you change the settings for a specific workspace, vscode creates a folder called .vscode and places settings inside it

#

Yeah it still recognizes python2 instead of 3
@main olive type which python3 then

main olive
#

Yes I do

#

I haven't written a single line all day cause of this .-.
I tried with which python3. Put the path in the interpreter selector

#

Still python 2 lol

molten wedge
#

@main olive do you have a setting.json file in the current directory? Normally, when you change the settings for a specific workspace, vscode creates a folder called .vscode and places settings inside it
@molten wedge also to confirm that vscode does change the location, you should open settings.json and then confirm that there is a line which says something like "python.PythonPath":"your/location/python"

#

I haven't written a single line all day cause of this .-.
I tried with which python3. Put the path in the interpreter selector
@main olive how about global workspace settings? you might have a python path specified there which could override the workspace specific settings

main olive
#

Sadly no. Either way, I'll just switch to pycharm lol

molten wedge
#

that's very weird. never seen that problem. well i hope pycharm works for you. good luck!

main olive
#

Pycharm always works ❤

molten wedge
#

Guys, does anyone have any experience with Arch Linux and specifically archiso? I need some help related to it.

lament night
#

@molten wedge perhaps. What’s your issue?

molten wedge
#

@lament night When i make an unmodified arch iso with the baseline configuration, I am unable to make a live usb while the releng profile works fine. this leads me to believe that there's some stuff in the baseline profile that makes it work out of the box. Which one do you recommend using - baseline or releng?

#

and another general Unix question: Why do some distros have wifi working out of the box while some don't? for example my wifi drivers work with Ubuntu. in arch linux, I have to do a simple systemctl enable NetworkManager and it starts working. however in Manjaro, I have to download a bunch of drivers from github and enable them using dkms etc which takes a long time.

So my question- Why do some distros come with wifi drivers pre-installed and others don't?

summer trail
#

The single biggest difference between distributions is what they decide to provide packages for and what they decide to install by default. Some distros won't include anything in an official package repository unless it's FOSS, others aim for usability over purity.

molten wedge
#

that makes sense, thanks! @summer trail

pure folio
#

Hello guys, i am fairly new to this so bare with me I have 2 AWS Ubuntu instances that I want to create a privet_pub ssh key for each one of them so I can ssh from one to the other , I did that and generated the key and used the ssh-copy-id and have both of the public keys exchanged but when I try ssh user@host I get Permission denied (publickey) response, any help would be appreciated.

static cosmos
#

@pure folio if your private key isn't in the default location you need to specify it with the -i flag

pure folio
#

@static cosmos thanks, for the answer, I did that but is there any way I can do it with out the flag ?

#

For automation

static cosmos
#

Put it in the correct location

#

~/.ssh/id_rsa

#

But nothing stopping you from hardcoding the location also

#

What are you automating with ssh?

pure folio
#

@static cosmos thanks for the help just a script that performs some basic bash commands between the two instances

atomic ember
#

It's ok to set env variables in venv/bin/activate?

molten wedge
#

I have never seen anyone do that. I think it's a bad idea since other developers working with you won't be able to replicate the same environment since they will have their own different activation script.

atomic ember
#

and how to hide variables instead of typing them in code? i try to modify ~/.bash_profile but there if i try to get them i get None

molten wedge
#

I think you need to write them in ~/.bashrc. However if you are using python, there's an easier way to hide these secrets

atomic ember
#

Thanks, i will take a look

main olive
#

does anyone use rsync there? I was told to use it instead of cp but I am noticing a very sad inconsistency with it.

#

I am trying to copy a large 40+ GB file yet the output file has a bit different size

#

therefore a different checksum too

robust cave
#

how are you using rsync?

foggy ivy
#

How to enable tensorflow ROCm in distro Manjaro?

main olive
#

@robust cave always with -a option

#

sometimes --progress too

#

but its all

#

it cant be any file system file flags like creation date and so on

#

these arent part of the file

#

so i have 0 clue why is checksum being changed

#

could it be because of file extension though i doubt rsync would care

robust cave
#

how are you checking the size difference/checksum?

main olive
#

md5sum is how I was checking the file sizes

#

I read the link you posted

#

the likely cause is a difference in directory sizes

#

is there any source where I could read more about that

#

I am surprised the information about directory where the file is located would be incorporated into the raw file itself

main olive
#

arch is a pain in the ass to get set up, I've spent hours on a vm trying to get it to work

surreal jewel
#

um hey

#

idk if this is the right place to ask

#

but one of my lecturers recommended redhat linux for our classes

#

and that stuff isn't free and i was wondering if i was worth buying for classes, especially since its just for one semester and i already have linux mint booted in one of my laptops permanently

molten wedge
#

I don't see why anyone would buy any linux distro but if it is a requirement, then you don't really have a lot of options right? @surreal jewel

surreal jewel
#

its not a requirement that's why i was asking

#

i already have one i installed in my own time, and when i asked her she told me to use redhat for one of the subjects that we were doing

molten wedge
#

well if I were you, I wouldn't. Don't see why someone would buy any linux distro

surreal jewel
#

thanks man, thats what i was thinking too

gilded basalt
#

Red Hat is designed for enterprises and businesses and you pay for reliable technical support and bug fixes ("backporting")

#

The upstream distros from redhat are CentOS and Fedora

#

Fedora is designed to be used by typical users as a desktop OS and not as a server

#

I highly recommend giving it a try, it's installed on one of my laptops and is generally a reliable system

#

@surreal jewel

surreal jewel
#

ahh

#

so like fedora or redhat?

analog kraken
#

Is it possible to turn my old android 4 tablet into a linux system?

#

I have rooted it.

fresh saddle
#

Android 4 is a Linux system lemon_long

#

But yes, you can do that

tender plinth
#

Hello, how do we load library functions source code in gdb?

#

Like , I want to load the source code of malloc written for glibc 2.30 into gdb , for debugging purposes

main olive
#

how to download linux in python?

#

sorry

#

how to python in download linux

#

wth?

#

how to remove python from linux

#

😳

frosty patrol
#

most linux distros rely on python in some capacity

#

and it's there by default

main olive
#

Pardus is mostly made with python

#

Pardus = Turkish Linux Distro

molten wedge
#

well then do you want to remove it or install it?

nimble ocean
#

how to remove python from linux
@main olive I don't like that decision Linus, we want Python support in Linux, don't take it away

main olive
#

Is there any server dedicated solely to linux support?

thorny solar
#

This hit our filter, but I'll allow it

#

Posted by @molten wedge

molten wedge
#

i dm'ed them, no worries

raw tapir
hollow magnet
#

So I am working on my first real python program and I am wondering how I specify the home directory in linux

vestal turret
#

~ is the home directory

hollow magnet
#

ty

opaque ginkgo
#

@main olive what distro

hollow magnet
#

@main olive sudo pacman -S python or sudo apt-get remove python

fathom harness
#

guys, anybody can help me with ubuntu server?

molten wedge
#

yeah i can try @fathom harness

fathom harness
#

oh, Thanks!

#

i'm really a newbie

#

first week on linux

#

took an old notebook of mine to make a server

#

downloaded ubuntu server 18.04

#

installed in a vm

#

it's up and running

#

i an struggling on configuring ftp

#

do you have experience at it?

#

how can i see my ip address?

#

ip a is showing some inf

#

but when i try to connect via filezila it's not working

molten wedge
#

well tbh i dont really know how to do this @fathom harness but I can guide you to appropriate resources

fathom harness
#

i mean

#

it's already done

#

i guess

#

haha

#

but how do i get the ip of my server?

#

ifconfig -a is showing an address

#

on enp0s3

molten wedge
fathom harness
#

i mean, i can see the ip "inet"

#

it's 192.168.10.8

#

but when i insert it in filezilla

#

it does not work

molten wedge
#

maybe consult Filezilla docs? Yhey will probably have a step by step guide

fathom harness
#

yeah i followed it

#

but it does not talk about configuring ip

#

:c

main olive
#

Hi, not sure if this is a python question per se, but I'm trying to write a command that opens up xfce-terminal and runs a python file, here's what I have so far:

xfce4-terminal -e 'python Downloads/Robovish/RobovishMK2.py'

now, the terminal opens, but upon opening, I'm greeted with this error

#

would anyone be able to help?

warped nimbus
#

Try using the full path to the python binary

main olive
#

ooh i should've tried that

#

actually i dont think thats the problem

#

because when i open xfce

#

im in my user directory

#

and then its just Downloads/Robovish/RobovishMK2.py to the file

#

unless im misunderstanding

warped nimbus
#

I believe it's saying that it cannot find python itself, not that it cannot find your script

main olive
#

...ohh

#

what would the path to the python binary be?

warped nimbus
#

do which python to find out

#

probably /usr/bin/python

main olive
#

ok

#

that worked, thanks so much!

warped nimbus
#

You're welcome

frank estuary
#

can someone help me. i installed ubuntu but ment to get kali and need to get windows back. i used the sudo dd command on a normal usb stick but when i restarted my pc it didnt give me the option to choose windows.

#

im new to linux distros

fathom harness
#

god, didn't managed to make it work

#

i'm like 8 hours

#

trying to make this ftp work

#

nothing

molten wedge
#

can someone help me. i installed ubuntu but ment to get kali and need to get windows back. i used the sudo dd command on a normal usb stick but when i restarted my pc it didnt give me the option to choose windows.
@frank estuary you will probably have to have to disable safe boot in your bios setup. basically press F5, F10 or F12 (different machines have different key bindings ) while your computer is booting up. then find something which says SAFE BOOT and disable it. Maybe that'll work.

Another way you can try is searching up "how to disable safe boot on <laptop name>" on google. You'll probably find answers

#

i dont think you need the ip address at all

frank estuary
#

okay ill try it out

vast pine
#

Hi, how to generate timestamp in this format: 2019-08-30T14:56:08.069Z

molten wedge
#

You can do this easily using python strftime @vast pine

fathom harness
#

@molten wedge hey! i'll try it later!

the tuto makes sense, i'll just finish my worktime and go to the server again, thank you!

molten wedge
#

@fathom harness yeah np

static cosmos
#

@fathom harness How is the VM getting internet?

fathom harness
#

wifi

#

i've installed the server inside a vm (ubuntu server 18.04)

static cosmos
#

uh I don't think you can do that

#

what vm software are you using

fathom harness
#

virtualbox

#

i can create a network inside it

static cosmos
#

can you show me the network adapters page

fathom harness
#

i guess

#

oh

static cosmos
#

in its settings

fathom harness
#

one sec

#

i'll need to turn the notebook on

static cosmos
#

Actually think its just network

fathom harness
#

i have some routers and hubs

#

but i dont use any of those

#

i can use if needed

static cosmos
#

You shouldn't need to

#

I would just set the network to be bridged with your normal network adapter

#

rather than through a NAT

#

that way it's just another device on your private network, with its own IP

fathom harness
#

hm

#

i think i got it

#

i'm not that good with networks (as you see)

static cosmos
#

It's a bit of a complicated subject

#

I've taken a few college classes on them

fathom harness
#

what information do you need to see? i'll have to take a picture

#

hahahah

static cosmos
#

and virtualization and stuff

#

The network tab of the VM's settings

fathom harness
#

i had this old acer notebook and i wanted to make a server

#

so

#

ahahahah

static cosmos
#

Why not just install a server OS on it

fathom harness
#

I need to buy a pendrive

#

Hahahaa

static cosmos
#

There's a hacky way to do it without one with raw disk access but you can potentially corrupt your original OS if you do it wrong

fathom harness
#

Yeah It happened

#

Installing kali

#

I managed to make my Windows work again

#

Is that It?

#

@static cosmos

static cosmos
#

Yep

#

NAT means the VM is on a seperate network, with your host acting as the router between them

#

you want to select bridged adapter

#

and then the network adapter you use

#

@fathom harness

fathom harness
#

Should i use the adapter from the host PC?

static cosmos
#

the adapter you are getting internet through yes

fathom harness
#

yeah, i guess the network part is ok

#

now i'm editing that sftpd.conf file again

#

i can connect trough my server, but i'm not managing to connect via my notebook

fathom harness
#

@static cosmos do i need to open any firewall port on my notebook?

#

all the ports are opened in the ubuntu server

static cosmos
#

No it should be completely seperate

#

@fathom harness Can you ping from your notebook?

fathom harness
#

i guess i can

#

but when i ping the address

#

ok, i do:
ping 192.168.25.8 (the ip of the ubuntu server)

#

the response is
ping to 192.168.25.4 <- why 4?

#

oh, actually it returned a ping

#

stats:

#

sent = 4
received = 4
loss = 0%

#

is it good?

static cosmos
#

means they can talk yeah

#

so its a firewall problem or your not running a service

fathom harness
#

but it says that the host is inaccessible

static cosmos
#

paste the output of the ping

fathom harness
#

it's in pt-br

#

i'm using win10

static cosmos
#

can you screenshot an ipconfig on the windows machine and a ip a on the ubuntu server?

fathom harness
#

yes

#

one second

#

i'll send it via dm for security reasons, alright?

static cosmos
#

ok, but your internal IP's don't mean anything to anybody not connected to your network

fathom harness
#

just to be sure

#

hahaha

#

sent you via dm

molten wedge
#

guys is it possible that some laptops cannot boot from usb at all? I have this 10 year old laptop running windows 7,and it works fine but I cannot get it to boot from USB at all. The BIOS menu is quite different from what I am used to as well.

#

I want to install fedora on it just for fun but since it doesn't boot up the live usb at all, it doesn't work :/

#

the live usb itself is fine, I have checked on other machines already

warped nimbus
#

You may have created a UEFI-only live USB. An old machine like that wouldn't support UEFI. Ensure your live USB supports BIOS/MBR

molten wedge
#

is the default arch linux is UEFI only? @warped nimbus

warped nimbus
#

Arch? I thought you're trying to install fedora

#

In any case,I don't know what the live CDs support

molten wedge
#

yeah but I wanna switch over to arch

#

does fedora have a bios mode USB iso?

warped nimbus
#

I don't know,I never used it

icy flicker
#

can anyone help changing resolution in arch linux kde running in vmware as guest?

#

it changes but reverts back to default resolution after a split sec

warped nimbus
#

In my experience, the cd image will support both and it'll just depend on how you configure the tool you use to write it to the USB drive

molten wedge
#

i created the archiso usb using dd

warped nimbus
#

@icy flicker I have the exact same setup and no issues. Have you seen the wiki page on using arch ad a guest on vmware? There are some packages you need to install. They take care of the resolution for me

molten wedge
#

ill try this, thanks @warped nimbus

icy flicker
#

@icy flicker I have the exact same setup and no issues. Have you seen the wiki page on using arch ad a guest on vmware? There are some packages you need to install. They take care of the resolution for me
@warped nimbus are you talking about the vmtools?

warped nimbus
#

Yeah but there's also some stuff for X if you're using that as your wm

icy flicker
warped nimbus
#

Yes, I was

#

There's also a "Window resolution autofit problems" section

#

@icy flicker

icy flicker
#

@icy flicker
@warped nimbus hi! i wasn't talking about the autofit problem. i was asking about changing the resolution of the guest within the guest. :--(

warped nimbus
#

You want to lock the resolution then?

#

Have you disabled autofit in vmware?

opaque ginkgo
#

why can't you use a normal email client? @vast arch

opaque ginkgo
#

gmail, yahoo mail type things

molten wedge
#

i have the domain, i have my website, i want to setup my own email server for it.
@vast arch that's no easy deed. You wanna make your own email service like Gmail? that's an entire project by itself and not the best idea too

#

just use what the industry uses, Gmail if you're going small, sendgrid etc if you are going big

#

talk to whom?

#

yeah i understand

#

trust me implementing your own email service is no small deed

#

it will sidetrack you from your present project completely

#

so far ive found iredmail
@vast arch yep use their service, if they provide a free one that's even better

#

oh that way

#

yeah many do

#

idk about them myself

#

but you can start with smptlib

#

you will be better off sending automated emails with python

#

much easiesr that way

#

well then i helped you as i could

#

otherwise I'd just copy paste the gmail address into the "to" bar and be done

#

I don't think anyone really cares

#

but yeah it could look a bit unprofessional

warped nimbus
#

They are correct. Setting up a mail server is a lot of work if you're doing it from scratch, especially if you have no prior experience.

#

I don't think it has any sort of web interface though

#

I imagine you could set up a web interface on top of the server once you get the basic server running

formal schooner
#

@vast arch i just use fastmail w/ my custom domain

#

at which point all you need to send emails is a sendmail implementation like postfix

tender plinth
#

Hello , I've been trying to create a basic listening socket which would act ask an nginx-socket proxy and for this , I create a file named ,nginx-proxy.socket in /etc/systemd/system with the content ```[Socket]

ListenStream=80

[Install]

WantedBy=sockets.target```

#

I've also created an empty container using nginx official image with docker create --name nginx8080 -p 8080:80 nginx

#

now when I try to start the ngnix proxy with systemctl start nginx-proxy.socket , systemd logs say ```nginx-proxy.socket: Socket service nginx-proxy.service not loaded, refusing.
Failed to listen on nginx-proxy.socket.

#

Im kind of new to this , so Im really not sure if I;ve missed something trivial , can someone give an insight into this?

fathom harness
#

hey guys, how you doing

i was here some days ago to configure my ftp server, got help and now it's fine,

now it's working nicely, i've installed ubuntuserver 18.04 in an old notebook's vm, the notebook has 2gb ram, 1gb is dedicated to the vm, what can i do with this?

i want to format this old notebook soon, i'll put ubuntu desktop in it, but what can i host in this server? :x

reef grail
#

music files?

main olive
#

@tender plinth I dont understand how that container plays into this

#

Do you also run it?

hollow venture
#

It's not that easy to set up if you don't know docker, but it handles essentially everything.

#

now when I try to start the ngnix proxy with systemctl start nginx-proxy.socket , systemd logs say ```nginx-proxy.socket: Socket service nginx-proxy.service not loaded, refusing.
Failed to listen on nginx-proxy.socket.

@tender plinth sounds like it failed to bind to the socket on port 80. Did you run it as root? (sudo)

#

Also, check that nothing is already bound to that socket (ss -lt)

remote orchid
#

guys does someone know how to use dlsr cam as webcam in linux?

#

i am currently using linux mint

tender plinth
#

@tender plinth I dont understand how that container plays into this
@main olive the aim is to load the container on demand using systemd , like whenever a connection is recieved , only then the container should spin up

#

@tender plinth sounds like it failed to bind to the socket on port 80. Did you run it as root? (sudo)
@hollow venture yes everything is run as root

#

Also, check that nothing is already bound to that socket (ss -lt)
@hollow venture yes I also make sure that nothing is running on that port , I've even updated firewall rules

hollow venture
#

Interesting. In that case, no idea. Never really worked with systemd sockets.

#

the aim is to load the container on demand using systemd , like whenever a connection is recieved , only then the container should spin up
Wouldn't that add considerable delays to every connection?

fresh saddle
#

Spinning up a container for each and every request would be impossible, yeah

tender plinth
#

Wouldn't that add considerable delays to every connection?
@hollow venture but that is an idea way of utilizing resources by keeping only the currently used ones active, the thing is , our services are not very huge ones and the requests we expect wouldnt be more than 20 concurrent at a given time

#

Spinning up a container for each and every request would be impossible, yeah
@fresh saddle No the idea is , spin up one container for the first request and use it for all subsequent requests , and when all connections have been stopped , the container would be brought down

fresh saddle
#

Right

#

Yeah, that'd be possible

tender plinth
#

else , we'd be high on resources/bills if all containers keep running year long

remote orchid
#

linux mint users, does discord work just fine in your system?

#

coz it crashes sometimes

main olive
#

It also crashes in mine (latest mint) but only when using a lot of functions

main olive
#

Is it possible to have ~/Projects and ~/PyCharmProjects have all of their contents recursively merged into ~/projects without complicated use of symlinks for every file?

#

Like... the contents of those dirs still exists and are there, but the all projects dir is just a path I can navigate to and enter commands, giving me info about all the various projects in my "PROJECTS_PATH" you might call it.

summer trail
#

@main olive you can use overlayfs to accomplish that if you're on Linux.

wild kraken
#

how do i add a variable into env table (arch linux) with lots and lots of characters eg. ~&$%^(

#

cause it tends to have the habit of cutting off at points which hampers my ability to add this

main olive
#

I'll look into that. @summer trail

summer trail
#

It's how docker layers work under the hood.

formal schooner
#

@wild kraken env table?

opaque ginkgo
#

@wild kraken heredoc?

#

or just use single quotes and escape the single quotes

wild kraken
#

those things doesnt seem as effective for special characters

#

where i am trying to add the variable at ~/.pam_environment

#

however i am currently using an alternative of swapping special characters with regular ones

open sigil
#

right, I have a problem. I'm running a discord.py program on a raspberry pi running python 3.7.3 and I can't seem to set the environment variable for the discord api key so that os.environ["key"] can find it. Help

#

oh nevermind I was stupid and didn't execute the program in the same enviroment

formal schooner
#

@wild kraken ah, the escaping for that file is messy. it's not parsed by a shell or anything, it's parsed inside PAM itself. the spec is here https://linux.die.net/man/5/pam_env.conf

#

you have to escape $ and @ at minimum

#

so much archaic linux tooling out there...

lapis radish
#

hey guys uhm I know that's not the place where I should ask, but on my arch linux system I can't seem to connect to a local smb1 server

wild kraken
#

thanks saltrock for the answer c:

wise latch
#

Python help: Available

lavish hemlock
#

What is echo $?

hollow venture
#

What is echo $?
@lavish hemlock prints the return value of the last statement you executed.

$ false
$ echo $?
1
$ true
$ echo $?
0
#

(It may sound counter-intuitive, but false is non-zero and zero is true in return codes, by convention)

lavish hemlock
#

@hollow venture thanks

#

Why does your terminal print $ for every line?

hollow venture
#

That's the standard prompt

#

It prints more, but I didn't copy it :p

lavish hemlock
#

What are you using

hollow venture
#
[\u@\h \W]\$
#

So it also prints my user@host

#

I just tend to omit that

molten wedge
#

@lavish hemlock it's bash shell (or some other shell).

lavish hemlock
#

Ok

#

I also use bash

#

But it doesn’t append a $ to each line

#

Only user@host the PS1 environment variable

molten wedge
#

maybe that's just your bash theme?

hollow venture
#

PS1 formats the bash prompt, yes.

cursive walrus
#

Hello, I sometimes see in job offers that they require basic familarity with linux? How much is there to learn? Which distro would you suggest for complete beginner? I was trying sometime long (like 10 years ago) ago fedora or mandriva but was too used to windows.

molten wedge
#

@cursive walrus Ubuntu if you're a beginner

cursive walrus
#

thanks. Can you also tell me how different is programming on linux with python apart from different paths and sings "" "/" folders? Is a whole different beast or you just do few adjustments?

molten wedge
#

tbh it's very different according to how deep you wish to go. But basic commands kinda remain the same @cursive walrus

#

for eg windows cd remains the same.

#

dir becomes ls

cursive walrus
#

thanks @molten wedge , i assume it's best to check with my own eyes than ask questions 🙂

molten wedge
#

yeah

#

another thing you will notice right away will be passing options

#

for eg windows shutdown /t
will become shutdown -t

#

btw shutdown -t is not valid option i think but this was just an example @cursive walrus

cursive walrus
#

yeah np, thanks for help anyway

lavish hemlock
#

How long do pm2 processes run for

frank coral
#

Hello,

Does someone know how to really clean a terminal? Not using the clean command which only put previous results out of the screen, but deleting them from the terminal. It's tedious when debugging with programs with long output not be sure you're looking at the latest attempt. I've seen reset but id does nothing for me (mac OS)