#unix
1 messages ยท Page 12 of 1
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
go into your terminal and type
cd
PS1="Fluffy"
so i believe it will go back if you exit the terminal since you never edited the bashrc
done
try typing
cd
then do it again
did that
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
ok unset removes the entire thing
and no [user@lab]
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]$")
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
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
๐ฅบ
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
however i can explain this
this is bash code
its the programming language that commands on the linux terminal use
That seems like a horror movie
its like windows powershell for linux
i have done bash code before
but like basic shit
do you know what .bashrc is
is it a bash file that starts running when you connect to a server?
so .bashrc is where things like command aliases go or stuff to edit the terminal
I get the aliases part, wdym "stuff to edit the terminal"
yoooo like that picture you have?
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
ah dw about that lmao
so did we end up creating an alias
not yet
well yes but if its not in the .bashrc file it wont save
yah I had to create an alias in a bashrc file once that way I would have to do the whole command to connect to teh digital ocean server
so my alias was like DO = "i forgot"
and then when I typed DO, I would connect
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 )
lemme do that rn
and you dont have to use nano you can literally use a text editor if you want
aight I see teh bashrc file
like xed
I use vim
okay explain
okie we can be frenemies for now
so what did you edit in the bashrc file
to make it show "FLUFFY"
I am not that much of a nerd to understand this
maybe some day
let me test the alias out rq to make sure i know what im doing
okie dokie < 3
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
lmao
so when you did:
go into your terminal and type
``cd``
``PS1="Fluffy"``
what did PS1 = Fluffy do
so PS1 is the name of the variable that puts the[user@name]
so you are just saying change user@name to "fluffy"
gotchya, how come I don't see PS1 in the bashrc file?
gonna be honest no idea where linux gets it when its not defined
but
we can redfine it
got it
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
so lemme set up aliases to activate and deactivate fluffy then
oh perfect
so if you put that in ur thing, go into terminal type source .bashrc (to re load the bashrc config) and try it out
is color good or bad idk
its pink
im just fruity asf so
alias revert_fluffy="export PS1='[\u@\h \W]\$ '
if you want no color on the normal
YOOOOO
the color is so fucking fire
wait could I make it purple
๐ฅบ
Purple es my favorite color
yeah 1s
I also want fluffy to be purple < 3
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
uh it made my thing wierd
instead of name@server
it is
[][[]name@server []~[]]$ []
there was some purple, yeah!
I will exit and reconnect to server
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
lightening bolt?
im not sure thats differnt 1s
you don't have to keep on saying 1s haha
kinda cold
I need this ๐ฅบ
so
try running this outside of ssh to see what happens
oh okie okie
wait are you on linux outside of ssh
or are you just sshed into linux and doing everything there
yepp
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
mayhaps
now, I just newly ssh'ed and the lightening bolt thing first
so just make sure to update ur bashrc and you should be good to go
the issue is that it isn't purple when I first login
just a warning ricing your linux is a dangerous path to go down (you cant stop)
like I have to activate fluffy first
hm
is this a good thing or a bad thing lmao
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
instead of lightening bolt it just says:
:zap: blah bah
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]'
oh to clarify, this would be for the fluffy mode
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 : )
no problem bro
i made mine show my current pyenv version (or if im not in pyenv)
wowwww
that's actually pretty useful
yeah fr
Yo, which is better - screen or tmux?
I was recommended to install either and I am not sure which one I should choose
Ngl I use neither cause Idk what they are and never had a reason to look Into them
you're gonna wanna learn tmux, my friend
they let you keep an ssh connection open more or less forever, even if you turn off the client computer
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
so I was learning tmux and then they started adding some neovim extensions
should I move from vim to neovim? What exactly is the difference
neovim is a fork of vim that has been adding big features faster than vim. It's got first class support for scripting in Lua rather than VimScript, and a large ecosystem of Lua plugins. Probably most importantly, it has first class support for the Language Server Protocol built in
That is a lot of information ๐
So is neovim the "improved" version of vim?
ie. should I move to neovim?
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
gotchya
i will look into it
i feel like having a few tabs on my gnome terminal is easier to manage than say multiple windows in tmux
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
fwiw, screen isn't any easier
yep that's a pain
sometimes the mouse does what I want; sometimes it doesn't ๐คท
yeah
for me it's something like C-z [ M-โฌ๏ธ
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
๐คท
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
yeah thats what im reading and i cant find a good reason to commit lol
TIL, time to use tmux on my rpi now
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)
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
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
but lord have mercy using a CLI is a nightmare because why do i need to use keybinds to SCROLL UP
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.
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 ๐
i only care about detaching from sessions
so dtach works for me
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.
@neon depot This but without the .fish
What does .fish do??
I assume it was a typo by @sonic pendant
no, virtualenv ships with a fish-compatible activator
and so does python -m venv
yes, not a typo ๐
Ah, TIL, thanks
The modern vim plugin ecosystem has moved on to neovim because you can write them in lua instead of vimscript
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
i prefer simplistic approach of installing multiple python3-venv, python3.10-venv and etc
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
oh ok but i was asking so u dont really have packages installed on global python..?
every packages are installed on venv
no. i don't touch global python at all, because touching system python is direct path to breaking OS that is actually needing system python to function
for global python i have in user home .venv created for my "global" packages
and have created linux aliases redirecting to this global venv
but in windows i used to do that
well. this is bad approach. breaking OS once helped me to remember forever not doing that
okh ill make venv and install then
at windows python is installable smth that is not used anyewhere
at ubuntu default python is system python, used in ubuntu
see the difference
oh yes got it
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
๐
Windows doesn't require Python to run, Linux does
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
https://github.com/tmux/tmux/wiki/Getting-Started#configuring-tmux
apparently the tmux config should be at ~/.tmux.conf, not the config directory, though the man page says -f <config> should have worked too...
what does your config contain?
also, does manually re-running the config work? i.e. C-b :source ~/tmux.conf
I closed terminal and reopened it
lemme copy paste it
closing the terminal for me doesn't do anything, but re-sourcing it does
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}"
lemme try this!
ran source ~/.tmux.conf
when I do tmux, none of the conf applies
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
wait how did you know to do that?
thank you so much < 3
shrug, i just read the official wiki
how do i run the latest version of python 3.12
Install it and run it.
If you need a more detailed answer, ask a more detailed question.
I googled it for you: https://ubuntuhandbook.org/index.php/2023/05/install-python-3-12-ubuntu/amp/
Personally I'm inclined to use a Docker container for most situations like this. DevContainers on VSCode makes it pretty easy
thank u
how do i setup remote ssh to a server
kind of hard to simply answer that; there are a lot of steps
do you control the server?
yes self hosted server
have you got sshd running on it?
yeah
the things that confuse me is the port forwarding
well try without port forwarding at first
lemmi find the server public ip
it just get stuck i think
nvm got "Operation timed out"
ok so networking isn't properly set up
what kind of server is it -- is it e.g. an AWS EC2 instance?
ubuntu
its my own server
yes, but is it a physical machine that you control, or is it a cloud server?
physical machine that you control
thsi^
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
oh ok
there seems to be 2 diff port forwarding called local and remote
im not sure which one to do
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
gotcha
i'll try to figure the networking out
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
What do you need help with? I've never done this, but from reading the spec it looks like you need to start by sending a single byte to specify the byteorder, and then report your protocol versions (probably need to look up sane ones) and authorization (which it seems can be empty).
I'd think if you cared about your sanity you wouldn't do this at all, but that's just me
sorry for the late reply but yep, well I was just asking if anyone has done this before, but I don't really have a specific question right now, thanks for the concern tho
I haven't done it personally, but https://hereket.com/posts/from-scratch-x11-windowing/ would probably interest you. That was on Hacker News a few weeks back
Oh wow thank you! I just did a little skimming and this is exactly what I need!
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
What are all the specifications for a os to be considered unix based?
There's several answers to this. There's the POSIX standard, but even Linux is only "mostly POSIX-compliant". You can also look at what the actual heritage of an OS is; whether it derives directly or indirectly from UNIX.
Got it
or: there aren't any
next question
๐
it's not both precisely defined and widely-agreed-upon
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)
if you use WSL, screen/tmux/dtach/etc. will work in it as well
not sure about actual Windows
Nah.. I don't wana go their, I am currently purely working on windows
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
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?)
I use wezterm for that - it works fine on Windows, including the multiplexing, and including through an ssh connection from a linux system.
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
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
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.
tmux?
That's in Linux
Hmmm this seems interesting
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?
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)
see:
someone?
Try sixelconv --body-only
spits bunch of characters but no imageโฆ
hmm. idk why even yesterday it was working like that cuz today no issues ๐ค
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
don't think it's gonna be easy
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
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
I mean tbh its whatever works to make it so users dont have extra steps
polkit sounds like it could do the trick
I'll have a stab at it
the installation idea seems promising too
would you mind expanding a little bit more on that?
If security isn't a concern, there's options like these too: https://askubuntu.com/questions/814471/how-to-run-desktop-icon-from-sudo
okok ill look into this as well thank you for your help
well, the typical way an Ubuntu user installs software is to run sudo apt install whatever
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
Idk how I would do this
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
not getting output
i wish i would have his talents in baiting people ๐
try to start with checking if u have python3.
which python3 will report it
python in linux systems is commonly known as python2
so u may be wishing python3 to use actually the desired one
python working in terminal but not in vs code
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
anyone know why this isn't working ?
Environment variables aren't global
They are per-process, and processes (by default) pass them to their child processes
idk what that is I was reading a book and it said this is how to make a global variable and I assumed that I'd use the variable on multiple terminals cuz my background of the definition "global"
To make a variable available to subprocesses
But yeah, I wouldn't call them "global" either
can you explain in it in simpler way ? sorry but I really don't know what that means
A subprocess is a process started by another process (its parent process).
For example, when export a variable in bash, any commands started from this bash instance will also see those variables.
Processes that aren't children of this bash process won't see it.
You can think of processes having a family tree. Every process* has a parent, and a process can have many children.
so if I exported a variable in a terminal and then I opened another terminal it should see the variable ?
like the first terminal lead the rest ?
Only if you open the second terminal from the first terminal
Not if you open it by clicking somewhere in your desktop environment, because then that is the parent of the new terminal
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?
Thatโs bc you need to change your directory to the file directory
Use cd to change to that directory or specify the full directory when running python3 test.py
My man, you ran cd after finding out with ls the test.py is in that directory
Why?????? 
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.

do you have known any tutorial for installation of vs code in ubuantu
sudo snap install --classic code single command in terminal, which i prefer to use
learn to google ๐
https://code.visualstudio.com/docs/setup/linux all options are described here
Just ask me
I can help you
Iโm a Mac user myself
Or you just just google it
It ainโt that hard
i am using Linux if you found any then share with me
Alr
you'll have to put that variable in your .bashrc if you want it to work everywhere
Hello! Who knows what this error is?
cmake is a program to build c/c++ programs
Which pip package is causing it? I won't check to see if there's any known issues with it, make sure you're not on the wrong version of Python, etc.
(could also be the thing is trying to build something c/c++ from sources, and there are no tools installed? Idk though)
pip install streamlit
Python 3.11.9
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?
android 12
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.
Yes, I understand that Android is far from the best system for such purposes. I just want to do it on my smartphone.
Did not help. The error is the same.
Not even a tablet but a phone? This sounds downright impossible. You could access a platform like Google Colab and do it there but it's not designed for such a small screen
Yes, exactly the phone. Phones are now powerful and are quite enough to use as a server to run a bot. That's exactly how I want to use it.
Sounds like you'll need to stick to packages that work on Android, or see if there's any workaround for this package but as offby1 said, that's a long shot
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)
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. :)

Successfully nerd-sniped me.
Hm.. try a pkg update first? It finds the package on my phone..
Where did you install termux from?
The version from the play store is horribly out of date..
Oh my God . I actually downloaded it from the play store....
Try it via F-Droid
Installed via F-Droid. The error is the same.
pip install -r requirements.txt
Did you do all the other steps? Can you install tur-repo now?
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
The error above? That's strange, it shouldn't need to build ninja and patchelf anymore if the installation succeeded..
The pip package is likely called python-pip. In any case: Does installing tur-repo succeed?
Yes, pkg install tur-repo installed without errors.
Try doing pkg install rust and then try installing streamlit again. I installed that yesterday as well, forgot to list it I guess
Yes, this helped install streamlit! ๐
But this command throws an error: pip install -r requirements.txt
Well, then figure out which package in requirements.txt fails to install
This?
That version of Matplotlib is over 3 years old... Can you try a newer one?
I'm not sure I need this library!
Is it listed in requirements.txt? You could try removing it
If it's a hard dependency for something else though, it will still try to install
No. You cannot remove dependencies there. They are very strict.
Does anyone know where to find the source folder in Android termux?
I don't follow, who is "they" here? It says you have Matplotlib on line 2 of requirements.txt and my suggestion is to delete that line and see what happens. It may still install Matplotlib if you need it, but will default to a current version
probably in site-packages? im not sure if the ones that dont finish compiling are there
try pip show pip and check that folder
Found the files๐
I install this and I have an error on the connections.
https://www.passivbot.com/en/stable/installation/
Can someone try this on Android? I tried it on Ubuntu and Windows, everything works. I'm trying to repeat it on Android ๐
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?
If you can boot with a different kernel then you can uninstall the bad driver
okay i try to remove all the nvidia driver but how do i know whihc is the right one? also is this something to do with kernal conflict?
I would undo whatever you did to cause the problem. If you don't know, I'm not sure if there might be some log message to let you know or if you'll have to guess
And yes, it is very possible that a given driver and a given kernel don't play nice together. You could just stick to an older kernel if that's easier
i changed it into this ? i hope this works
I'm having a bit of trouble finding what this GPU is, but it seems to be some old (~2014) mobile GPU, and quite possibly all of these drivers are incompatible with it.
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?
Yeah mine is GeForce 840 M
I think I installed v535 and that should have worked but it didn't
Although I could only boot into different kernel
why do we create virtual env for python for managing package conflicts while the Linux systems don't?
?
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
same as well. always using virtualenvs on linux ๐
i would not use system python for that
once i already destroyed OS by doing that
I mean, won't system packages conflict? such as apt installed packages?
why venv is not a general idea?
venv is general idea? what is general idea according to you?
I mean, won't system packages conflict?
never saw happening apt conflicts. but if it is concern for you, then use higher level of isolation. Docker ๐
It is capable to do more than venv. wrapping pip packages and apt packages too inside its artifact
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
thank you very much
I dont know how to use Docker yet
I dont have much web development experience
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]
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.
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.
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
docker is as much as... debian package for a web world
a way to easy launch/setup things
you don't have to convince me that Docker has benefits; I use it too
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
Ubuntu has gone to Snap which is basically the same idea
some distros are moving to this as default https://peps.python.org/pep-0668/
XDG Spec
5
11
3
I don't care
๐คทโโ๏ธ
https://github.com/coronasafe/care/issues/2301 it looks easy can anyone help me do it?
Seems like you could just use or modify an existing solution https://stackoverflow.com/questions/24718706/backup-restore-a-dockerized-postgresql-database
Same author
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?
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
ok so what I'm doing here makes sense then, switching from command to python
I'd recommend pathlib over os -- https://docs.python.org/3.12/library/pathlib.html#correspondence-to-tools-in-the-os-module
I'm too lazy to carefully read that screenshot.
This better?
"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
better as in smaller screenshot that you are not too lazy to read
ah well I read it
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?
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
ok but stat returns different information to ls -l
stat is more about timestamps
ok I don't know stat well enough, should be reading this https://man7.org/linux/man-pages/man1/stat.1.html
so with the right arguments stat will return the same info as ls -l?
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
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?
alas no, you have to pip install tabulate. But it's pretty slick.
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?
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.
Before I answer I have several extra questions
Is it for Desktop dev machine or for Server?
yes, please ask
If for server, then for Baremetal physical server or for Cloud provider rented server
my own desktop for personal usage.
i do programming and do my projects here, so if things break it is bad for me.
but no one else uses my os
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
@spark mulch
Generally software can do anything you could do manually.
in Android, it is possible to set permissions for apps, and they will not be able to do anything they are not permitted to.
is it possible to limit apps to do certain things in linux?
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
Sort of, but it's complicated. Check out firejail - it lets you limit what an executable can do, but the problem is that for each app you want to secure that way, you may spend a long time playing with settings to let the app actually work. It's not like the app tells you what capabilities it needs to operate.
is it possible to limit apps to do certain things in linux?
there is an option to configure running them from separate dedicated user with no root rights also, but bothersome, and issues with GUI/audio/and even other random things to ensure they work fromsu - user
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 ๐
is a 16GB flash drive enough for my os? ( I dedicated 40~50GB for / partition)
also, is the conventional way of securing the os with snapshots, getting backups from system packages, or the user packages too?
for test drive i guess yes, for every life of a modern professional dev? no.
Also USB flash is slow as hell. SSD is the best ๐
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
are there update channels for linux distros?
for example flutter has stable and dev channels.
if so, how do I check with channel my distro is running on.
and how do i explicitly say that I only want to upgrade my system to LTS versions only.
also, is doing apt upgrade the same as upgrading the kernel?
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
I do have an SSD M.2 pinned to my motherboard, are you talking about some portable SSDs?
nice, use SSD
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
I mean, I had two options while installing the os.
one said that put everything in one partition.
the other said use seperate partition for /home
the last one said use separate partition for /home ,/var and /tmp
i chose the third one.
so now, my 500GB ssd is divided into 4 partitions I think, and /home takes about 440GB
ah. i did not bother with all of it, just using single partion for all.
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
what happens if my partition that is dedicated to / runs out of space?
are there ways to expand its size?
are there some tweaks to this?
I mean as long as you don't keep stuff that puts people to jail its fine right? lol
are there ways to expand its size?
if u have extra space on disk, u can i guess?
Otherwise u can add whatever extra disks u wish and mount them to /any_place even later
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)
all had a ton of packages installed. does that mean some system packages use pip packages?
yes, ubuntu/debian distros have System level python installed and specific pip packages in it for OS functionality
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)
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 usepipglobally 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)
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
sure, using venvs works fine too - I prefer to also use pyenv because it lets me to also change the python version.
last time i wished updating global python by default before i update OS itself
I think i just installed newer python version and created alias for it for python3 of my user
otherwise updating global python for me is fine with LTSes upgrade ๐ they change default python to higher too
yes that what came to my mind to.
is there a way to install a pip package into a venv, from another venv?
that would be very handy, my pocket would love this
is removing pip from path a good idea?
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
Not sure what you mean by that. You could programmatically create a venv and install there, but why?
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
for example, packages like tensorflow are massive
lets say i install tensorflow in venv1
i need it in venv2 too
Ah, I see wht you mean. pip should automatically cache downloaded wheels globally.
i want to install it in venv2, i dont want to download it again, so i want to use venv1 as source
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)
i do
โโ$ whereis pip
pip: /usr/bin/pip /usr/share/man/man1/pip.1.gz
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())
Delete what, pip? Maybe, and I don't think just deleting it is a good idea anyway.
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?
"whereis locates the binary, source and manual files for the specified command names", so sure
(for just searching in PATH one can use which)
hello folks
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.
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
But what are those things themselves??
which things
Is patch = diff + metadata?
Patch and diff
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
Im not understanding the patch part in the right :(
"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.
it's basically the same as the diff + some more stuff on top
Yeah, pretty much
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
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
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
But the patch itself doesn't generate it
Dif = generator
Patch = output
Isn't that right?
check the pic, both commands are "generating" a changelog
Shit
Why the hell do people say this then
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)
git happens to have a few commands to make it easier. an equivalent of doing this on a git repo happens to be called git diff and git apply
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
this is what you see on the right of this screenshot (a header that has from, when, commit message, and then the actual diff)
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
Nice, so patch is like an extension of diff with metadat for recreating commit from scratch
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..)
So the reason why you think the verb patch means applying is because of the extensive use of patch as application of changes generated by it into the remote (and other) repositories?
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
So Unix and git's patches are different?
unix patch is more or less git apply
Oh okay
from git docs
Damn Linus Torvalds for naming git patch as git patch
@idle heart Please do not use toxic language.
I don't think there is any such thing as a "unix patch"
with unix patch i mean /usr/bin/patch on an unix system
not necessarily a weird format of a patch file
I woke up and chose toxicity, my bad
I have been using Unix for 40 years and didn't know that existed ๐คฃ
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.
Why did he do it? Is there some reason for it or just a weird naming by his part?
apparently it works yea
never tried it before
so now wcasa knows part of the answer
he named every git command like he pleased, but to be fair there werent many VCS or standarized names when he did
But there clearly were patch and diff before
i assume there's been a few iterations of them, but GNU diff/patch is the only mainstream one that has survived until now
apparently BSD calls them diff files rather than patch files, interesting
happy to help :D
Oh man, I've been getting those answers because of the context : i just asked about diff and patch, w/o specifying that it was git. I thought they would work similarly on unix and git
You have saved me, man
Is unix something i should look into learning if i plan on becoming a harfware engineer focusing on hardware architectures?
dunno. Find an actual hardware engineer and ask them?
My company prefers Unix, I prefer Unix. I'm not sure if tools are more compatible with Win or Unix.
Unix is fun, windows is pain.
For the actual development it's just
- Whiteboard
- Thinking
- Drawing
- Discussing
- Editor (whichever)
- Simulation
- Testing
- Waveform debugging
So safe to say itd be good to have on hand. Right on thank you
Noted I've only been on 1 HW company. So it might differ between companies.
Fair enough. Its just something i heard i might need to gain knowledge in, so i was seeing if anyone experienced in the field have made use if it
As for you, who do you think my comment was tailored to? Learn your place and get bent smh.
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?
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
Not sure if I understand you correctly but git came quite late. I've used CVS and SVN and even a bit of Perforce before I even heard of git. Linus did things his own way. I think there are good reasons to prefer git to cvs/svn. It is now the industry standard but that wasn't the case in 2000 or even in 2010, github was still a small startup.
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
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.
yes / checkout in git confuses me for this reason
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
I don't use checkout in git, I see it as a legacy command that has been replaced by switch and restore.
Although those are still documented as "experimental" I believe.
yep, legacy command, but for a while I was stuck with an ancient Linux OS and an ancient version of git. Switch definitely makes much more sense.
never learned "switch" or "restore" because they're so new ๐
Eeeh. More commands to learn...
Not much to learn for switch. I think it's self explanatory. git switch some_branch ๐
I'd think you'd just type "poetry update". Did you try that?
yeah, but i'm having a problem, i don't know where my venv is
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?
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 --pathto find out
why do you say you "can't" do poetry add requests? What happens when you try?
it installs normally, but when i start my service i still get the error of request being not found
how are you starting your service?
so i assume that requests didn't installed in the correct venv
i'm starting my service from .cache
the path for virtual env
what exactly are you typing?
.cache is where my venv is located
what exactly are you typing? (this is the last time I'll ask)
i didn't got what you mean, i'm trying to respond, i have no idea what i'm typing
how does your service start? Do you just raise your eyebrow and it knows what to do?
Is it controlled by "systemd" or something?
ok, then paste the .service file
the problem is finding the sysctl file
...
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)
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 ๐
ok then sudo -u debian /home/debian/.local/bin/poetry env info --path
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.
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
okay it seems it was already ther,e but i don't know why my service keep saying that the library was not found:
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
next time use that environment variable
that puts the virtualenv right where you can see it
well if you run into this same problem two or three more times, I predict you'll have no trouble remembering it ๐คฃ
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
how do i set up daphne, are my settings off?
this is good, i changed /user/local/bin to /ec2-user/local/bin, this is still wrong, what next?
new change same error
what directory does ExecStart need to be?
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
i understand the directory does not exist
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?
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?
what am i looking for?
and what happens if you do which python after activating it?
this is already after activating the venv
yes
well that's your python executable
put that in execstart
i would replace ~ for /home/ec2-user too, in case the service is not running as the same user
so ~/.local/share/virtualenvs/thought_sync_django-channels-XuVEKyh-/bin/python?
yes
what should the second part be?
you didnt do this...
sorry but i dont wanna spoonfeed you further. good luck
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?
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?
It is the path where redis-server is installed which redis-server should give you the same path specified
i installed redis6 do i have to make a redis-server, what does that mean?
Is the first service failing?
daphne service is running, redis is failing
what does it say?
can you please restart the service and check status?
how did that work? Thank you!
next step
this should connect but is not
i'm not good with DNS sorry
@main olive did you solve the issue
no still no idea
new methods of trying however
Did you try pinging the server?
Does it give response?
Yes it is available
I see nginx running but there is no UI
no
Is the nginx listening to your API
not sure the reverse proxy may be incorrect?
in harmonapp.org no
that is the domain
Please check your dm
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 ?
I googled it for you: https://askubuntu.com/questions/1353054/trouble-removing-nvidia-drivers
thanks let me check
!ban 1274102734345474132 you can find somewhere else to troll
:incoming_envelope: :ok_hand: applied ban to @gaunt pollen permanently.
Is there a way to track each file that a Python program opens? Monkey patching/decorating open for example?
On Linux it's easier: you can just look into /proc/self/fd
(although that won't give you filenames)
@BC Why do you want to know? Just of curiosity?
And what do you mean by open? open or import as well?
if you mean using open, you can add an audithook for the open audit event
You can get unlucky if you're sampling and a file doesn't stay opened for long
Probably better to use strace (instead of /proc/self/fd I mean, the audithook seems like the best overall)
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
Anyone doing nix with pylsp?
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
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
I think I tried python-lsp-ruff but couldn't figure out how to make it do anything
It automatically picks up diagnostics using ruff
I don't want more diagnostics :-). I probably want fewer.
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
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.
Formatting I don't care about. Linting I care about.
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.
Yeha that's the way to it if you want it.
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.
๐ค Yeha
From pylsp it tells what the source is
So I can see pycodestyle/ruff/pyflakes/pylint etc
I regularly uninstall pydocstyle because its messages are so freaking annoying, and I know no other way to shut them up.
Regularly? Does it install itself back into your system? ๐
what does "From pylsp it tells" mean? What do you do to see those?
Yes because I compulsively run pipx upgrade-all ๐
if I go a week without upgrading everything, I get itchy
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
I like living on the bleeding edge, apparently
I understand the feeling though ๐
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
But you must be able to freeze bqn/blacklist pydocstyle?
I dunno. Like I said, wholly uninstalling it is the one thing I know how to do, that works
I see ๐
@rancid aurora i finally successfully compiled gentoo
would highly recommend for learning the linux system
Defo will look into it. I think Ill do lfs first and then gentoo. Thanks for your help
Can someone please help me I cannot boot into my ubuntu please ping me
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)
A cumputer u say. Python code?
my bad i'm typing too fast XD
yes :)
required modules are pillow and nest_asyncio as far as i remember
I do this sort of thing all the time
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)
u could install wsl2, and run easily your code on debian (or ubuntu which is kind of same debian) easily from same filesystem on your local machine ๐
yep that's a good idea, i had virtual box once but i think i uninstalled it
but that's a lot of time and i thought this would be easier
i'm learning about wsl2 and it seems lighter
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
yep you're right never thought about it like that
time to install wsl