#unix

1 messages ยท Page 12 of 1

digital remnant
#

not much tbh

#

I once edited a system file

#

but that's about it haha

#

I ssh into a uni server, so are you sure I can change that?

#

like I can prolly only do aesthetic changes otherwise permission denied? idkkkk

fluid warren
#

go into your terminal and type
cd
PS1="Fluffy"

digital remnant
#

YO THAT WORKED

#

omg perffect

#

how would I undo it

#

& change back to the og

fluid warren
#

so i believe it will go back if you exit the terminal since you never edited the bashrc

digital remnant
#

without exiting terminal

#

I don't wanna connect again to teh ssh

fluid warren
#

ok do

#

source .bashrc

digital remnant
#

done

fluid warren
#

that runs your .bashrc config (source does that)

#

did it work?

digital remnant
#

I entered source .bashrc

#

nothing happened

fluid warren
#

try typing
cd
then do it again

digital remnant
#

did that

fluid warren
#

and if that doesnt work then i guess it edited the bashrc (which confuses me if all you did was type the command in your terminal) but anyways, if that doesnt work try
unset PS1

digital remnant
#

I still see Fluffy

#

I did unset PS1, but now there is no Fluffy

fluid warren
#

ok unset removes the entire thing

digital remnant
#

and no [user@lab]

fluid warren
#

duh ok 1s

#

yeah

#

@digital remnant
$PS1="[\u@\h \W]\$"

#

do that

#

you can make an alias for these commands if you want to be able to say type
fluffy to set your thingy to [fluffy]$
and revert_fluffy to set it back to the original ("[\u@\h \W]$")

digital remnant
#

This is what it says to me:

#

-bash: =[\u@\h \W]$: command not found

fluid warren
#

ok

#

did you add the $PS1 to the start

digital remnant
#

yepp, literally copy pasted your thingy

#

I included the dollar sign as well

fluid warren
#

can you send a screnshot of the command and output

#

oh hold on

#

i messed up the command somehow the one i sent doesnt work for me either lol

digital remnant
#

I did it three times to triple check ๐Ÿซก

fluid warren
#

oh im stupid

#

PS1="[\\u@\\h \\W]\\$ "

#

just that

digital remnant
#

BRO

#

fcking magician

#

yah u fixed it

#

okie okie

#

can you teach everything to me so like in the future i'm like "hmm yes I must do this"

#

like first teach me how you were able to set it up so it showed Fluffy & what files you edited

#

๐Ÿฅบ

fluid warren
#

well it takes a while to learn linux and the best way to learn is by fucking your system up

#

like i deleted my system python (the one linux needs) and had to reinstall because my OS slowly destroyed itself

#

so this is why i backup my files a lot

fluid warren
#

this is bash code

#

its the programming language that commands on the linux terminal use

digital remnant
fluid warren
#

its like windows powershell for linux

digital remnant
fluid warren
#

alr cool so

digital remnant
#

but like basic shit

fluid warren
#

do you know what .bashrc is

digital remnant
#

uh no

#

I think I edited it once a loooong time ago

digital remnant
fluid warren
#

so .bashrc is where things like command aliases go or stuff to edit the terminal

digital remnant
fluid warren
digital remnant
#

yoooo like that picture you have?

fluid warren
#

well no

#

thats the terminal itself

#

its just a transparent terminal

#

you can get that i think you use gnome so if you go to the terminal you can go to the preferences tab

#

and theres a transparency option

digital remnant
digital remnant
fluid warren
#

not yet

digital remnant
#

is that what we did with the Fluffy shit?

#

okie

fluid warren
#

well yes but if its not in the .bashrc file it wont save

digital remnant
#

so my alias was like DO = "i forgot"

#

and then when I typed DO, I would connect

fluid warren
#

so do
cd (we do cd to make sure we are in our ~/ directory because thats where .bashrc is located)
nano .bashrc
and you can do aliases (i add everything new to the bottom but it really doesnt matter )

digital remnant
#

lemme do that rn

fluid warren
#

and you dont have to use nano you can literally use a text editor if you want

digital remnant
#

aight I see teh bashrc file

fluid warren
#

like xed

fluid warren
#

im sorry to hear that

#

anyways

digital remnant
#

LMFAO

#

wait why ๐Ÿ˜ญ

#

I jus started using it

digital remnant
fluid warren
#

i use emacs so

#

we are enemies now

digital remnant
#

ahhh so are we supposed to be mortal enemies

#

yah

#

lmao

digital remnant
#

so what did you edit in the bashrc file

fluid warren
digital remnant
#

to make it show "FLUFFY"

fluid warren
#

anyways

#

subtle emacs rice flex

digital remnant
#

maybe some day

fluid warren
#

let me test the alias out rq to make sure i know what im doing

digital remnant
fluid warren
#

rice just means make look nice

#

comes from a car term like "race inspired something cosmetic something" to describe cars that look fast but arent

#

idk not a car guy

#

anyways

#

im yapping

digital remnant
#

lmao

digital remnant
fluid warren
#

so PS1 is the name of the variable that puts the[user@name]

#

so you are just saying change user@name to "fluffy"

digital remnant
#

gotchya, how come I don't see PS1 in the bashrc file?

fluid warren
#

gonna be honest no idea where linux gets it when its not defined

#

but

#

we can redfine it

digital remnant
#

got it

fluid warren
#
alias fluffy="export PS1='[fluffy]$ '"
alias revert_fluffy="export PS1='\[\e[38;5;207m\][\[\e[38;5;225m\]\u@\h \[\e[38;5;153m\]\W\[\e[38;5;207m\]]\$ \[\e[0m\]'"

this makes the normal one colored i can get a non colored one

digital remnant
#

so lemme set up aliases to activate and deactivate fluffy then

fluid warren
#

so if you put that in ur thing, go into terminal type source .bashrc (to re load the bashrc config) and try it out

fluid warren
#

its pink

#

im just fruity asf so

#
alias revert_fluffy="export PS1='[\u@\h \W]\$ '

if you want no color on the normal

digital remnant
#

YOOOOO

#

the color is so fucking fire

#

wait could I make it purple

#

๐Ÿฅบ

#

Purple es my favorite color

fluid warren
#

yeah 1s

digital remnant
fluid warren
#

PS1='[\e[38;5;213m][[\e[38;5;183m]\u@\h [\e[38;5;141m]\W[\e[38;5;213m]]$ [\e[0m]'

#

if you wanna just test it just run that in the terminal

#

if you like it then add to bashrc

digital remnant
#

uh it made my thing wierd

#

instead of name@server

#

it is

#

[][[]name@server []~[]]$ []

fluid warren
#

interesting

#

did the other colors work though?

digital remnant
#

there was some purple, yeah!

fluid warren
#

weird

#

ok 1s

digital remnant
#

I will exit and reconnect to server

fluid warren
#

ok so it might be an ssh thing 1s

#

PS1='[\e[38;5;213m]โšก [\e[38;5;183m]\u@\h [\e[38;5;141m]\W$ [\e[0m]'

#

try that

digital remnant
#

lightening bolt?

fluid warren
#

im not sure thats differnt 1s

digital remnant
fluid warren
#

kinda cold

digital remnant
fluid warren
#

so

fluid warren
digital remnant
#

oh okie okie

fluid warren
#

wait are you on linux outside of ssh

#

or are you just sshed into linux and doing everything there

digital remnant
#

works perfectly

#

I will ssh into server now

digital remnant
fluid warren
#

ah ok

#

so the ssh server probably has different encoding

digital remnant
#

wait it works now

#

I did

#

PS1='[\e[38;5;213m]โšก [\e[38;5;183m]\u@\h [\e[38;5;141m]\W$ [\e[0m]'

#

and it worked

#

in the ssh server

#

I think the issue was that last time I activated fluffy, deactivated it, and than ran it

fluid warren
#

mayhaps

digital remnant
#

now, I just newly ssh'ed and the lightening bolt thing first

fluid warren
#

so just make sure to update ur bashrc and you should be good to go

digital remnant
fluid warren
#

just a warning ricing your linux is a dangerous path to go down (you cant stop)

digital remnant
#

like I have to activate fluffy first

fluid warren
#

hm

digital remnant
#

and then deactivate it

#

and ONLY THEN does it become purple

fluid warren
#

ohh

#

ok

#

ok

digital remnant
fluid warren
#

IOH

#

i know why

#

so in bashrc above the aliases just add
PS1='[\e[38;5;213m]โšก [[\e[38;5;183m]\u@\h [\e[38;5;141m]\W[\e[38;5;213m]]$ [\e[0m]'

#

it wont work on startup because its waiting for the command

#

ok formatting messed up the moji

#

so when you do that it will set PS1 every time instead of waiting for you to type the command alias

digital remnant
#

instead of lightening bolt it just says:

:zap: blah bah
fluid warren
#

yeah i messed that up copy it again

#

the emoji converted to :zap instead of just being the emoji

#

also consider trying this

PS1='[\e[38;5;213m][[\e[38;5;183m][\e[38;5;141m]โšก fluffy \W[\e[38;5;213m]]$ [\e[0m]'

fluid warren
digital remnant
#

it still shows
:zap:

#

hmm lemme try copy pasting again

#

YOO IT WORKS

#

thank you so much for all of the help

#

I really appreciate it : )

fluid warren
#

no problem bro

fluid warren
digital remnant
#

that's actually pretty useful

fluid warren
#

yeah fr

digital remnant
#

I was recommended to install either and I am not sure which one I should choose

fickle granite
#

tmux

#

easy

#

screen is semi-abandoned

fluid warren
#

Ngl I use neither cause Idk what they are and never had a reason to look Into them

summer trail
fickle granite
#

so when you turn the client back on, and run tmux again, you're right back where you are -- same shell prompt, same output on the screen, &c

#

the remote machine never knows you went away

digital remnant
#

should I move from vim to neovim? What exactly is the difference

summer trail
digital remnant
#

That is a lot of information ๐Ÿ‘€

#

So is neovim the "improved" version of vim?

#

ie. should I move to neovim?

summer trail
#

I moved a few years back and don't regret it. It's got more IDE-like features, and the plugins I've used feel faster and more polished

digital remnant
#

gotchya

fluid warren
#

i feel like having a few tabs on my gnome terminal is easier to manage than say multiple windows in tmux

fluid warren
#

bro i do not understand tmux

#

well i do but it seems like a lot of work for not so much reward

#

for me

#

like running my CLI for some reason i gotta write the whole declaration of independence to scroll up and down or something

fickle granite
#

fwiw, screen isn't any easier

fickle granite
#

sometimes the mouse does what I want; sometimes it doesn't ๐Ÿคท

fluid warren
#

yeah

fickle granite
#

for me it's something like C-z [ M-โฌ†๏ธ

fluid warren
#

default for me its C-b [

#

C-c to go back to normal mode

#

ok it also just breaks my cli if i enter copy mode before my cli outputs

#

bro

#

ok

fickle granite
#

๐Ÿคท

#

if it's too much fuss, then don't use it!

#

problem solved

#

afaik the only problem it solves is "I closed my laptop but I want my ssh connection to persist". If you don't have that problem, then it's not worth using

fluid warren
#

yeah thats what im reading and i cant find a good reason to commit lol

radiant kraken
fluid warren
radiant kraken
# fluid warren what do you do with your rpi? i have one but have no excuse to use it

earlier it was my first dive into setting up ssh and doing scp/sftp/vnc stuff from school via a remote.it proxy, running my pet simulator GUI written in java, and for a moment i messed around with GPIO in python to blink an LED when the cpu throttled (until i put on a tower cooler), but now i only use it host my 3 discord bots (one used to be dockerized, two use systemd services, most recent one now running with tmux)

fluid warren
#

oh cool

#

i considered hosting some sort of git thing

#

for the flex

radiant kraken
#

rpi 64-bit OS you should use btw if you need to install any python C extensions, infinitely made my life easier using numpy/Pillow on it

fluid warren
#

i may have changed my mind on tmux

#

its kinda hype for hosting my documentation locally

#

but man idk if i can live long enough to learn more keybinds after emacs

fluid warren
#

but lord have mercy using a CLI is a nightmare because why do i need to use keybinds to SCROLL UP

fickle granite
#

because getting tmux working with your mouse is a huge pain ๐Ÿ™‚

#

On MacOS, the iTerm terminal has some sort of integration with tmux, but I've gotten it to do anything useful. Perhaps I haven't tried hard enough.

rotund girder
#

I use wezterm and haven't felt the need for tmux since then. But I am having some stability issues with wezterm vs. X ... ๐Ÿ˜ฅ

#

If you have a terminal that supports semantic zones, be sure to tryout keybindings to "scroll up to previous prompt" - it's great ๐Ÿ‘Œ

unkempt hamlet
#

i only care about detaching from sessions
so dtach works for me

neon depot
#

Hello everyone!

When ever I try to activate virtual environment I get this error. Any one know how to solve I am using kali linux.

source .venv/bin/activate

basename: extra operand โ€˜ofโ€™
Try 'basename --help' for more information.

sonic pendant
#

are you sure you are using bash?

#

try . venv/bin/activate.fish instead

ember quiver
coral panther
lone yacht
ember quiver
shrewd stratus
#

and so does python -m venv

sonic pendant
#

yes, not a typo ๐Ÿ˜…

ember quiver
cerulean wadi
median crane
#

how can i install multiple versions of python on my ubuntu. now when i try pip its not allowing me to run it.. it tell me do something like apt install python3 -pytest..

#

and i am not quite sure should i do this or not is it common to have multiple python versions on ubuntu

wise forge
#

i create python3.10 -m venv .venv specific version in project folder

#

source .venv bin activate

#

specific python version is on

#

plenty of other people like pyenv usage instead

median crane
#

oh ok but i was asking so u dont really have packages installed on global python..?

#

every packages are installed on venv

wise forge
#

for global python i have in user home .venv created for my "global" packages

#

and have created linux aliases redirecting to this global venv

median crane
wise forge
#

well. this is bad approach. breaking OS once helped me to remember forever not doing that

median crane
#

okh ill make venv and install then

wise forge
#

at ubuntu default python is system python, used in ubuntu

#

see the difference

median crane
#

oh yes got it

wise forge
#

if u wish using global python without care => use pyenv it makes global python not system one

#

or use venv approach + optionally linux aliases as i do

median crane
#

๐Ÿ‘

ember quiver
digital remnant
#

so I am using tmux, but for some reason my tmux isn't affected by my tmux.conf file?

#

Here is where my tmux.conf file is: ~/.config/tmux/tmux.conf
When I run tmux, the conf file doesn't do anything.
When I run tmux -f ~/.config/tmux/tmux.conf, the conf file STILL does not do anything

#

I copy pasted my tmux.conf file from github, so I am at my wits end on how to fix this problem

radiant kraken
digital remnant
#

I copied the tmux.conf to ~/.tmux.conf

#

it still doesn't work ๐Ÿ˜ญ

radiant kraken
#

what does your config contain?

#

also, does manually re-running the config work? i.e. C-b :source ~/tmux.conf

digital remnant
digital remnant
radiant kraken
#

closing the terminal for me doesn't do anything, but re-sourcing it does

digital remnant
#

set-option -sa terminal-overrides ",xterm*:Tc"
set -g mouse on

unbind C-b
set -g prefix C-Space
bind C-Space send-prefix

Vim style pane selection

bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

Start windows and panes at 1, not 0

set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on

Use Alt-arrow keys without prefix key to switch panes

bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

Shift arrow to switch windows

bind -n S-Left previous-window
bind -n S-Right next-window

Shift Alt vim keys to switch windows

bind -n M-H previous-window
bind -n M-L next-window

set -g @catppuccin_flavour 'mocha'

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'dreamsofcode-io/catppuccin-tmux'
set -g @plugin 'tmux-plugins/tmux-yank'

run '~/.tmux/plugins/tpm/tpm'

set vi-mode

set-window-option -g mode-keys vi

keybindings

bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel

bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"

digital remnant
#

when I do tmux, none of the conf applies

radiant kraken
#

its meant to run in the tmux command prompt

#

Ctrl+b, then :, then source ~/.tmux.conf in the yellow line it shows at the bottom

#

soz, gotta sleep now

digital remnant
#

IT WORKED

#

ILY

digital remnant
#

thank you so much < 3

radiant kraken
merry coral
#

how do i run the latest version of python 3.12

ember quiver
merry coral
#

How

#

How do i install it on Kali or Ubuntu

ember quiver
unkempt hamlet
#

how do i setup remote ssh to a server

fickle granite
#

kind of hard to simply answer that; there are a lot of steps

#

do you control the server?

unkempt hamlet
#

yes self hosted server

fickle granite
#

have you got sshd running on it?

unkempt hamlet
#

yeah

fickle granite
#

well that's a start.

#

try ssh youruser@yourhost.com, see what happens

unkempt hamlet
#

the things that confuse me is the port forwarding

fickle granite
#

well try without port forwarding at first

unkempt hamlet
#

lemmi find the server public ip

#

it just get stuck i think

#

nvm got "Operation timed out"

fickle granite
#

ok so networking isn't properly set up

#

what kind of server is it -- is it e.g. an AWS EC2 instance?

unkempt hamlet
#

ubuntu
its my own server

fickle granite
#

yes, but is it a physical machine that you control, or is it a cloud server?

unkempt hamlet
#

physical machine that you control
thsi^

fickle granite
#

huh

#

well you need to set it so that port 22 can connect to it from the public internet

#

or at least, from the machine on which you tried "ssh" and it timed out

#

I have no idea what your networking setup is; I've never set up an actual physical machine

#

if it's just an ordinary PC in your house, then you need to fiddle the modem that connects to its ISP

unkempt hamlet
#

oh ok
there seems to be 2 diff port forwarding called local and remote
im not sure which one to do

fickle granite
#

no idea what you're talking about

#

it sounds like you're talking about options to the "ssh" program

#

but that's premature

#

you need to fix the networking first

unkempt hamlet
#

gotcha
i'll try to figure the networking out

somber latch
#

Has anyone every tried connecting to the X server with socket in Python?

import socket
import sys

def main():
    client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    
    client.connect("/tmp/.X11-unix/X0")
    client.close()

if __name__ == "__main__":
    sys.exit(main())

I am trying to create a basic window manager in X11 without any libraries at all (just the C standard and POSIX library), but well it's way too hard, so FOR THE SAKE OF MY SANITY, I am starting from Python, then I will move on to C

#

it's still way too hard, especially I just started learning networking a few days ago

lapis cloud
fickle granite
#

I'd think if you cared about your sanity you wouldn't do this at all, but that's just me

somber latch
summer trail
somber latch
main olive
#

anyone knows why i get this avc denied error while starting sshd with systemctl? :

audit: type=1107 audit(1720005335.469:7): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:kernel_t:s0 msg='avc:  denied  { start } for auid=n/a uid=0 gid=0 path="/lib/systemd/system/ssh.service" cmdline="" function="bus_unit_method_start_generic" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:sshd_unit_t:s0 tclass=service permissive=1

fyi: i can check sshd status with systemctl and my SElinux is permissive so idk what causes it any ideas?

im using debian bookworm with linux kernel : 6.10.0-rc6-ge9d22f7a6655

clever phoenix
#

What are all the specifications for a os to be considered unix based?

spark mulch
fickle granite
#

or: there aren't any

#

next question

#

๐Ÿ™‚

#

it's not both precisely defined and widely-agreed-upon

tropic fog
#

Is their an alternative of Linux screen session for windows?
I want to run my script in a seperate session where I can attach and detach my session (review the progress) any time and would be running in the background (like Linux screen session)

shrewd stratus
tropic fog
shrewd stratus
#

from a cursory search, there don't seem to be any alternatives for actual Windows
but someone that uses actual Windows a lot might help you better

#

try asking in one of the off-topic channels as well

fervent jay
#

I hope this is the correct channel, I want something cross platform ideally, but I'm on linux so, I would prioritize that.
I am looking for a good "hello world" setup that does:

  • system tray
  • starts running on startup
  • can execute minimal functions like "open file", "request website/api info"
  • I can distribute it with an install file that will do this setup for a not specialized user

I tried tk, that didn't run at all. currently, pystray works but the systemctl service setup doesn't. The man page for systemctl is written like a dictionary, not a how to.

I'm grateful for any tips. Also, it may not seem like it, but I am also fine with a long and involved process, if the end result actually works reliably.

(I think the systemctl thing worked after all, not 100% sure, seems like dark magic that doesn't give feedback. Nope, that wasn't it. Manually setting it up in my DE's autostart thing does work?)

lapis cloud
wise forge
# fervent jay I hope this is the correct channel, I want something cross platform ideally, but...

I am a Linux user, and therefore prioritizing having ability to work from it too.

Golang allows me that (literally compiles for windows from Linux, smth that python does not have). Java is quite cross platform too.

So far I did only web and cli solutions though.
I keep my eye on https://wails.io/
To make a desktop app later from my web app.
It offers building desktop app with web tools, html and etc
And offers making installer for windows users.
I see it very convinient as I will be able just reusing my web version code.

Build beautiful cross-platform applications using Go

fervent jay
wise forge
# fervent jay cool!, that does look like it's for Go though...

I researched before python desktop solutions and saw people making installers and good stuff with pyqt, Wingman freelancer app u can search at GitHub as example. But pyqt has difficult licensing, paid for commercial apps (not sure if u can avoid to pay. Certainly free for non commercial open source) and looks in general not very fitting my style/taste

#

Python is not the best imo language for desktop apps, but some choice is present

#

Windows apps are rather smooth to do in C# as an option too. Drag and drop visual editor in visual studio for that. C# is literally windows desktop common language

fervent jay
#

Ok, someone mentioned basically this sudo systemctl start my_second_tray_test && journalctl -fexu my_second_tray_test and that gives output and the answer is that something with the pystray import fails

#

and then the service crashes and isn't available.

tropic fog
rotund girder
#

I also use Wezterm on windows and connect with the builtin ssh to a Linux machine (when working from home). I have not set up persistent sessions yet.

#

I prefer to work directly on my Linux workstation without any remoteness because:

  • minimal lag
  • my bindings that depend on tty information only works on local workflow (tty info is not exposed from the remote machine to the local wezterm instance)
#

Annoyance:

  • Don't know a way to share Wezterm config between Windows and Linux app. Does anyone have a solution to this?
frigid barn
#

someone knows any library/package for sixel which displays image in a way that images don't stack?
like https://pypi.org/project/sixel/ displays image but doesn't move cursor/input/anything and that's require me to move cursor manually (not saying about refreshing whole shell at closing script)

frigid barn
#

someone?

frigid barn
#

spits bunch of characters but no imageโ€ฆ

#

hmm. idk why even yesterday it was working like that cuz today no issues ๐Ÿค”

fallen silo
#

I have a python application that requires a serial connection in order to interact with hardware
Ubuntu doesn't let you serial unless you are in sudo or a particular user group (dialout)
Does anyone know how I could go about either running the whole application in sudo, running sudo for just the button that initializes serial, or change the user group?
I dont want users to have to go into command line, I just want one executable that people can click and not have to worry about permissions themselves

fickle granite
#

don't think it's gonna be easy

ember quiver
# fallen silo I have a python application that requires a serial connection in order to intera...

how I could go about running the whole application in sudo

Well, you could just run it with sudo, but it sounds like you don't actually want that, so you're looking at something like this: https://stackoverflow.com/questions/13045593/using-sudo-with-python-script

fickle granite
#

the easiest thing is probably to

  • write a proper Ubuntu package (hint: not easy at all), that ...
  • during installation, changes the permission on the serial port so that ordinary users can use it
fallen silo
fallen silo
ember quiver
fallen silo
#

okok ill look into this as well thank you for your help

fickle granite
#

that executes whatever code you, the "packager", have supplied to do the installation

#

your code could change the permissions on the serial port device

#

then it'd just install the software as usual

#

disclaimer: I've never done this myself

#

I like this idea better than giving your program root privileges; it's narrower in scope, hence, presumably, safer

fallen silo
fickle granite
#

chown

#

figure out who's running apt -- perhaps the SUDO_USER environment variable -- then do chown that-user /dev/whatever

#

chmod might work too; add that user to whatever group already has read and write access to the device

plush salmon
#

not getting output

frail pewter
#

in the powershell

wise forge
#

This is not the advice to give in unix channel

barren temple
#

i wish i would have his talents in baiting people ๐Ÿ˜„

wise forge
#

python in linux systems is commonly known as python2

#

so u may be wishing python3 to use actually the desired one

plush salmon
plush salmon
eternal coyote
#

You need to do python3 test.py or if you want to just do ./test.py then you can do chmod +x test.py and add #!/usr/bin/env python3 to the top of your file

lusty dust
#

anyone know why this isn't working ?

spark mulch
#

They are per-process, and processes (by default) pass them to their child processes

lusty dust
spark mulch
#

To make a variable available to subprocesses

#

But yeah, I wouldn't call them "global" either

lusty dust
spark mulch
#

You can think of processes having a family tree. Every process* has a parent, and a process can have many children.

lusty dust
#

like the first terminal lead the rest ?

spark mulch
spark mulch
#

Not if you open it by clicking somewhere in your desktop environment, because then that is the parent of the new terminal

lusty dust
#

oh I get it

#

Thank you so much for your time

digital remnant
#

so I am using Ubuntu

#

I installed IntelliJ from the .tar.gz download

#

However, whenever I want to run IntelliJ, I have to manually run the idea.sh file in my command terminal, which is quite annoying

#

instead of having to run that every time, is there a way to make the IntelliJ and "app" I can click to boot, or something I can search in the bar?

zealous moth
# plush salmon

Thatโ€™s bc you need to change your directory to the file directory

#

Unless your โ€œtest.pyโ€ is located at the directory your on right now, then running python3 test.py ainโ€™t working

#

Use cd to change to that directory or specify the full directory when running python3 test.py

zealous moth
#

Why?????? skullcursed

#

Then you proceed to run python3 test.py on the wrong directory.

#

Why did you need to change directory with cd after finding out with ls it is indeed in the directory you were on.

plush salmon
wise forge
#

learn to google ๐Ÿ˜

zealous moth
#

I can help you

#

Iโ€™m a Mac user myself

#

Or you just just google it

#

It ainโ€™t that hard

plush salmon
balmy field
ruby monolith
#

Hello! Who knows what this error is?

barren temple
#

cmake is a program to build c/c++ programs

ember quiver
barren temple
#

(could also be the thing is trying to build something c/c++ from sources, and there are no tools installed? Idk though)

ruby monolith
#

Python 3.11.9

spark mulch
# ruby monolith pip install streamlit

Try doing pip install wheel before installing streamlit. Often these issues are caused by not being able to use wheels and instead having to build it from source (without build tools)

#

What OS are you on?

fickle granite
#

that's an unusual platform; most packages only provide binary wheels for popular platforms, and you're forced to build from source otherwise. Sounds like that's your situation, and I can't think of an easy way to get past it.

ruby monolith
ruby monolith
ember quiver
ruby monolith
ember quiver
spark mulch
#

I'm sure it's possible, but it'll be a lot of work. You might need to install patchelf and ninja from source (those are the dependencies where building fails for me on termux)

spark mulch
#

First pkg install patchelf ninja tur-repo binutils-is-llvm libjpeg-turbo , then pkg install python-pandas python-pyarrow, then LDFLAGS="-L/system/lib64/" CFLAGS="-I/data/data/com.termux/files/usr/include/" pip install Pillow , and finally pip install streamlit. :)

ruby monolith
#

pkg install patchelf ninja tur-repo binutils-is-llvm libjpeg-turbo

#

๐Ÿคทโ€โ™‚๏ธ

spark mulch
spark mulch
#

Where did you install termux from?

#

The version from the play store is horribly out of date..

ruby monolith
ruby monolith
spark mulch
ruby monolith
#

pkg install patchelf ninja tur-repo binutils-is-llvm libjpeg-turbo - install

pkg install python-pandas python-pyarrow - install

pip install Pillow - install

pip install streamlit - error

spark mulch
#

The error above? That's strange, it shouldn't need to build ninja and patchelf anymore if the installation succeeded..

spark mulch
# ruby monolith

The pip package is likely called python-pip. In any case: Does installing tur-repo succeed?

ruby monolith
spark mulch
ruby monolith
spark mulch
ember quiver
ruby monolith
ember quiver
#

If it's a hard dependency for something else though, it will still try to install

ruby monolith
#

Does anyone know where to find the source folder in Android termux?

ember quiver
median garden
#

probably in site-packages? im not sure if the ones that dont finish compiling are there

#

try pip show pip and check that folder

ruby monolith
#

Found the files๐Ÿ‘Œ

green iron
#

i instaled and switched to nvidia driver but now my ubuntu is stuck on boot logo, cant even access TTY. althogh i am able to boot with different kernal version i think. how can i fix this?

ember quiver
green iron
ember quiver
green iron
lapis cloud
#

Yeah, Nvidia's driver checker says that the latest driver for the 100M series is v340.108. So that'd explain why installing a new-ish driver led to it not working.

#

wait, but maybe it's the 800M series instead?.. that'd mean v.550.100 is fine. The problem is that "GM108M" and "GeForce 840M" are as far as I can tell different gpus. ah, one of these is the chip name. So in theory v550 should work. Which one did you try?

green iron
#

Although I could only boot into different kernel

languid vortex
#

why do we create virtual env for python for managing package conflicts while the Linux systems don't?

fickle granite
#

?

#

Two things about your question confuse me:

  • You said "for managing package conflicts". I don't know what you mean by that.
  • I use virtualenvs on Linux all the time
wise forge
#

i would not use system python for that

#

once i already destroyed OS by doing that

languid vortex
#

why venv is not a general idea?

wise forge
wise forge
#

i use Docker for deployment of all web apps all the time, just for the sake of documenting how to build and run them in the same way

#

it is convinient using Venv alone in local dev environment

#

for the sake of lesser problems to configure IDE for intellisence features

#

otherwise IDE like vscode can be configured working fully with Docker too if desired

#

This book is a friend to learn it

languid vortex
#

thank you very much

#

I dont know how to use Docker yet

#

I dont have much web development experience

fickle granite
#

I wouldn't learn docker just yet; it's awfully complex

#

yes, it solves real problems; but unless you are reasonably sure that you have those problems, then it's probably not worth the effort to learn. [On the other hand, if you just enjoy learning stuff for the sake of learning stuff, go for it]

wise forge
# fickle granite I wouldn't learn docker just yet; it's awfully complex

as backend/infra dev disagreeing.
Docker is a tool simplifying things a lot and bringing a lot of dev comfort in a lot of usage cases
Things that were hard, become very simple 5 minutes thing with it.

There are some usage cases when it can do harm though, but it is rare times when it is used wrongly.
in average of 90%+ usage cases it goes only great good
This technology should be learned very throughly at least by every backend and infra dev. and i guess by full stack frontend devs too.

#

====
Kubernetes, container orchestration technology build on the fundament of this containerization..... that's where i will agree ๐Ÿ’ฏ
awfully complex and all the words u said.

fickle granite
#

if you're a professional doing deployments all day long, then sure, you have some of the problems that Docker solves.

#

But I don't think runoob is a professional doing deployments all day long.

wise forge
# fickle granite But I don't think runoob is a professional doing deployments all day long.

if he is not professional, he will still get a lot of good from it ๐Ÿ˜‰
like easy running Avorion game server https://hub.docker.com/r/rfvgyhn/avorion
or easily quickly raising wordpress https://github.com/docker/awesome-compose/tree/master/wordpress-mysql
or easily quickly raising dockerized nginx or letsencrypt

GitHub

Awesome Docker Compose samples. Contribute to docker/awesome-compose development by creating an account on GitHub.

#

docker is as much as... debian package for a web world

#

a way to easy launch/setup things

fickle granite
#

you don't have to convince me that Docker has benefits; I use it too

wise forge
#

the important aspect => docker makes things easy. what was previously few days effort, becomes a 5 minutes effort

#

therefore it should be learned if doing web dev stuff

#

because it brings dev comfort

ember quiver
ionic goblet
#
poll_question_text

XDG Spec

victor_answer_votes

5

total_votes

11

victor_answer_id

3

victor_answer_text

I don't care

victor_answer_emoji_name

๐Ÿคทโ€โ™‚๏ธ

rose barn
ember quiver
# rose barn https://github.com/coronasafe/care/issues/2301 it looks easy can anyone help me ...

Seems like you could just use or modify an existing solution https://stackoverflow.com/questions/24718706/backup-restore-a-dockerized-postgresql-database

wise forge
#

Same author

quaint tulip
#

hello, does os.listdir just return the file names and nothing else? Is there a way to get ls -l through the os library?

#

os.listxattr maybe? but only on path, not on a glob?

fickle granite
#

yes, it returns only the file names.

#

to get like ls -l, it's probably easiest to just run ls -l, at least if you're not on Windows.

#

I'd never heard of listxattr before. That might be helpful, or it might not; in any case, you'd need to run it on each file

quaint tulip
#

ok so what I'm doing here makes sense then, switching from command to python

fickle granite
#

I'm too lazy to carefully read that screenshot.

quaint tulip
#

This better?

fickle granite
#

"better" how? It's not how I'd do it, but if your goal is to wind up with a dataframe, then I guess it's OK

#

you could do the first line in python if you wanted, instead of running a shell command

quaint tulip
#

better as in smaller screenshot that you are not too lazy to read

fickle granite
#

ah well I read it

quaint tulip
#

well that's the original question, do I use something in the os module instead of that first line

#

pathlib is a wrapper of os?

fickle granite
#

use either os or pathlib to get a list of files; then loop through that list, calling os.stat (or the pathlib equivalent) on each

quaint tulip
#

ok but stat returns different information to ls -l

#

stat is more about timestamps

#

so with the right arguments stat will return the same info as ls -l?

fickle granite
#

sorta

#

it returns a ton of stuff; ls -l only displays a subset

#

start here ```py
import pathlib

import tabulate

table = []
directory = pathlib.Path("/tmp")
for item in directory.iterdir():
entry = item.stat()
table.append([entry.st_mode, item.name, entry.st_nlink, entry.st_size])

print(tabulate.tabulate(table))

poetry run python steliosx.py

----- ---------------------------------------------------------------------------------------- - -------

33188 20240805_063035.Default.w0t1p0.45AB3C2F-3F9F-4C9A-A1B8-787581B2FAC3.42201.4225571198.log 1 10257

33188 env-vars-0.log 1 19719

33188 20240804_175736.Default.w0t0p0.F05E94F6-5C96-4250-A431-EACF49B30016.45168.2724275649.log 1 5953

#

pick and choose the attributes you actually care about

quaint tulip
#

name and size is what I care about actually, not even all the stuff from ls -l

#

thanks, I learned something today!

#

tabulate is part of the standard library?

fickle granite
#

alas no, you have to pip install tabulate. But it's pretty slick.

tulip vortex
#

Hello guys.
I have a question about the conventional ways of installing stuff in linux. i also want to know which
ones are preferable and more secure.

I screwed up my os after upgrading somethign a week ago, and that damaged me financially, and made me spend a lot of time repairing it by re-installing the os. i didn't lose data, but I had to download many stuff and it was expensive.

So I tought, this time, I have to do it right. I am a amature user of Linux (debian) distros. I know how to do some stuff, but I don't know what I should do to keep my system clean and safe at the same time, and possibly, prevent potential os breaks that prevent me from fixing it. (last time my network drivers were damage so I couldn't access internet to fix packages with apt even with tty* sessions)

I have a few questions, I would appreciate it if you share your knowledge and guide me through my new linux journy.

Questions:
I noticed there are multiple ways to install stuff packages and applications in linux.
here is what I think:

  • 1: using apt (safe if I use trusted repos, requires root privilage)
  • 2: using dpkg (safe if downloaded from trusted sources, requires root privilage)
  • 3: using snap,flatpak (I have no idea if it is safe, DOES NOT REQUIRE root privilage for installing new packages)
  • 4: forking repos and building them from source
  • 5: using shell installers (like phoenix ide)
  • 6: using binary installers (I think this is the most insecure, and for me it didn't require sudo, example is jetbrains-toolbox)
  • 7: using portable apps that are shipped with their binaries, and are ready to run. (like nvim)
#

So my first question is, which of the above methods should i try to avoid?

Which one of them are the most secure?

Is installing stuff from snap and flatpak secure?
also why does it not require sudo? does that mean that if a regular user connects to my server via ssh he can install new packages?
why would linux allow that?

Also I think that the sixth method is the most dangerous and insecure way of installing things. after downloading jetbrains-toolbox binaries from its official site, i just uncompressed the tar.gz file, and then run the binary inside it. after that, the toolbox was installed. no installation guide or panels were provided, it was automatic, no sudo was required too.
after installation, jetbrains-toolbox is registered as an application in my os, and is also run on boot up everytime. it is shown on the system tray bar.
so it means it somehow created a cronjob for itself, to make it start in boot up, and it did something to make itself be registered as an app. it can also install other apps like Pycharm and Intellij.
breaking it down into a one sentence, after running a binary with regular user (not sudo), it is installed and run everytime at boot up, and it can install other apps too. isn't this just fucked up?
why would linux allow that?
am i missing something?

last question:
in Windows and Android there is a concept of signing apps to mark them as trusted so the os can know if an app is dangerous or not. is this somehow implemented in linux?
could it be the reason that there was no need to provide sudo for intellij-toolbox setup binary?

spark mulch
#

All of them are safe if from a trusted source and unsafe if from an "evil" source. (Although I believe snap/flatpak do some kind of sandboxing?)
In general, "installing" can mean different things. You need root privileges to put a file somewhere in folders for which you have no write privileges; typically those include the places where software is installed to in traditional ways (i.e. apt).
For the most part, as long as you have all the dependencies or they are packaged with the application, you don't need root privileges to download and run software, or to "install" it to a location you own.

I think the biggest confusion comes from the difference of what protections are assumed via the user model of unix vs. via app stores on iOS/Android etc.:
The whole root vs. normal user protects the system you run, i.e. the integrity of your operating system. It does not protect you from yourself, or from malicious software, as long as this software just exfiltrates/deletes data from you. Generally software can do anything you could do manually.
Compare that with mobile operating systems where you are โ€” to a degree โ€” protected from apps you install. Not only can they not destroy the OS, they can also not delete your data/take a picture of you/get your location/... without your prior approval.

#

There's no generic signing process without which software cannot run (on any linux distro I'm aware of). APT does cryptographically verify that the software you install comes from the proper source, but this happens on installation, not when running software.

wise forge
#

Is it for Desktop dev machine or for Server?

tulip vortex
wise forge
#

If for server, then for Baremetal physical server or for Cloud provider rented server

tulip vortex
wise forge
# tulip vortex Hello guys. I have a question about the conventional ways of installing stuff in...

Part 1:
then my answer, all of those methods are technically safe

  • But some applications can be more dangerous then others to install if they are for example antivirus, they will be dangerous by default due to interfering with kernel
  • All minor apps are in general safe

Part 2:
But if u do stuff like updating your OS, and you value easy recoverability... i would recommend using Clonezilla on Live USB to take snapshot to external drive before doing such massive update change (as it can easily break smth)

Part 3:
I keep my OS sort of stateless, as all my projects are constantly pushed to Github/Gitlab repositories.
including my personal content, documentation, configs, i backup everything into git-crypt encrypted repository regularily and push to several remotes.
And even pull sometimes at my laptop for having extra backup local at a hand.
This approach helps me to recover everything at any machine, as long as i can access at least one of the backup places
I consider probably one day adding my server as remote storage in addition

tulip vortex
wise forge
# wise forge Part 1: then my answer, all of those methods are technically safe - But some app...

Part 4:
I don't keep attachments to OS (stuff from Part 3 easily helps in this), and have full reinstallation of it every time from zero, when new stable LTS happens (and long enough time passed to fix bugs in it) ๐Ÿ™‚
That allows me making sure each time to clean OS for sure from anything i need to keep @tulip vortex
going to be soon updating stuff from Kubuntu 22.04 to 24.04 LTS ๐Ÿ˜…
P.S. that's another important point. Use LTSes only, they are more stable

lapis cloud
wise forge
#

technically jail stuff, and docker are all extra things to isolate OS from things too, but the first thing is even more bothersome to setup, and second one fits web apps only and not very useful for desktop apps at all ๐Ÿ˜…

tulip vortex
#

also, is the conventional way of securing the os with snapshots, getting backups from system packages, or the user packages too?

wise forge
#

Docker alone consumes 100GB quickly

#

i managed to use 250gb storage size on linux first 2-3 years before i ran out of it due to usage of more languages and projects

#

ncdu program helpe dme to keep size usage in check and clean stuff easily

#

migrated some amount of years ago to 1000gb sized SSD to fit all my every day lfie needs at last

tulip vortex
wise forge
#

Python projects are fat. One could consume 1-2 gigabytes just to create its venv environment

#

if u work in a company that has dozens of projects at the same time

#

u run very quickly out of storage capacity

#

add here my needs for multiple aps, snap, golang, and now even java stuff

#

all the libraries take place

tulip vortex
wise forge
#

u could be wishing external SSD may be for Clonezilla Live usb snapshots, if u wish fully fledged backups of your SSD

#

i am too lazy for clonezilla, i just backup stuff to git repos + my own server will be using probably

tulip vortex
wise forge
#

plus due to paranoia turned on encrypting option ๐Ÿ˜… on this partion

#

so my OS if brick it, will be hardly reconverable

#

i probably should stop using encryption of a drive for home PC

tulip vortex
tulip vortex
wise forge
tulip vortex
#

Also i have another question:
i noticed that the python installed on my linux machines, all had a ton of packages installed. does that mean some system packages use pip packages?
in my last os, i installed a lot of pip libs globally. is this dangerous? should i avoid installing new pip packages globallly as much as possible?

(I currently plan to use venv on all of my ongoing projects just to be on the safe side)

wise forge
#

i recommend never touching it except for running without libs

#

i don't install system level pip even

#

just install python3-venv

#

and create venvs each time if u need python with libs

#

i created for me global venv for a user in addition ๐Ÿ˜ to have installed "globally" pip packages

#

if u will uninstall smth in global system python, u can break OS (all GUI will fall down at least)

lapis cloud
#

my last os, i installed a lot of pip libs globally. is this dangerous?
I would say yes. In fact, in my system you don't even get to use pip globally by default; you need to opt in into it knowing that this may screw up your apt-managed installation.

#

(I use pyenv instead, and leave the system python managed only by apt)

wise forge
#

i tried pyenv before but did not like that cause it touches my shell in weird ways that not worked in all usage cases i need.
I prefer approach with venv as more controllable alternative

#

i can install python3.11-venv specific python version venvs and create necessary python version venv if i need

lapis cloud
#

sure, using venvs works fine too - I prefer to also use pyenv because it lets me to also change the python version.

wise forge
tulip vortex
tulip vortex
#

i remember in one of my old distros i had to use python3-pip instead of pip

#

pip was disabled

#

this way I had to go root to make changes

lapis cloud
lapis cloud
# tulip vortex is removing pip from path a good idea?

well, I just don't have it in the system python:

โฏ pyenv shell system
~ via ๐Ÿ v3.10.12 
โฏ pip
Traceback (most recent call last):
  File "/home/rept/.local/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
~ via ๐Ÿ v3.10.12 
tulip vortex
#

for example, packages like tensorflow are massive

#

lets say i install tensorflow in venv1

#

i need it in venv2 too

lapis cloud
#

Ah, I see wht you mean. pip should automatically cache downloaded wheels globally.

tulip vortex
#

i want to install it in venv2, i dont want to download it again, so i want to use venv1 as source

lapis cloud
#

so i want to use venv1 as source
not a good idea; packages may run all sort of things when they are installing. Reusing the wheel is the reliable way, and pip should do that already.

#

(you could try just copying the relevant folder, but it can cause assorted weirdness)

tulip vortex
#

if i delete it, will my venvs stop working too?

#

hmm i dont think so

โ”Œโ”€โ”€(pickleใ‰ฟbizness)-[~]
โ””โ”€$ cat /usr/bin/pip
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
    sys.exit(main())
                        
lapis cloud
#

Delete what, pip? Maybe, and I don't think just deleting it is a good idea anyway.

tulip vortex
#

it will still be accessible via python -m pip I think,
but maybe some system packages except it to be accessible via pip command only?

#

also what is this?
/usr/share/man/man1/pip.1.gz
is this where the instructions of the manpage are held?

lapis cloud
#

"whereis locates the binary, source and manual files for the specified command names", so sure

#

(for just searching in PATH one can use which)

rain canopy
#

hello folks

idle heart
#

what's the difference between the diff and patch?

as I understand :

  • diff is the process of comparing the files and it creates the patch to show it

  • patch is the result of the diff, which can be used to get from the file1 to file2 (given that those files where compared with diff)

but from the freecodeacademy, I have read that: " A patch is an extension of a diff, augmented with further information such as context lines and filenames", which doesn't fit the above description I gave... Maybe they meant that the patch is the extension of the output of the diff, rather than then diff itself..? I would appreciate the elaboration on this part.

median garden
#

if used as nouns, i would understand diff and patch as diff having only the changes done to files, and patch having also metadata about the change (who, when, etc). so basically the difference between git diff HEAD~ and git format-patch -1 HEAD

if used as verbs i understand them as diff being finding the change X between files A and B, and patch applying change X to file A so it becomes file B

idle heart
median garden
#

which things

idle heart
#

Is patch = diff + metadata?

idle heart
median garden
#

run the 2 commands i sent on any git repo, it'll be better than my explanation

#

actually lemme send a screenshot

#

diff on the left, patch on the right

idle heart
#

Im not understanding the patch part in the right :(

fickle granite
#

"patch" is a sort of outdated word that was relevant in the early days of git. I don't recall anyone using that word for a long time now.

median garden
median garden
#

that's my interpretation on diff vs patch

#

idt it's very relevant anyway, nowadays the only people using patches are mostly people working via git-send-email

#

like kernel devs

idle heart
#

I have come to this conclusion so far :

  • git diff: actual command that compares files. It outputs their differents as patch or in some other, older format which doesn't have metadata
  • git patch: file which contains difference generated by diff. This file itself is used as "instruction" when applying changes
median garden
#

hmm

#

git diff compares revisions, it can have multiple files

#

i would say that git diff lets you recreate the changes, but git patch lets you recreate the whole commit

#

e.g. if you send me a patch and i apply it to my repo, it will be your name in the commit log

#

but if you send me a diff idk who to attribute the change to

idle heart
#

Dif = generator
Patch = output
Isn't that right?

median garden
idle heart
#

Shit

idle heart
median garden
#

idk who said that lol

#

lemme try to explain again from scratch, i feel like i did a lousy job the first time

#

diff/patch is an algorithm for working with text. diff means to find the set of differences X between file A and file B, and patch is to apply a set of changes X to convert file A into file B.

a diff generated with the unix tool diff could look like this for example (green lines are "inserts", they exist on the right file but not on the left file, and red lines are "deletions", so the opposite)

#

if i store the diff in a "patch file", and apply it, file A becomes the same as file B and they no longer have any diff (they are the same file)

#

this is a paradigm for working with text and not necessarily a git thing

#

however, diffs are a natural way of working with git so people use them often (they were more common in the past)

median garden
#

but if you want to be able to recreate a commit, you need some extra metadata like the name+email of the guy who made it. for this you could use git format-patch for example, which not only generates the diff but also adds an email header looking thingy with the missing metadata

median garden
idle heart
#

Ohhhhh recreate it completely

#

Not just git diff with 2 commits

median garden
#

yes exactly

#

with a git diff you can get the same code as the guy who made it (convert code in repo A to code in repo B), but with git format-patch you basically have his commit and can give him credit for the change too

idle heart
#

Nice, so patch is like an extension of diff with metadat for recreating commit from scratch

median garden
#

yea

#

the kernel usually works using this patches, so if you view the git log you often see stuff like this

#

(random guy) authored but torvalds committed

#

which means random guy sent the patch but the commit is not actually from him

#

in fact github even lets you see the .patch if you add it to the end of the url

#

(equivalent output of cloning the repo and running git format-patch ff5..)

idle heart
median garden
#

i think patch used as a verb means to apply because that's what the unix tool patch does

#

it's my mnemonic ig, im "patching" a file

idle heart
median garden
#

unix patch is more or less git apply

idle heart
#

Oh okay

median garden
#

from git docs

idle heart
#

Damn Linus Torvalds for naming git patch as git patch

hexed dove
#

@idle heart Please do not use toxic language.

fickle granite
median garden
#

toxic language wtf

#

lol

median garden
#

not necessarily a weird format of a patch file

idle heart
#

I woke up and chose toxicity, my bad

fickle granite
#

I'd hope that "patch" would accept the output of "git format-patch", but don't know; it should be awfully easy to try it and see, though.

idle heart
median garden
#

never tried it before

fickle granite
#

so now wcasa knows part of the answer

median garden
idle heart
#

But there clearly were patch and diff before

median garden
#

i assume there's been a few iterations of them, but GNU diff/patch is the only mainstream one that has survived until now

idle heart
#

Oh okay then

#

Thank you for clarifying everything ๐Ÿซ‚

median garden
#

apparently BSD calls them diff files rather than patch files, interesting

median garden
idle heart
#

You have saved me, man

main olive
#

Is unix something i should look into learning if i plan on becoming a harfware engineer focusing on hardware architectures?

fickle granite
#

dunno. Find an actual hardware engineer and ask them?

rotund girder
main olive
rotund girder
#

Noted I've only been on 1 HW company. So it might differ between companies.

main olive
main olive
barren temple
#

heya

#

can i ask a few questions about linux

#

Well, I will do so without permission.

#
  • Getty grabs TTY, starts up and hands the TTY for bash. There are no stdin/-err/-out for Getty? They're shell thing?
  • What about pty, do they need tty? Ik they have master and slave, but that's about it. I think master gets what is written to slave? And vice versa? And do terminal thing.
  • What is this terminal thing? It does have ansi color codes (important), but what is terminal interface? Show stuff on screen?
  • Does Xorg hook up with a TTY and draw stuff on screen? Why are ptys needed? To support the plethora of terminal interface apps? Any other reason?
median garden
#

i sadly cannot answer, but if you figure it out i'd be interested in knowing too

#

from my very limited TTY understanding, they are deeply cursed and riddled by historical baggage

quaint tulip
median garden
#

i meant that when he wrote git there wasn't a tried-and-tested standard so he came up with a few of his own. what i said about not being many VCS seems to be wrong tho, mb

quaint tulip
#

cvs was very much tried and tested, and svn was seen as an improvement on cvs. But he took things in a different direction. In those systems you would checkout a file to modify it, you didn't clone the repo locally. Git is about cloning everything locally. If you have a big monorepo, this can be a pain, but for a manageable size of repo, I think its better.

onyx fossil
fickle granite
#

I used to use svn, way back when. I was happy with it until they introduced merging (it didn't have it for the first few releases!)

It was so complex that the documentation, which was otherwise outstanding, said, in effect, "don't even try to understand how merging works".

That was the beginning of the end, for me

rotund girder
#

Although those are still documented as "experimental" I believe.

quaint tulip
fickle granite
#

never learned "switch" or "restore" because they're so new ๐Ÿ™‚

torn geyser
#

Eeeh. More commands to learn...

light gorge
#

Not much to learn for switch. I think it's self explanatory. git switch some_branch ๐Ÿ™‚

magic sentinel
#

okay guys how do i poetry update using my venv?

#

in linux VPS?

fickle granite
#

I'd think you'd just type "poetry update". Did you try that?

magic sentinel
#

like, i wanna do poetry add requests

#

into my venv

#

but witohut knowing i can't

#

how do i acess my service without having to navigate through files?

fickle granite
#

dunno what you're talking about:

  • you don't need to know where the venv is to use poetry
  • you can run poetry env info --path to find out
#

why do you say you "can't" do poetry add requests? What happens when you try?

magic sentinel
fickle granite
#

how are you starting your service?

magic sentinel
#

so i assume that requests didn't installed in the correct venv

magic sentinel
fickle granite
#

what exactly are you typing?

#

I don't know what "from .cache" means

magic sentinel
#

the path for virtual env

fickle granite
#

what exactly are you typing?

magic sentinel
#

.cache is where my venv is located

fickle granite
#

what exactly are you typing? (this is the last time I'll ask)

magic sentinel
#

i didn't got what you mean, i'm trying to respond, i have no idea what i'm typing

fickle granite
#

how does your service start? Do you just raise your eyebrow and it knows what to do?

#

Is it controlled by "systemd" or something?

magic sentinel
#

systemctl start (my service)

#

yes it is

#

i use systemd

fickle granite
#

ok, then paste the .service file

magic sentinel
#

the problem is finding the sysctl file

fickle granite
#

...

magic sentinel
#

i don't know where my service file is

#

i'm lost

fickle granite
#

mine are in /etc/systemd/system/

#

here's mine ```

This script is for "systemd" (found on, e.g., Ubuntu 20.04 "focal")

sudo systemctl start teensy

sudo systemctl status teensy

sudo systemctl stop teensy

journalctl -f -u teensy # tails the log

Before installing this into /etc/systemd/system/, check:

- the user teensy exists and has a home directory

- the git repo is checked out at /home/teensy/shorty

- you've done "just flavor=prod runme", to run the tests, create the .venv, static_root, &c

[Unit]
Description=Teensy URL shortener
After=network.target

[Service]
User=teensy
Restart=on-failure
RestartSec=1
StartLimitBurst=5
StartLimitAction=none
Environment=DJANGO_SETTINGS_MODULE=project.prod_settings LANG=en_US.UTF-8
WorkingDirectory=/home/teensy/shorty
ExecStart=/home/teensy/shorty/.venv/bin/gunicorn project.wsgi --bind 127.0.0.1:8000

[Install]
WantedBy=multi-user.target

#

look at the ExecStart (the 4th-to-last) line

#

see how I spell out the path to the venv? You can do that too (once you run poetry env info --path to find out where it is)

magic sentinel
#

this is mine

#

i need to execute this poetry to install requests

fickle granite
#

I'd cd /home/debian/RP-Utilities; sudo -u debian poetry env info --path to see where the venv is

#

and in the future set the environment variable POETRY_VIRTUALENVS_IN_PROJECT to true to avoid this confusion ๐Ÿ™‚

magic sentinel
fickle granite
#

ok then sudo -u debian /home/debian/.local/bin/poetry env info --path

magic sentinel
fickle granite
#

ok there ya are

#

Sorry, I should have said: at this point I would guess that sudo -u debian /home/debian/.local/bin/poetry add requests will work.

magic sentinel
#

didn't worked

fickle granite
#

you added a . before home

#

you gotta be careful when you type

magic sentinel
#

well, you typed that but okay

#

still didn't worked:

#

gotta try a thing here

fickle granite
#

you're still adding an extra .

#

you realize that the letters between the / represent names of folders, ya?

#

and your home folder is named home

magic sentinel
#

okay it seems it was already ther,e but i don't know why my service keep saying that the library was not found:

fickle granite
#

not .home

#

ok try poetry install. I'm not gonna spell out exactly how to type it; you can figure that out

#

if that doesn't work, I'm out of ideas

magic sentinel
fickle granite
#

did it work?

#

can't tell from that output

magic sentinel
#

yea it's working

#

ty

#

offby

fickle granite
#

next time use that environment variable

#

that puts the virtualenv right where you can see it

magic sentinel
#

yeah, i will try

#

the problem is remember the enviroment

#

variabler

fickle granite
#

well if you run into this same problem two or three more times, I predict you'll have no trouble remembering it ๐Ÿคฃ

summer coyote
#

would this be the right channel tfor ubuntu realated help

#

im getting the erorr RuntimeError: cannot locate package 'debian' associated with metadata

#

while running a bin file i compressed from nuitka

shut estuary
main olive
#

how do i set up daphne, are my settings off?

median garden
#

the service is crashing, so read the logs

#

journalctl -fu daphne for example

main olive
median garden
#

that change seems very dubious to me lol

#

what do the logs say?

main olive
#

new change same error

main olive
median garden
#

man you need to make an effort into understanding what the errors are

#

you told me the other day you didn't want to do that because you had limited time. you are well past the time it would've taken you to set this up if you were willing to read the errors...

#

this line looks pretty self explanatory

#

you should check where the python binary really is

main olive
#

but i do not know which directory that does exist i have to use

#

for example /home/ec2-user/tsupdate/thought_sync_django-channels/ exists

#

but is it /home/ec2-user/tsupdate/thought_sync_django-channels/thought_sync or /env/bin/python?

median garden
#

i assume you have a venv with your python environment, and you want to use that python

#

so when you activate the venv, where is it?

main olive
median garden
#

and what happens if you do which python after activating it?

median garden
median garden
#

put that in execstart

#

i would replace ~ for /home/ec2-user too, in case the service is not running as the same user

main olive
#

so ~/.local/share/virtualenvs/thought_sync_django-channels-XuVEKyh-/bin/python?

median garden
#

yes

main olive
median garden
#

sorry but i dont wanna spoonfeed you further. good luck

main olive
#

ok i think this is it

#

i am going to systemtl daemon-reload

#

and restart daphne

#

gosh darn it!!!

#

what the heck am i missing? did i delete group=ec2-user?

main olive
#

yay!

#

wait new problem

#

now i need redis to work

#

this should be easier

#

I want these redis settings match these daphne settings:

[Unit]
Description=Redis In-Memory Data Store
Documentation=http://redis.io/documentation
After=network.target

[Service]
User=redis
Group=redis
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/bin/redis-cli shutdown
Restart=always

[Install]
WantedBy=multi-user.target

[Unit]
Description=Daphne ASGI Server
After=network.target

[Service]
User=ec2-user
WorkingDirectory=/home/ec2-user/tsupdate/thought_sync_django-channels
ExecStart=/home/ec2-user/.local/share/virtualenvs/thought_sync_django-channels-XuVEKyh-/bin/daphne -b 0.0.0.0 -p 8001 thought_sync.asgi:application
Restart=always

[Install]
WantedBy=multi-user.target
#

what is the /usr/bin/redis-server?

naive basalt
#

It is the path where redis-server is installed which redis-server should give you the same path specified

main olive
naive basalt
main olive
naive basalt
#

what does it say?

main olive
naive basalt
#

can you please restart the service and check status?

main olive
#

next step

#

this should connect but is not

naive basalt
#

i'm not good with DNS sorry

naive basalt
#

@main olive did you solve the issue

main olive
#

new methods of trying however

naive basalt
#

Are you hosting this server

#

Is yes, how?

main olive
#

EC2

naive basalt
#

Did you try pinging the server?

#

Does it give response?

#

Yes it is available

#

I see nginx running but there is no UI

main olive
naive basalt
#

Is the nginx listening to your API

main olive
naive basalt
#

Am i correct

main olive
#

that is the domain

naive basalt
#

Please check your dm

green iron
#

Just installed nvidia driver. And now my ubuntu gets stuck on boot. It opens normally when I boot with older kernal version. How do I fix it ?

ember quiver
eternal nimbus
#

!ban 1274102734345474132 you can find somewhere else to troll

shy yokeBOT
#

:incoming_envelope: :ok_hand: applied ban to @gaunt pollen permanently.

uncut prawn
#

Is there a way to track each file that a Python program opens? Monkey patching/decorating open for example?

spark mulch
#

(although that won't give you filenames)

rotund girder
#

@BC Why do you want to know? Just of curiosity?

#

And what do you mean by open? open or import as well?

shrewd stratus
median garden
#

Probably better to use strace (instead of /proc/self/fd I mean, the audithook seems like the best overall)

past sluice
#

How do I make systemd service pause the booting when waiting for user input?

#

to change system hostname

#
#!/bin/bash

# Create a temporary file for storing the hostname (avoiding /tmp)
OUTPUT=$(mktemp)

# Use read to prompt for hostname (works without dialog)
read -p "Enter your desired hostname: " hostname

# Check if user entered anything
if [[ -z "$hostname" ]]; then
  echo "No hostname provided. Exiting."
  exit 1
fi

echo "Setting hostname to $hostname!"

# Set the hostname using hostnamectl
hostnamectl set-hostname "$hostname"

echo "Hostname set to $hostname."

# Clean up temporary file
rm -f "$OUTPUT"```
#
[Unit]
Description=Set hostname interactively

[Service]
Type=oneshot
ExecStart=/usr/local/bin/set-hostname.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target```
#

it didnt take input on boot and proced to login screen

rotund girder
#

Anyone doing nix with pylsp?

fickle granite
#

I might be, lemme check

#

yeah I've got lsp-mode loaded, and (occasionally) hack on Unix

#

mostly MacOS, but that's maybe sorta Unix

rotund girder
#

I was able to improve my situation by adding packages from nixpkgs:

  • python-lsp-server
  • python-lsp-ruff
  • pylsp-mypy
#

I had some issues of my pylsp only showing diagnostics from pylint. But after the above packages I get diagnostics from ruff and mypy as well

fickle granite
#

I think I tried python-lsp-ruff but couldn't figure out how to make it do anything

rotund girder
#

It automatically picks up diagnostics using ruff

fickle granite
#

I don't want more diagnostics :-). I probably want fewer.

rotund girder
#

So if you can use ruff to get warnings from the command line I guess you should get them in your editor as well

#

Hehe

#

I want to see all the kinds thqt our CI picks up

fickle granite
#

what I really want is for C-M-\ to properly format the region, but that has never worked. I'm tempted to write my own function that simply hits TAB on each line in the region.

rotund girder
#

Formatting I don't care about. Linting I care about.

fickle granite
#

otoh I've got a hook set up that invokes ruff's formatter on the file when I save, so (if there aren't any syntax errors) simply saving will reformat the entire file.

rotund girder
#

Yeha that's the way to it if you want it.

fickle granite
#

I get some linting messages, and they are helpful -- like "you assigned to this variable but never use it anywhere". But I can never tell which tool is emitting those messages.

rotund girder
#

๐Ÿค  Yeha

#

From pylsp it tells what the source is

#

So I can see pycodestyle/ruff/pyflakes/pylint etc

fickle granite
#

I regularly uninstall pydocstyle because its messages are so freaking annoying, and I know no other way to shut them up.

rotund girder
#

Regularly? Does it install itself back into your system? ๐Ÿ˜…

fickle granite
#

what does "From pylsp it tells" mean? What do you do to see those?

fickle granite
rotund girder
#

I thin we configure our pyproject.toml to ignore most/all docstring rules

#

Aha

#

I rarely upgrade, because it should go through IT to create a module. And every upgrade brings along a risk of finding new bugs or deprecations that need fixing :p

fickle granite
#

I like living on the bleeding edge, apparently

rotund girder
#

I understand the feeling though ๐Ÿ˜

fickle granite
#

I'm not upgrading dependencies of my project; instead I'm upgrading tools that are globally installed on my laptop.

#

not quite brave enough to upgrade to the current MacOS beta, though; been there done that

rotund girder
#

But you must be able to freeze bqn/blacklist pydocstyle?

fickle granite
rotund girder
#

I see ๐Ÿ‘

fluid warren
#

@rancid aurora i finally successfully compiled gentoo

#

would highly recommend for learning the linux system

rancid aurora
modern ruin
#

Can someone please help me I cannot boot into my ubuntu please ping me

pliant quest
#

Could someone who has a debian computer run a code for me ?

i've got a problem where my code works on windows but not on the debian server and i would like to see where is the problem is coming from, the original code (that i didn't wrote), or my code (modification of the first one)

rotund girder
#

A cumputer u say. Python code?

pliant quest
#

required modules are pillow and nest_asyncio as far as i remember

fickle granite
#

I do this sort of thing all the time

wise forge
pliant quest
#

i'm learning about wsl2 and it seems lighter

wise forge
# pliant quest yep that's a good idea, i had virtual box once but i think i uninstalled it but ...

Imagine amount of feedback time loop to do it by external humans.

  • You ask them (you wait...)
  • they accept it and ask for all instructions how to run it (more time consumed)
  • you receive some obscure error not related to your problem (you fix it by telling instruction in voice, more time consumed)
  • you iterate problems til your problem appears (if u ever reach that point, because time consumption for all iterations already happened more than 10 times rounds between you and other person, and finding person willing to do such commitment is very unlikely)
    P.S. plus many people would be hesitant to run it, at the risk of encountering written malware.
  • And then imagined also one person dropped in the middle, and u have to do it again with another one ๐Ÿ˜
#

On another hand if u configure for yourself to run it locally -> it will be a very rapid to see and fix thing. Super short circles to reach destination

pliant quest
#

time to install wsl