#unix
1 messages · Page 62 of 1
Until you work out how to get those extra files to enable your wifi
yeah okay
I'd google debian <name of stuff in that image> that should be good enough to find what you need
I hardly ever use a graphical package manager!
Aptitude, maybe…
Linux has come a long way. When I last used Debian I didn't get a graphical desktop.
how old are you guys?
15 here ✋
+1
last time i used was 2 yrs ago ( any kinda gui package manager )
what do you guys think of the crash course 2nd edition book for beginners?
it is a good book, you can ref if you are planning to
i started learning less than a month ago and so far ive been satisfied by how everything is explained
Also tried codewars aswell a couple days ago and i really like it
nice
i also did the same after completing and understanding the basic ... tried codewars ( reached 3 kyu ) then left
You got to san kyu, said sankyu and left? (Multilingual puns...probably doesn't work with this crowd)
ninjutsu
UK
okay
thats really nice
never thought id meet someone from bujinkan online :D
im from Macedonia btw
you can check www.bujinkan.koryu.mk
Let me have a look. I may have met your instructor, then.
Maybe not. I'll have to dig out the business card
try to find me on the site :D
Soon we will have guests from Turkey at our dojo
maybe you know Ercan
That name rings a bell.
how do i trigger my script when a new file is detected in folder
create a background listener .... which check if any new file is added
run that script in background and compare with old data
Sorry - should move off topic stuff off the channel.
? it was related to unix and python
please silver spoon me sir
import os
import zipfile
import threading
directory = '//home//hardman//archives//'
extractdir = '//home//hardman//extracts//'
def runit():
threading.Timer(1.0, runit).start()
# listdir returns a list of files in the directory
for filename in os.listdir(directory):
if filename.endswith('.zip'): # if the file ends with .zip
# join the directory and the filename
zippath = os.path.join(directory, filename)
zfile = zipfile.ZipFile(zippath) # open zip file
# extracts all files in the zip file to the specified directory
zfile.extractall(extractdir)
zfile.close() # close the zip file
os.remove(zippath) # delete the zip file
if __name__ == '__main__':
runit()
sex my luck worked
ugh no clue
anyway thanks alot even tho im dumb
the linux feature that your looking for is named inotify and there is also python libraries for inotify that you can use directly with your python code
also note that you don't need the double slashes, one slash will suffice in unix/linux and will work with your code
I'm not sure if this is the right channel, but I'll give it a shot: I've got a discord bot that runs on a VPS and I'd like for it to write its log files like the rest of the system's log files do: owned by the process user and the adm group... I have a systemd unit that runs the bot with the bot user and group (which is how other services like mysql do it), but it ends up creating the log file as bot:bot instead of bot:adm
there is this channel #discord-bots, just in case
It’s not really a bot question, though. More of a “I’m running this thing as a daemon and I want it to write a log file with these permissions and ownership”
yeah I noticed it though not sure if bot daemon has an option to setup user/group. If you are doing it manually, check step 4 - https://www.golinuxcloud.com/run-systemd-service-specific-user-group-linux/
how are you running it currently? you can chgrp the log file, or set an acl on the log directory/file that changes the group
systemd is an option as well, but i don't know if you want to use systemd
I’d rather not run it with elevated privileges
I thought about using a sgid on the directory so the file gets created with the right group, but I noticed services like mysql don’t run elevated and their log files are created with the right group, so I figured there’s a way to do it
I’m just running it with systemd as the bot user and group
yeah no i was not suggesting running the bot as root
Right, I didn’t think that. I meant running the bot as the bot user and the adm group as “elevated”.
No
ah
(None of the other service users are either)
can you show your service unit file? just so i can see
Will you be around later? I’m out at dinner right now.
depends on how late, you can @ me
i specifically wanted to know how you set up the logs
I’m using python’s logging module with the watched file handler
Nothing special in the systemd unit file
@formal schooner I’ll be back home in about an hour or two
ah ok, that's what i wanted to know, thanks
mysql might start itself as root and then de-privilege itself
i know nginx does that
otherwise a program definitely can't make a file owned by a group that it isn't a member of. and i don't think systemd has any provision for this (it sounds like you aren't using systemd to manage the log file anyway)
yeah, write the logs to a separate directory and use sgid or acl on the directory
@formal schooner thanks for your help earlier... I went with sgid on the directory for the log files
I hope i am at the right place here, so i wrote a small application to create template .html files and they are written inside the same directory the app is in. I changed the code to create a folder called "html" first and then put the .html files inside it to have it cleaner. It work fine on Linux, but when compiling an .app file and using it on Mac, the application crashes. Does anyone know why it crashes when compiled into a binary?
the line i used was: os.makedirs("./html") and the executable is compiled with pyinstaller --windowed --onefile tool.py
While compiling besides the app there is also an executable created that i can run from the terminal that doesn't crash when creating the directory
have you compiled it on the mac and then try to run it there, or are you compiling it on linux and then move the binary to the mac where you try to execute it?
compiled it on the mac ofc
Hello guys i need help i am using pycharm on ubuntu and i am trying to run my script speechrecognition with sphinx and pyaudio but i get the errors
alsa lib pcm errors many
please can someone help me thanks
this is the error code
import speech_recognition as sr
def recordAudio():
r = sr.Recognizer()
r.energy_threshold=592.788971
r.dynamic_energy_threshold=True
with sr.Microphone() as source2:
print('Rec.')
r.adjust_for_ambient_noise(source2)
audio=r.listen(source2)
#data=''
try:#sphinx is so so and offline
print(r.recognize_sphinx(audio))
except sr.UnknownValueError:
print('I could not understand the audio, unknown error.')
except sr.RequestError as e:
print('Request results from Speech Recognition service error '+ e)
while True:
recordAudio()
from what I read on SO the error messages are not really relevant and you can suppress them https://stackoverflow.com/questions/7088672/pyaudio-working-but-spits-out-error-messages-each-time
that i read also
Does anyone know why CPUs can only perform instructions in a register and not directy in memory
I think the short, easy answer is "because that's how they're designed". The slightly longer answer is "memory supports read/write in byte-sized chunks; the ALU only performs bitwise operations on its own register(s)."
registers is just memory as well, only that it's extremely little but fast memory that also lives very close to the execution unit so that it can access it directly
with such small amount of memory, addressing isn't a problem either, and there is no pages an such as registries are of short fixed length chunks of bits
Thanks, I researched further and this is what I took away
-
Speed and efficiency: System memory is physically far away from the CPU thus directly interacting with the RAM itself is slow. Copying memory that needs to be mutated, writing to the registers then ultimately flushing the bytes-stream back to the system memory overwriting the original memory is faster than reading then directly reading and writing with every cycle one by one. A single assembly instruction might translate to multiple CPU cycles (because it might translate to multiple instructions for the cpu itself [figured out via microcode]) thus writing every cycle which would be very expensive. Acting on the fast registers and waiting for the last moment the set of instructions are completed to flush the memory. Overall, this reduces the frequency of writes as every CPU cycle the state is altered.
-
Thread safety: A copy must be required to be safely acted on, multiple cores writing to the same address concurrently could corrupt and garble the memory
Tl;dr Memory is physically far away from the CPU's execution unit making writing to it expensive. Writing to the copy in register then writing and overwriting the final outcome back to the orignal memory address reduces write frequency thus making it faster
yeah, and the fact that registers is the fastest type of memory in the computer (not just because it is close, but that too)
and don't forget about L1, L2 and many times even L3 (and on rare occasions even L4) cache memory, L1 being the fastest and then going towards slower but more amount of memory, which is still faster then RAM but not as abundant as RAM is
the faster the memory the less you have of it because it is much more expensive the slower memory
Why is register mem the fastest?
to make the cpu as fast as possible the maker of the cpu implements the fastest memory for the registers that they can get there hands on as long as it's also viable (space, power, thermal and economical constraints) and as they don't need so much of that type of memory those constraints aren't to restrictive most of the time
this goes for cache memory as well, the closest (L1) to the execution units are the smallest (in terms of storage capacity) and fastest, but also most expensive, power hungry and sometimes bigger in terms of per byte, but as it isn't so much of it they can fit it in there anyways... and then it goes up from there with the L2 cache and so on
https://stackoverflow.com/a/62204316/2098827 This is a nice answer that covers both usage and physical implementation aspects, as well as "complicating factors" as he puts it. I'm also curious about the differences in the underlying electronics. What is it that's making the memory fast (beyond just distance and selection concerns), and why is that more expensive. Is it materials used, is it power usage? Presumably both in combination. This is stuff I probably touched on at uni, but has been lost to the lack of need to use it :)
module docstring before or after shebang?
the shebang must be the first two characters (actually bytes) in the file
what do you mean "making the memory fast"? the question is about why registers are faster than RAM. are you asking why registers are faster (than everything) or why RAM is faster (than disk)?
No, I read the question was "what makes register memory faster than other types of memory" i.e. what is it that makes SRAM faster than DRAM? I was looking beyond the "cos it's closer" and "cos there's less of it" to the physical structure. While there is a difference in how many components (typically) make up SRAM and DRAM, I'm still not sure the differences account for anything speed related. There are a couple of 1-transistor SRAM designs out there, but they don't seem to be commercially viable; the commercially viable designs are (mostly?) 6-transistor cells, yet DRAM uses only a capacitor and a transistor per cell. I think the main difference is the need to periodically refresh the DRAM cells, and (back to how much is available) the amount of addressing infrastructure needed (much more in the case of the more plentiful DRAM)
I think the SRAM circuit behaves faster despite being made up of more components, but I'm not sure, and if that is the case, I don't know why that is (unless it is purely due to addressing and refresh needs)
I'm not sure this is #unix related, either :D
yeah, this is probably not the right server to find this expertise :P
Well, it was part of my degree, so it ought to be in my remit... :)
and I learned discrete maths but here I am writing SaaS in python
(my degree was CS)
TV show host is one career route for maths grads, right?
I did Electronic Systems Engineering, but my first job was writing C, and I don't think I've done anything close to elec eng in my job beyond maybe a little soldering.
I got tasked with porting a couple Python2 scripts to [practically anything else]. I was looking at duplicating some functionality in Rust, and I realized that shell things suddenly became non-trivial. Is the typical use of os/subprocess.XXX a dirty hack [edit: for interactive child processes like SSH]? It lies at the heart of invoke, too. For what I am working on, I don't need to control the shell. I am making a few API calls to process some data that is passed to anther command. Would a better approach be $ some_cmd $(my_bin)? The Python approach I have seen is subprocess.run("some_cmd" + API_STUFF) that is run under the parent process.
I wrote some stuff with subprocess recently just because I needed run some commands--I could have done it all with API libraries (accessing secrets etc), but couldn't count on those libraries being installed where the python program was likely to be run.
To me, this is an area where our beloved python falls through the cracks. If a script relies heavily on other shell tools, well, bash is really quite capable. If it's more complicated, toolchains that blob all dependencies, like Rust and Golang, eliminate the dependency hunt step.
But that all depends on how much control you have of your environment. Sorry, this may be a tangent from your practical question!
In the end, I did what you said and used my python script to grab and format the input I needed for another command. $ some_cmd $(my_python_program), yes
one can package things up with python too, there are many ways to do it (but it can be kind of a hassle), ansible for example uses one such approach
yeah, sometimes i wish people just used the most suitable tool for the job instead of religiously using one tool/language for everything they do
it's easy to fall in to that trap since most people just "go with what you know [best]", "if all you have is a hammer..." and all that
speaking of blobs, for golang it's usually quite big blobs while rust makes do with much leaner blobs
I've read of those, kivy and stuff? But never tried one, as they seemed unwieldy for my goals. But maybe worth a closer look if the problem warrants!
i though kivy was for creating/packaging mobile apps and such in python, not sure if it can be used for the kind of things we are talking about here
but there is pex, zipapp, shiv and probably more: https://packaging.python.org/en/latest/overview/
Hmm, yes, kivy just uses PyInstaller under the hood, it seems--it's more of a standardized UI kit, but with integration to bundle for Windows/macOS/Android/iOS
Oh cool! That's a fun list. I'm trying out Poetry for dependency management too--wonder how / if that integrates.
that was the leaner ones, the fatter once (bigger blob) comes further down the list on that page which also packages a python binary (like pyInstaller does)
these can be very good to know about if one needs to be able to run stuff in a more or less unknown environment (remote linux server, anyone?)
just beware of the ones that package a binary, they are tied to the type of system that it was created for because of the binary that is packaged with it (if that is even a concern of yours)
is is how ever true to some extent with the leaner ones too if one isn't careful to only use libraries that are written in pure python and only has such dependencies down the whole dependency tree, so you need to be extra careful about that if you still want it to be more platform independent even if you are diligent about writing your own code as such
unless it's [any type of] shell script i usually try to avoid calling external commands/binaries
for shell scripts on the other hand, that's kind of their purpose, at least a lot of the time
but sometimes one has to be pragmatic too about the task at hand, even if it's implemented in other languages, and allow for those things
Thanks for all the feedback! Platform isn't a concern as I'm in a 100% Debian shop.
same cpu architecture and major version of debian everywhere?
or else it might become a concern anyways
CI takes care of most of that. I run over a matrix of arch/release. If it builds on CI, it will [probably 🙈] deploy.
Say I want to write a code.. it’s a easy enough to either write it as bash script or python code.. which one is preferable and why?
it all depends on what the scripts main task(s) is and what kind of logic that should into it
Mostly file related operations.. checking files in directory, moving them here and there splitting data into multiple files and archival of those etc.. nothing fancy
it also depends on your skills or team skills. I usually use both but depends on the task which one I pick
I’m also comfortable with both but I’m just trying to understand which one would be better and why?
e.g. if I need to update files, access db, complex http request, etc. I'd use python. If I need to interact with other applications like Docker, Kubernetes, move, copy or read files. I'd use bash
unless is something that eats a lot of resources and/or, I put "comfortable to read and write" over performance
also. It depends on the operation. I have found interesting comparison of different ways to do stuff by searching in stackoverflow
👍
here's an example - https://stackoverflow.com/q/28227087
Understood! Thanks .
fwiw grep -F <arg> is literally the same as for line in sys.stdin: if <arg> in line: print(line)
gnu grep specifically has a lot of options, but basic grep usage is pretty straightforward and worth learning how to use
no shame in switching to python for a less trivial task, though
It may also depend on what the target system you expect them to be used in has available. If it's a minimal system, it may not have python (although most distros include it by default, now). There used to be a rationale for writing scripts for sh rather than bash, as everything was expected to havesh, but bash was not always available.
indeed. although nowadays as you point out, it's often easier and better to install a portable runtime/interpreter than to try to write portable scripts 🙂
Yeah, it's only on really minimal systems that you're likely to run into issues nowadays.
Quick question of my own:
I am running diff -q filea fileb and seeing the expected returns of $? = 0 for no diff and $? = 1 for differences. That's good. But I thought if I did diff -q filea fileb && echo "DIFF" I would get DIFF only for those which returned 1. I appear to be getting it for files without differences, too. What am I forgetting?
it's the other way around, you want || echo "DIFF"
&& is for "success" (i.e. return status 0), like boolean-and
sigh Yeah.
I'm looking at it like a boolean on the 0, not on "success"
! diff -q ... worked, though.
yep it's reversed, easy to get confused
and yes, the ! builtin inverts the return code. 0 -> 1, nonzero -> 0
can i ask question about bash scripting here i need some help?
#!/bin/bash
PATH=/bin:/usr/bin
if [[ $# -ne 2 ]]
then
echo "Usage: $0 <source-directory> <destination-directory>"
exit 1
fi
if [[ ! -d $1 ]]; then
echo "No such source directory $1"
exit 1
elif [[ ! -d $2 ]]; then
echo "Creating destination directory $2"
mkdir $2
fi
for folder in $1/*
do
for img in "$folder"/*
do
convert -resize 100 "${img}"
echo "Creating thumbmnail for "`realpath $img`"as"`dirname $2`"/"`basename $img`
done
done
i just need help on resizing the img and trasferring it over to the destination directory
What's wrong with what you have now?
it needs to return this when i run
./make-thumbnails <source-directory> <destination-directory>
-
use
set -eu -o pipefail -
use
mkdir -pinstead of checking for-d $2 -
quote all your parameter expansions, you must assume that the user's input contains whitespace
it's also not clear what you're asking, your code looks fine other than the style issues above
i'm not sure how to transfer the resized image to the destination folder
and im not sure how to format echo "Creating thumbnails for <sourcedirectory> + (/name of img file) as <destinationdirectory>+(/name of img file)"
mv?
use temporary variables to make your life easier. for example:
src_dir="$( readlink -f "$1" )"
dst_dir="$( readlink -f "$2" )"
# ...
src_file="${src_dir}/${filename}"
dst_file="${dst_dir}/thumb_${filename}"
# ...
echo "Creating thumbnail for ${src_file} at ${dst_file}"
it's also recommended to stop using ticks for execution and use $(command goes here) like @formal schooner showed in the example above
what are ticks?
i understand
so for converting the size do i just
mv convert -resize 100 "${img}" $2
no, you must do them as separate commands, but you can just specify the output file instead to the convert command and forgo the mv
at the command prompt just type man convert and you have the manual for the command (if the man pages are installed on that system)
so
convert -resize 100 "${img}" mv $2
as convert takes an input file and an output file you can probably just do convert "${src_file}" "${dst_file}" and also stick your options for the conversion in there as well
don't think too hard about it, the stuff inside "" is text, and ${...} is a parameter expansion
Quick question
Does anyone know how to pass a variable from on BASH script to another if I call said BASH script from within the BASH script the variable originated from?
(why are you capitalizing bash?)
the first arg you pass is $1. see the arguments section of https://devhints.io/bash @north jasper
thanks
did you mean like exporting a variable and stuff
so that it gets inherited?
ohhhhhhhhh, good call
both methods have their pros and cons I guess
@icy jolt consider adding set -euo pipefail to the top of the script
looks pretty good at this point, but have you tried to run it with directory names that contains a space?
i think you need to be much more diligent on using double quotes around variables when dealing with strings that is treated as file paths or filenames, i see at least six instances where i think i will be needed
(also, obligatory "have you considered not writing a bash script and writing a python script instead?")
personally i would probably have picked shell script for this task as well, as it's a pretty simple one
every shell monstrosity starts off as a cute, "pretty simple" script
also, nothing here is even invoking anything else besides convert, so bash doesn't even seem suitable. all you're benefiting from is not writing subprocess.check_call(['convert', '-resize', '100', filename, os.path.join(sys.argv[2], bname)])
because people are too lazy to rewrite it from scratch when it is starting to get out of hand if the script ever is starting to grows into something that resemblesa monstrosity?
no because by the time you notice it's becoming a monstrosity, people are too afraid to rewrite it for fear of breaking something (I don't understand bash arrays/these random options/this weird substitution syntax/this weird redirection/these weird [[]] checks)
it's always lower risk to add new functionality to something than to remove/replace it
have you enclosed all the variables in double quotes yet and tested the script with both source and destination paths as well as filenames that contains space to catch any such blunders?
in just that snippet i still see one variable that is unquoted and would give you trouble if the source directory contains at least one space
and did you fix all the other ones higher up in the code as well?
you don't want for filename in $1/* or for filename in "$1/*", but for filename in "$1/"* or for filename in "$1"/*
if the path had been /csse/misc/seng-workshop/nature images/ instead for example
i don't know if they are strictly necessary, but i would add "" around $1 in the if statement and the $2 in the elif statement
Is it a good practice to run your python bot as a systemctl service on linux?
how do i make my code only start during a unix time?
it's not a bad practice. i run some of my personal hosted services with systemd
jhelp
but definitely make sure you don't run your service as root @trim cedar
are you asking about something like Cron?
epoch
What do you mean by "during" a unix time/epoch? Start at an exact time? Or (be allowed to?) run only during a certain range of times?
Kindly elaborate on this
that is, your discord bot should not actually run as root. your service file should specify the user and group to run the process with
systemd generally runs as init which is root. if you're not careful, it'll run your random python bot as root, which gives it elevated privileges
[Unit]
Description=My Bot
After=network.target
[Service]
User=discord-bot-user
Group=discord-bot-user
Type=simple
WorkingDirectory=/var/www/discord-bot
ExecStart=/var/www/discord-bot/run.py
how accurate is comment now? https://stackoverflow.com/questions/40216311/reading-in-environment-variables-from-an-environment-file#comment101007686_40216465.
Basically I want to use one file to setup envvars with following features:
- easy to read it from Python (without extra lib or ugly code). e.g. using configparser
- easy to read from bash, e.g. convert to array somehow
Hey, so I made a web app and now I am trying to set it up with nginx and unicorn. I cant seem to be able to serve static files
Heres my nginx file
server {
listen 80;
server_name 137.184.102.59;
location /static {
alias /root/portafolio/app/static;
}
location / {
proxy_pass http://localhost:8000;
include /etc/nginx/proxy_params;
proxy_redirect off;
}
}
Heres the project structure
portafolio
├── app
│ ├── __init__.py
│ ├── static
│ │ ├── css
│ │ │ └── style.css
│ │ ├── img
│ │ │ ├── api.jpg
│ │ │ ├── datamodel.jpg
│ │ │ ├── favicon.ico
│ │ │ ├── report.jpg
│ │ │ ├── report2.jpg
│ │ │ ├── toddy.jpg
│ │ │ └── woods.jpg
│ │ └── js
│ │ └── main.js
│ ├── templates
│ │ ├── crime.html
│ │ ├── layout.html
│ │ ├── main.html
│ │ └── projects.html
│ └── views.py
├── data.py
├── decorators.py
├── main.py
├── record.log
└── requirements.txt
And when inside static pwd returns /root/portafolio/app/static
Not sure what I am doing wrong, but when firing gunicorn i get plain html with no css and no imgs
Please tag me if you reply, thanks :)
you really don't want this under /root/ as only the root user should be allowed to access anything in there, and you don't want nginx to be running as root, move your files somewhere else on the system
Thanks for replying, will doing that help me with the static files? Or is that just good practice?
i'm suspecting that it could be the source of your problem or at least a part of it
if nginx isn't allowed to read the files it won't be able to serve it
I see, I'll try that later today, thanks :)
defensively, can you login on a local console on one of the four unix machines?
U were right, thanks! I created an user and moved the files to its directory and now nginx is serving the static files. Thanks
dotenv works fine for me // ah just saw that you don't want an extra library .... why not? it's pretty lightweight
I saw that lib. I will consider it. Thanks
hello
nothing wrong with it, but it's a simple enough piece of code that you shouldn't just copy and paste it, and you should consider whether it's good enough for your needs
e.g. it does not cover the possible use case of embedded line break characters in the env var
a friend suggested me to use this one too - https://github.com/henriquebastos/python-decouple/
What’s unix??

A. It's not linux }:)
Unix did start of as an operating system which is now pretty much dead and many other operating systems are based off such as the bsd's and linux based operating systems and unix is just used as a catch all term for these derivatives.
oh alright
Most important powershell ive ever typed
(Get-ChildItem -Path $env:HOMEPATH | where {
$_.Name -match '^[.]' }
).Attributes='Hidden'
in what way does PS fit in to #unix?
it imitates unix behavior on windows
the only resembles i've seen is that you chain things using pipe, other than that i wouldn't say they are very similar at all
it's just a script that grabs all the files that have names with leading periods and makes them hidden. I accumulate a lot of files that are dotfiles in my windows home user dir.
Windows doesn't treat these files like dotfiles though because it has a different system for doing that.
The above code makes the files behave as you would expect them to on linux, as in being hidden by default
you could technically install powershell on unix if you wanted to lol
i use both operating systems so for me, the most relevant things are how things work differently between the two and how to find a middle ground of desired behavior from both
Activate the conda env. Like conda activate base where base is env name
Best laptop companies for Linux? 
Lenovo (what used to be IBM) ThinkPad serieses
or https://www.tuxedocomputers.com/en
Agreed.
And you can get a pretty cheap one and upgrade it to be a decent computer.
System76 builds Linux laptops. They ship either with Ubuntu or their own take on Ubuntu - PopOS
Found a nice one. 945$ cost, Intel Core I5-1135G7, 512 GB SSD, 16 RAM, 15.6 inches screen, two ports for external screens
Lenovo IdeaPad5
A working horse of a web dev
Too bad, the battery is not external
hmm... ThinkPads are available too, but I don't like their price and screen size
I think the found IdeaPad5 is ideal. The price for hardware definitely is
i'm not sure the other Lenovo series outside of the different ThinkPad series are as linux compatible, if that is still what you want to go for you should probably do some more research on the subjekt, arch-linux wiki usually has good info on if the hardware is linux compatible or not
I'll be just buying with having live USB Kubuntu on my hands
I'll just check the laptop in shop before buying xD
if Linux is launching from USB (even without installation) and internet is working out of the box, then everything is ok
i still would read up on it a bit so that you don't miss anything that isn't immediately apparent, like wake up from sleep or hibernation or other power management issues, webcam and microphone for videoconferencing and so on
it is cheapest laptop with necessary powerful hardware. No time to think xD
if docker and KVM virtualization works, then it is already ok to me
i can make a test during the buying too for that
okay, your money your choice
those are probably going to work, kvm just might need hardware support enabled in the bios to work with good performance, which it might not be by default
creat_user() {
if id -u $1;
then userdel $1;
fi
useradd $1
here I need to call passwd $1 and get user input to pass it to passwd
}
``` how can I do that
can you replicate the error, now, after you've restarted your machine?
no no
can you replicate with the old variable?
or is the old variable available after the restart - after xport SOMEVAR="itsvalue" >> ~/.zshrc
there's a couple of things that could be here
can you try in the same terminal session (window):
export SOMEVAR="itsvalue"
start your jupyter notebook
import os; os.environ['SOMEVAR'].
?
was the notebook main process running when you ran these commands?
from where?
the same terminal session?
did you run all commands and then restart notebooks within the same frame?
👍 gl
can someone more knowledgeable correct me, if I'm wrong. my instructions above should work, no? if you export a variable in a terminal session and you start a new process in the same session, it should have access to that variable?
yes
doesn't really matter at all. use whatever you're comfortable with. if you don't have any familiarity, ubuntu is a popular starting point
agreed
also, don't use your distro for your python dev needs
use a manager like pyenv (asdf) and virtual environments
As your personal desktop? Try Kubuntu ;b
It is one of best choices for docker anyway
For docker image? Python goes in Debian distros usually
python is in a lot of distros ;)
Not every distro does it painlessly
yep
Alpine distro has debuff: building python packages (including during pip install) 50x times slower
wait
nope
that's another issue
that's docker
any chance you're using macos?
any chance you have the latest and greatest mac based on m1? :)
Nah
Regular PC and kubuntu distro
And yeah, it is in docker, but who cares
If it is in docker alpine, it means everywhere
no, it means you have different issues :)
Not every distro does it painlessly
I agree
that's because distros rely on python
hence: #unix message
Well. It is 7 AM and I still haven't slept. Time to sleep
That is because of alpine ecosystem
That is it
Somewhere article is easily googled about it
alpine is a minimal distro. it has a lot of problems :)
I did not know that. thanks
hello i currently have python 3.7.3 on my vps installed and i want to install python 3.8 but when i do sudo apt install python3.8 it fails
output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.8
E: Couldn't find any package by glob 'python3.8'
E: Couldn't find any package by regex 'python3.8'
what distro do you use and what version of it?
as i see you are running apt i'm guessing is something debian based
but would be good to know more exactly what it is you are using
i have Debian GNU/Linux 10 (buster)
you won't find python 3.8 in the repository for debian 10, it has python 3.7
if you move over to debian 11 you'll find python 3.9 instead
are you running a container (docker image) or a vm or maybe even on bare metal?
oh okay could you send me a good guide to upgrade to debian 11?
this is my vps
the preferred way is really to just backup everything that you have done your self and settings you care about and reinstall when you change major versions of the os
what kind of vps, is it your own vm so that you can reinstall it?
you may be able to pick another os image that you want your vps to be based on
no its not my own i bought it im paying it monthly
i understand, but is it just you using that vm or is it a shared vm type of vps deal?
if it's shared you probably can't reinstall it or dictate which os version should be installed on the vm
hello
when I run /usr/share/discord/resources/app.asar command on linux it says bash permissions denied
cna someone help me with this pls
I even tried root /usr/share/discord/resources/app.asar but it didn't work
bash: /usr/share/discord/resources/app.asar: cannot execute binary file: Exec format error
what does this error mean?
It means you're trying to run app.asar which is not an executable your computer can run
Where did you get this?
i think its shared
hmmm, as you can run things as root i'm thinking it's probably not shared on an os level
im gonna check it if i can
but i'm also starting to suspect that we have a xy-problem here, why did you want to upgrade from python 3.7.x to 3.8.x and what is your ultimate goal?
because i want lib called nextcord and its only on python 3.8 or higher
oh i see, yeah, then you need newer a python
yeah thats why
do you run anything else on the vps or have anything stored on it that you care about?
yeah so i have a few bots running and a website
aha, then starting from scratch on a new os would be painful
yeah
you don't have to be running a system python, you could install a new python version in parallel with the system one
where you able to run sudo apt update?
what do you mean by install a new python version in parallel with the system one?
and yeah i can run sudo apt update
that is a very good thing, then you have root privileges on the vps, and that means that the vps instance at least isn't shared with other customers, because that would be unsecure for all of you
ahh, now i know what you meant by shared, so other can access my vps too
i heard something of pyenv and that you can install python3.8 with it
yeah, pyenv is what I was going to suggest next 👍
ah nice i tired it like 1-2 months ago when my problem wasnt that important but i couldnt setup pyenv
that was what I meant by installing another python version in parallel with the one provided by thr system/os
ohh okay
I think pyenv is the best, cleanest and easiest way to do that
yeah
you don't even need root to install a new python version using pyenv, but you might need root access to install a few build tools if they aren't already installed on your system
what are the build tools?
to be able to compile stuff if pyenv needs to
yeah i know that, i meant the name of the build tools
i would suggest you first do a sudo apt dist-upgrade to update the system if you aren't up to date already
yeah im up to date
good, then you can try sudo apt install build-essential
but if you have played with pyenv before chances are you already have that installed as well
i did that i already have it
yeah i do
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
i have that installed too
try echo $PYENV_ROOT and echo $PATH | grep -c $PYENV_ROOT and command -v pyenv to see if your environment is setup correctly
what output did you get from those three commands?
okay i will do that
from pyenv download:
fatal: destination path '/root/.pyenv' already exists and is not an empty directory.
from build essentials:
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.6).
i would also recommend to update pyenv by running the following commands as it was a little while since you installed it the last time:
pushd ~/.pyenv
git fetch --all
git reset --hard origin/master
popd
okay i did that
so i did echo $PATH | grep -c $PYENV_ROOT but it says Usage: grep [OPTION]... PATTERNS [FILE]...
oh, i only needed to check on the output from these three commands:
echo $PYENV_ROOT
echo $PATH | grep -c $PYENV_ROOT
command -v pyenv
and from just the first command?
because it sounds like your environment variables isn't setup right yet
output when i entered this:
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.
command -v pyenv
pyenv
wheen i enter command -v pyenv the output is just pyenv
okay, only the output from echo $PYENV_ROOT
its nothing
okay, then we are missing some stuff
try:
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n\teval "$(pyenv init -)"\nfi' >> ~/.bashrc
exec "$SHELL"
that should get that solved for you
okay
i accdidentally closed putty and i logged back in into my vps and there is no enter
i did strg + c and now it appeared
but it was very weird
wow, got scared there for a while, hoping you had not used a single > somewhere instead of a double>> because such a mistake would be really bad
so, back on track?
then it still sound like something when very wrong with the commands, did you copy them exactly as i wrote them?
yeah i did
i'm starting to suspect that your ~/.bashrc got corrupted in some way in the previous step
oh
are you comfortable with nano or vi as an editor?
not really
i mostly used filezilla
uhm
it says sudo comand not found
and nano doesnt work anymore too
your path is probably broken due to a broken .bashrc file, we'll try to fix it
oh okay
yeah
do you see anything there or is it empty?
i seee something
doesn't look totally broken at least 👍
can you comment out all the lines from the export and down?
yeah i can
and then save the file, just undoing anything that we might have done
there looks like it's many copies of the same commands in that file right now
okay i saved the file
okay i can connect trough filezilla in my vps now
through*
and i can use sudo again
can open another putty window (keep the one you have for now) now and see if it works better using sudo and stuff from that window
good, then we are back in business 😅
i was thinking that you would start a new putty window and session and keep the old one around just as a precaution until we know that the new one works better, but we seem to be fine again
yeah its fine now
maybe the error could be that i entered the shell thing a few times lmao
your .bashrc looked very different then the one i have on debian 10 (trying everything on a system over here in parallel)
oh okay
you might have everything in your .bash_profile instead of things in .bashrc on your system
oh, okay does it matter?
it shouldn't matter much
okay
this is getting a bit longer than i had expected, should we occupy a help channel instead of flooding this channel?
do you want to go grab a help channel for your self and then write in here which channel you ended up getting?
okay no problem
just wanted to fix what was broken before i suggested it, since your broken environment was the first priority to fix
Hey anyone could translate this command from unix to windows?
curl -XPOST -H "Content-type: application/json" -d '{"name": "catty mcCatFace", "price": 5000, "breed": "bengal"}' '127.0.0.1:5000/add'
that's not exactly a "unix command"; it's a particular program named "curl"
easiest thing is to see if it's available on Windows
if so I don't think you'd need to do any translation
https://superuser.com/a/693179 might be a start
Curl has been built in to windows 10/11 since October 2017. It’s likely you can just paste that command unedited
Why not just ssh?
I'm assuming you're on a unix based system, just ssh user@IP.
that's old messages and the problem is already fully solved
and no, the person was using putty on a windows system to reach a hosted vps running debian 10
yeah, for quite a few years now
however, the ergonomics of the different terminal programs bundled with windows has been far from good
but now there is the new Windows Terminal, which i've heard a lot of good things about for those stuck on a windows system
Windows terminal is nice.
what even is unix
Hi guys, who uses linux ubuntu? I wanted to know what is latest release of tensorflow for ubuntu?
Should just be the latest version on pypi if your using the latest Ubuntu version
!pypi tensorflow
I want to move to linux. That's why i wanted to know it. Thank you for respond!
you know there are other linux distributions as well, right?
i would say ubuntu is an easy one to start with, though. no need to play around with the apt repos for the most part, and no need to update or reinstall for another 5 years
Tensorflow only really supports Ubuntu, good luck getting it going on any other distro
There are so many good beginner distributions now
maybe you should fact check such a statement before you utter it as truth
it would be very strange if it were to run only on one single linux distro
so, just a sample:
https://linuxstoney.com/how-to-install-and-configure-tensorflow-on-rocky-linux-8/
https://wiki.debian.org/MachineLearning/Tensorflow
https://itslinuxfoss.com/how-to-install-tensorflow-on-debian-11/
You totally can get it running on any distro it's just ubuntu is the one you see that is immediately supported
The docker image should be the easiest way to get it running on any distro
agreed, using docker is probably easiest to maintain too
Ubuntu is default distro for ML/DL for many
Hi, any know any pre-built phone app GUI (connect by wifi) to control any ros ubuntu robot with scanner? If not, any link for easy to make GUI guide i can follow? Purpose is for user to use the phone to command the robot to move to its waypoint when command while avoiding collision.
yo i dont know if i am in the right channel for this but i am on ubuntu and i get this message every time i try to make a window with tkinter ModuleNotFoundError: No module named 'tkinter'
You need to install tkinter
Tried that many times didn't work if i did i wouldn't be asking is there another way that would work?
Like another way to fix it
you need to have tkinter to use it in your code
but there are several ways to go about installing it
how did you try to install it?
I tried pip and apt
are you using venv or similar for your project and what environment are you trying to execute your code in?
and did you get any errors when you tried installing it with pip and apt?
Gnome
No
so, both installations (apt and pip) when well as far as you know?
what does your line of code look like where you import tkinter?
i mean: what does the top of your code look like where you import modules/libraries in to your code?
I just put import tkinter
what happens if you run the following in a terminal?
python -m tkinter
Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3
i put python 3 and it opened a window
sure, try with python3 -m tkinter on your system then
then you have tkinter installed and you should be able to use it
but why does pycharm say no modlue named tkinter
oh pycharm... it's probably just the python installation that pycharm is trying to use that doesn't have it
you can reconfigure pycharm to use another python to run things then the one it's using right now
i think people in #editors-ides will be able to help you with that part
okay thank you
oh and you mean a different version of python right
or just another installation of python than the system wide installation
that installation of python that pycharm is using probably doesn't have tkinter installed within it
you can try and hunt them down by checking the output of whereis python, which python, which python3, etc
in particular, you want to hunt down the one for which you installed tkinter, so use which [whatever python you used pip with]
Hey, I'm having some problems with python in Linux. Can anyone check my problem here #help-peanut ?
I know. I'm not that familiar with linux yet, and it's said beginner friendly, so that's why I started with ubuntu. Today I installed it, but there are some difficulties with installing newer versions of tensorflow like 2.8. Now trying to install 2.7
i hope you at least are running the latest version (22.04) of ubuntu if that will be your distro of choice
it's a stretch to say Linux is "beginner friendly". But Ubuntu is definitely the right choice.
it's a shame that 22.04 still doesn't have miktex (lest you compile from source; then again, tex live is an alternative) nor the nice dcv remote desktop client though. if you want stability and wide access to software, 20.04 is still better than 22.04 and will probably remain so for the rest of the year. on the other hand, you're also behind a couple of versions
Hello
Is the Linux first installed on a mobile and then Android as a layer on top of it?
not really, android is more or less a special purpose linux distribution made and maintained by google
So, is it possible to contact a smartphone manufacturer and ask them
To remove camera, microphone, other modules
And install pure Linux server
And an extra rj45 port
what does that have to do with anything?
i don't think they will, there must be a good business proposition for them to do something
Cause raspberry Pi are too costly for shitty specs
The day has come
And mobile phones these days come with octa core nd other gpu processing (ml)>
Nd shet ton of ram
there are other small computers you can buy instead, doesn't have to be raspberry
At cheeaaap price
But ARM processor
Like octa core, with 8 gb ram for 20k inr or around 270 dollars
It'd be waaay cheap if you remove cam modules
Bluetooth
Android licenses etc ;(
Right?
i think there are similar hardware platforms out there, they just aren't main stream
Tried searching like crazy. But found none. My primary purpose is easy self hosting.
and you really really want/need arm specifically because?
Ummm, cause mongodb is hungry and easy scaling in case my service gets popular
I would probably just buy a vps
But the service isn't making any money yet
and that has to do with arm how?
x86_64 will do that too for you
More cores==more workers
Especially for gunicorn
The intel one's hardly come at 2 cores for cheap
You're going to have to put some money in before you get any out
Everything else costs an arm
Imagine the service never making money
then you lost a little bit of money, big deal
Anything as a service is not OWNED by you
Yeah, big deal, it's just a few lakh rupees.
Or 100s of dollars
business is just a gamble and there is really nothing you can do about that
If you have a credit card you can sign up for GCP or AWS free trial, that’ll give you a bigger window to work with
Not sure why your complaining about it costing an arm then?
I don't want to rent database as a service
If you want to have your own server it’s gonna be costly
...arm servers are CHEAP
would this work when it comes to specs and price?
it's even fanless like a raspberry but will run circles around a raspberry and run x86 software that isn't even available for arm
https://fit-iot.com/web/product/fitlet3-build-to-order/
Octa core costs a shit ton low than any cloud provider in like in 6 months
Ok, then why not do that? Instead of flashing Linux on a mobile device or whatever you are trying to do
It's Intel infected
number of cores isn't everything
...umm...why not?
oh, so your anti intel now too?
it's the total speed of the system that counts not the number of cores
.....cores>infinite threading?
don't believe in one paper, read several benchmarks and decide for your self instead
run things on gpu:s if that is your benchmark
I run synchronous work load , flask.
I ideally want more cores. Than threads.
So as to not block the workers.
if you don't like intel, go amd instead then, there you'll get more cores as well typically
Yup, but the cores is still around 4/6/8 in a consumer pc. And costs more than a mobile
But ig, it supports more ram and disk space ig.
you have no traffic now and you are already optimizing
you know what they say about premature optimization, right?
👉👈
What do they say?
it's just an endless loop of not actually putting a product out and instead optimising it to the moon and back
But it is owned by me, so I can keep testing forever too
The product is ready
I am searching for chheeeeap deployments under my control
/owned
I don't wanna lose stuff cause, I can't pay.
if you get hang up on optimization you will never get to market
instead optimize when you see the need for it
whats your main issue with it not being hosted by you?
- Database in a VM is scary af.
- database as a service in the same cloud is costly.
- i exhausted my credit card free trials 2 years back I think.
- they offer very low cores, ram, etc etc
Compared to self hosting.
And I am a devops engineer, so I know how to setup the infra. Okay just graduated.
nothing wrong with a db on a vm, a lot of big companies do it
but sure, if you want ultimate performance you should skip the virtualization layer
Also, it's a happiness to have your data with you.
have you checked: https://www.hardkernel.com/ ?
they have some arm stuff
however you also mentioned "Imagine the service never making money" which suggests you are also careful with how much you are spending and if your service is a flop this is a much better position to be in than having bought a lot of physical hardware since you are renting and not buying
I can afford a smartphone price range.
I am just stumped by why no one is using these ridiculous number of cores for self hosting.
A few years back, sure low cores and crappy performance.
But today, those chips are crazy good.
And flask is arm compatible
So no issues on that end for me
you can't invest €5.88 per month in a product you expect to be making a bit of money just to get it going for 2 cores and 4GB of mem?
.. ...you do realize 2 cores and 4gb is utter shit?
yes, but it's also very cheap
you could probably spend a more money to get better hardware
https://www.hetzner.com/cloud this is where I pulled those figures from, works for me fairly well
Yup, I did have tons of cloud experience. Thanks to my thesis.
The price to performance is good in the short term. And even better if the product is making money.
For a startup, it is a death sentence to scale.
I expect my service to not make any more for at least a year.
Money*
how much traffic are you actually expecting?
A 1000 users. Initially. And also gotta calculate for marketing
not deployed no official stats yet concurrent users maybe 10/12
Let me know if you guys come across how to flash a smartphone and install Ubuntu server.
Or any other arm cheap way. But with performance:)
if this was easy and cheap someone would have made the product and sold it to get rich
or you might just go for that business your self if you think you can make it cheap and still make a good buck on it by stripping away screen, battery, cameras, speaker, microphone, bluetooth, wifi, gsm/ltm connectivity and all the other stuff from a phone that you don't need, and the pesky android licensing that must be expensive to uphold
Exactly!
I believe so.
But again, maybe I'm just naive. Just wish contacting manufacturers and making prototypes is easy
Seriously, octa core. 8gb ram. Ridiculous consistency. Inbuilt battery backup.
Like, what else could you ask for
Maybe expandable ram and hdd/sdd support ig.
i would externalize the battery for sure just for the sake of reliability
aging batteries is one of the most common reasons for people to change there phones
and then there is the heat that comes with that as well
True ig. But it'll be on power any way.
and it would be cheaper without the battery on each unit
True
you might have a business right there if you believe strongly in that idea
reliability with the internet connection and such will be a problem with self hosting unless you set that up in one or more data centers on your own
True. Networking could be an issue. but ISPs shouldnt have a problem laying fiber line to homes
We are in the future, fiber is everywhere!
that isn't all there is when it comes to hosting
anyways, this doesn't come cheap but it has 16 ARM cores and have expandable ram, up to 64 GB of it too
https://shop.solid-run.com/product/SRLX216S00D00GE064H09CH/
https://www.solid-run.com/wp-content/uploads/2021/01/HoneyComb-LX2-Datasheet.pdf
Yes, I installed 22.04
hi guys! I need to help. I want install pip into ubuntu core. But i couldn't do this. I installed python38 with use sudo snap install python38 but ı couldn't install wit hsudo snap install pip. How can ı do?
sudo snap install python38-pip
context: they're using Ubuntu Core, which has a read-only file system akin to nix, Fedora CoreOS, etc.
I tried python38 -m pip install ...
root@ubuntu:~# python38 -m pip --version
pip 19.3.1 from /snap/python38/22/lib/python3.8/site-packages/pip (python 3.8)
root@ubuntu:~# sudo pip install virtualenv
sudo: pip: command not found
Collecting virtualenv
Downloading https://files.pythonhosted.org/packages/9e/34/e86fc6a8f84329b49321a532b3c1fef103c67765df957fbb3852eea39d00/virtualenv-20.14.1-py2.py3-none-any.whl (8.8MB)
|████████████████████████████████| 8.8MB 1.3MB/s
Collecting platformdirs<3,>=2
Downloading https://files.pythonhosted.org/packages/ed/22/967181c94c3a4063fe64e15331b4cb366bdd7dfbf46fcb8ad89650026fec/platformdirs-2.5.2-py3-none-any.whl
Collecting six<2,>=1.9.0
Downloading https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Collecting filelock<4,>=3.2
Downloading https://files.pythonhosted.org/packages/cd/f1/ba7dee3de0e9d3b8634d6fbaa5d0d407a7da64620305d147298b683e5c36/filelock-3.6.0-py3-none-any.whl
Collecting distlib<1,>=0.3.1
Downloading https://files.pythonhosted.org/packages/ac/a3/8ee4f54d5f12e16eeeda6b7df3dfdbda24e6cc572c86ff959a4ce110391b/distlib-0.3.4-py2.py3-none-any.whl (461kB)
|████████████████████████████████| 471kB 95.1MB/s
Installing collected packages: platformdirs, six, filelock, distlib, virtualenv
ERROR: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: '/snap/python38/22/usr/local'
WARNING: You are using pip version 19.3.1; however, version 22.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Usage:
/snap/python38/22/usr/bin/python3.8 -m pip <command> [options]
no such option: --upgrade
```
And ı was trying ```pip install --upgrade pip``` ı'm getting same error
do python38 -m pip install virtualenv
everything that you want to do with a pip command, you can do with python38 -m pip instead. This is a good thing, since you'll never wonder about which version of python you installed a package into
Sorry, I couldn't install anything. I told you before. ```sudo: pip: command not found
I am not recommending that you run sudo pip; I'm recommending that you run sudo python38 -m pip, which you've already demonstrated works
My fault. I was searching this fault since a long time. Yes , I tried. Also ı'm trying again ı get same err```Collecting virtualenv
Downloading https://files.pythonhosted.org/packages/9e/34/e86fc6a8f84329b49321a532b3c1fef103c67765df957fbb3852eea39d00/virtualenv-20.14.1-py2.py3-none-any.whl (8.8MB)
|████████████████████████████████| 8.8MB 1.3MB/s
Collecting platformdirs<3,>=2
Downloading https://files.pythonhosted.org/packages/ed/22/967181c94c3a4063fe64e15331b4cb366bdd7dfbf46fcb8ad89650026fec/platformdirs-2.5.2-py3-none-any.whl
Collecting six<2,>=1.9.0
Downloading https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Collecting filelock<4,>=3.2
Downloading https://files.pythonhosted.org/packages/cd/f1/ba7dee3de0e9d3b8634d6fbaa5d0d407a7da64620305d147298b683e5c36/filelock-3.6.0-py3-none-any.whl
Collecting distlib<1,>=0.3.1
Downloading https://files.pythonhosted.org/packages/ac/a3/8ee4f54d5f12e16eeeda6b7df3dfdbda24e6cc572c86ff959a4ce110391b/distlib-0.3.4-py2.py3-none-any.whl (461kB)
|████████████████████████████████| 471kB 95.1MB/s
Installing collected packages: platformdirs, six, filelock, distlib, virtualenv
ERROR: Could not install packages due to an EnvironmentError: [Errno 30] Read-only file system: '/snap/python38/22/usr/local'
WARNING: You are using pip version 19.3.1; however, version 22.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Usage:
/snap/python38/22/usr/bin/python3.8 -m pip <command> [options]
no such option: --upgrade``` Btw ı tried upgrade but not working
Read-only file system: '/snap/python38/22/usr/local' would be indicative. Might need to use --user
Although that then evades the snap compartmentalisation.
ah, ok the read-only file system thing is a mystery to me; I know nothing about snap
snap creates something like a chroot for each application
I think there are ways to open parts up, but I have no idea how to do that
yo
Yo
so yea currently its being installed
Ok so
wait mint got installed les go
DONE
this
Cinnamon*
It's not exclusive to Mint, just install Wine sudo apt install wine
can someone help me
why is everything on linux so small
all icons all stuff all font size everything
so smol
even in full screen
change the scaling
settings i think
is resolution not alright?
its a laptop
1980 x 1080
open up terminal and try xrandr -s "1980x1080"
um oka
worky?
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
why
thats linux this is windows
try ctrl shift c
why wont it
yup not working
I'm on arch as well
cause thats another os
yeah
yeah that's good
?
im on linux mint btw
bruh
or write it down
let me start my mint and see how to make it big
doenst matter that much, all linux work the same under the hood
yes thank you
unrecognized option -hsync
weird
ye
@dull spear run xrandr -q and show output
mk
too much stuff
a lotta numbers
just show screenshot
bruh
bruh
i dont want that
just select any resolution from the list and run xrandr -s resolution
looks like the highest possible one
xrandr -s 2560x1600
so?
ig it wont be possible to have the same res as windows
sure
the only thing which i got working is making the font size bigger 💀
this looks fine
@dull spear this is what i got (excluding the text size)
i was able to increase the panel size
boot on real hardware 👍
bruh
i feel like youll probably find something if u fuck around in display settings
how
set scale to custom and then make it 0.9
is it in system settings
where did u open this from
from here
user interface scale
only 3 options
no thats too much
damn
guys I instaledl spotify using the command but when I search for it i dont see it
@stuck shadow do u know why
OOF
what was the output of this command?
i feel like u didnt install snap
mint doesn't like snap
Any package manager whilst you have another package manager is normally a bad idea unless that's just what you need to get it working
Luckily my distros repo comes with Spotify
how do i install spotify on linux
sudo apt install spotify
ok
It's working now yeah
Yo guys ! Coud anyone help me add 1 more query option to an existing bash script ? I will not buy you a coffee 😄
What do you mean by "a query option". And how do I get this coffee? ...but Rule 9 :(
just saying: whenever my bash script becomes complex enough that it's hard to modify ... that's when I rewrite it in python
Whenever my bash script doesn't fit on a single line, and I can't rewrite that line in Perl....
(You should see some of the perl one-liners I used to write....)
perl regular expressions 4 life 😉
Just to be clear , im a noob in every language , https://github.com/magenta-aps/check_prometheus_metric there is this script,
I use it to check some prometheus metrics. if I run it with the -q , it gives me the prometheus query result. Thats good. But I want to whats the maximum available space:
Close your eyes, I did this :
NUM=1073741824 PROMETHEUS_RESULT_GB=$(($PROMETHEUS_RESULT/$NUM)) if [ ${IS_CRITICAL} -ne ${CRITICAL_INVERTED} ]; then NAGIOS_STATUS=CRITICAL NAGIOS_SHORT_TEXT="${METRIC_NAME} is ${PROMETHEUS_RESULT_GB}Gb / 500Gb"
i just want a -q2 or whatevery that replaces the 500Gb I wrote there 😄
honestly I'd rewrite it
I tried to snip it together but because I dont know what im doing , its not working 😄
the bash syntax is something like if [ ${IS_CRITICAL} -ne ${CRITICAL_INVERTED} ] || [ ${THIS} -ne ${THAT} ]; but it's awful
Can I ask Linux questions here? As in which linux distro to use?
ubuntu 🙂
okay to provide a bit more context:
I'm looking for suggestions for a linux distro that I can run with Windows Substem for Linux. I have a coding project which has got to the point where it needs to use a redis databse howver redis is not supported on Windows natively so I need to set up a linux enviroemnt but I have no idea where to start in regards to picking a distro. Any suggestions andor advice related to the topic would be appreciated.
since it'll be mostly command line based, the biggest differences will be things like package manager (how up to date software versions are, how to add new repos if needed) and peculiarities on how the directory structure is handled. ubuntu is usually a safe bet, since you don't have to fiddle around too much
okay thanks for the tip 😄 do you recommend ubuntu itself or one of it's distros and if so which?
ubuntu should be fine, since the spinoffs mainly differ in the desktop environment, which you won't be using. you won't see any difference from kubuntu, xubuntu, etc
okay thank you again
ive dualbooted my system with ubuntu and windows. but yesterday i was trying to run yolo on ubuntu and did reload command. since then ubuntu isnt starting. how do i fix this?
First - see if you can boot into non-graphics mode. At the Grub prompt, press "e" to "edit" the configuration and shove a "3" right at the end of the linux (iirc! I do it all the time, but can't remember - I recognise it when I see it, now!) line. Then press F10 to boot that.
@minor hull ^
If that works you may just be able to do a sudo apt update && sudo apt upgrade; It may just be that something's out of sync in your packages.
If not, then you can resort to a live disc USB stick, boot from that, then try to recover the system by mounting it and maybe chrooting into it...but it might just be as easy at that point (especially if what I just said sounds like gobbledegook!) to re-build the system. You should at least be able to mount the drive and recover anything that needs recovering (if anything) from the live USB system.
I dusted off an old machine (1GB RAM, Intel Atom CPU, ~160GB HDD) and installed Alpine Linux on it in data disk mode (root filesystem is created as tmpfs and populated at boot). So now I have a working but very underpowered Linux server sitting around and I don't know what to do with it
Hmm actually a local DNS server would be nice
And probably something this old machine could actually handle
I'm pretty pleased that Alpine hosts its entire fs in RAM on this machine, with plenty of room to spare.
question, i just installed garuda and when i try to install packages i get this error
failed to prepare transaction (could not find database)
can anyone help me?
have you tried googling it
Nvm its working
Hi!
I have a few questions about Virtual machines. Anyone here who i can dm or write here?
ask the question here in the channel and see if you get any responses
OK
First question:
Does kali Linux run on any windows machine? So could I buy any laptop with Windows and run Kali from a SSD or does it have to be a certian model/os/version…?
Second:
Where do files created in Kali safe?
On the external SSD or on the laptop itself?
linux runs on a lot of hardware, and that doesn't mean that all the hardware is working fully, you can't be sure until you tried it your self or found reliable sources online
some hardware such as wifi chips and stuff like that might have buggy drivers when not using the proprietary windows drivers, you will really need to research such topics
where it saves files if depends on the configuration and if you are running it as a live os or if you do a properly installtion on the computer
I was thinking about a live version on an external ssd
most of the time files aren't even persisted when running live os, sometimes you can configure them to persist data on the same media as the live os, i don't know if that is the case with kali
otherwise you just have to mount your storage that you want to use under some path to be able to persist data
wdym by "any laptop with windows"? kali would run instead of windows
But I also need windows as some Programms I use often don't run on Linux
all right, but still, only one of the two can run at a time. you can't open windows programs on kali (unless they have a compatible linux version), and the opposite is also true
I know
even using a VM, you can't run one operating system's software on the other
at any rate, what i mean is that the windows part is not important
But what you recommend me doing? Using a hard drive to boot from it or installing a VM to work with (daily)
that would depend on the type of work you're doing. if it's not very intensive, VM is fine. if you need all the memory and cpu power, you'd have to use it directly instead of from a VM
VM is usually fine, but can sometimes be a problem if you want to do something hardware dependent such as putting the wifi chip in monitor mode
And what about programming? I have to store a lot of files
hmm yeah, now that you mention it. especially with kali, it doesn't make much sense to VM if you want to use the tools it brings
if you're only coding, i would recommend not using kali, and either using a VM or WSL
programming will be just fine, but kali might not be the best choice of distro for general programming
And the best choice for learning hacking? Kali brings a lot of tools for that
then yes, kali. and not on vm
well. hacking is a broad term. kali is more for security and network infrastructure testing, but i guess it falls under the umbrella
Yeah I know. I just didn't now how to say it
you should learn security rather then "hacking"
That's what I meant
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
Hacking is most of the time legale
If you have the license to do so
But thanks a lot to both of you.
just pip install hacking
hehe, maybe concentrate on fewer distros or at least see to it that they aren't from too many different families 😉
i think fedora is great for getting started with linux
the filesystem layout and config system is well-organized, which makes it easy to find things
debian and debian-based distros can be pretty chaotic by comparison once you start digging into config files
i fully agree, and Fedora is nice for development/coding as well
it also apparently is the distribution of choice for Linus Torvalds 😃
I just use ubuntu, works well enough for me
Messing around making an Ubuntu VM that runs entirely from ram/tmpfs following this approach: https://gist.github.com/avinash-oza/9791c4edd78a03540dc69d6fbf21bd9c
Kubuntu + vscode + python/numpy/scipy/matplotlib, running from tmpfs
I paid for all this RAM, may as well use it
Lol
Why does this boot so much faster on Linux hosts than Windows
idk maybe Virtualbox is just bad on Windows hosts
This VM performs quite nicely with NixOS as a host but when I put it on Windows, it's terrible...
iirc, there are extra layers that sit between a VM on Windows and the hardware that Linux can get around, so you do tend to get better performance under Linux. (This may be me mapping recollected Docker knowledge to VMs, although the principles are much the same)
Docker Desktop does use a Linux VM, not sure about Virtualbox
Ah, yes, it sets up a HyperV VM, doesn't it? Which caused issues with running VirtualBox and Docker at the same time because one wanted one set of virtualisation OS settings and the other another set...
Yes this has been another thorn in my side haha
macOS (intel) - Anyone know how to fix this?
myterminal % brew link python@3.10
Linking /usr/local/Cellar/python@3.10/3.10.4...
Error: Could not symlink bin/pip3
Target /usr/local/bin/pip3
already exists. You may want to remove it:
rm '/usr/local/bin/pip3'
To force the link and overwrite all conflicting files:
brew link --overwrite python@3.10
To list all files that would be deleted:
brew link --overwrite --dry-run python@3.10
A python@3.9 was already linked. I just unlinked it, but didn't expect that to be a problem with pip. Should I just ovewrite?
fukkit, did it. rekted my pip env, but whatever
I think you want to use the --overwrite flag, but add a --dry-run first
Yea did a --overwrite after. It had me reinstall packages, but that's fine. My global packages had accumulated for a bit
#!/bin/bash for i in 1 2 3 4 5 do dd if=/dev/zero bs=4096 count=1024 of=ext4-${i}.image mke2fs -t ext4 -F ${i}.image done
Anyone please help me if i am correct on this loop, So i was using DD command line to create 5 .image file, then using mke2fs I am trying to create 5 ext4 file system of that .image file that I created from dd command
the file name isn't the same, it's ext4-{1,2,3,4,5}.image as the argument to the of parameter of dd
while it's only {1,2,3,4,5}.image to the -F parameter of the mke2fs command
you might also want to change for i in 1 2 3 4 5 to for i in $(seq 1 5) or for i in {1..5}
it's also a good habit to surround filenames and paths with "" to handle spaces and other special characters
#!/bin/bash for i in $(seq 1 5) do dd if=/dev/zero bs=4096 count=1024 of=ext4-${1,2,3,4,5}.image mke2fs -t ext4 -F ${1,2,3,4,5}.image done
Does this now look correct?
no, that was not what i meant
#!/bin/bash
for i in $(seq 1 5)
do
dd if=/dev/zero bs=4096 count=1024 of="ext4-${i}.image"
mke2fs -t ext4 -F "ext4-${i}.image"
done
Thanks a lot, that make sense now
you see how both filenames for both commands now has the same string that includes ext4- as a prefix which the mke2fs line didn't have before
Yes now I understand. Thanks for correcting me.
Bash script seems little hard to me:(
cmd = 'AFL_SKIP_BIN_CHECK=1 ./combined/afl-image-syscall/afl-fuzz -S {0} -b {1} -s fs/{2}/{2}_wrapper.so -e samples/oracle/{2}-'+str(i)+'.image -y seed -i {3} -o {4} -u {5} -- lkl/tools/lkl/{2}-combined-consistency -t {2} -i samples/oracle/{2}-'+str(i)+'.image -e emulator/emulator.py -l /tmp/mosbench/tmpfs-separate/{6}/log -d "/tmp/mosbench/tmpfs-separate/{6}/" -r -p @@'.format(instance_name, shm_name, args.fstype, in_dir, out_dir, args.cpu_id, args.log_id)
I am actually tring to pass those 5 .image file into this command line i used +str(i)+ to do that
you'll get there in time and with practice, if you are going to have more complex logic it could be a good idea to instead write it in another language such as python
thank you so much for the suggestions. I am a beginner level programmer. trying my best to learn it well
what would {0}, {1}, {2}, {3}, {4}, {5} and {6} be in that code?
are you sure you don't mean to say ${0}, ${1} and so on, which will not expand within 'single quote strings' anyways
and remember that you can't have any spaces around the = when assigning variables
{i} is replaced with the i-th argument of format() following the string.
Please refer to python2's format string documentation (https://docs.python.org/2/library/string.html#format-examples)
Thats what i got when i asked the owner of the code
oh, now your talking python code 💡
i though you were still talking bash scripts here and was thinking a lot was looking very wrong 😆
haha
Thats scary code, long line and I am still trying to understand it
I envy people who are so good at writing code haha, I wish I can be good enough one day
f-strings would help here if you are using python 3.6 or newer
I see. I need to watch some tutorial to understand how to organize it,
what I target to do here is to use those flag operation to run my 5 images one after another for 1 hour and then save in a directory
with f-strings (format strings) you interpolate the variables right in the string
and you might even want to break it out on more lines so that you have one argument per line for better readability and overview of the options you pass
cmd = (
f'AFL_SKIP_BIN_CHECK=1 "./combined/afl-image-syscall/afl-fuzz"'
f' -S "{instance_name}" -b "{shm_name}"'
f' -s "fs/{args.fstype}/{args.fstype}_wrapper.so"'
f' -e "samples/oracle/{args.fstype}-{i}.image" -y seed'
f' -i "{in_dir}" -o "{out_dir}" -u {args.cpu_id}'
f' -- "lkl/tools/lkl/{args.fstype}-combined-consistency"'
f' -t "{args.fstype}" -i "samples/oracle/{args.fstype}-{i}.image"'
f' -e "emulator/emulator.py" -l "/tmp/mosbench/tmpfs-separate/{args.log_id}/log"'
f' -d "/tmp/mosbench/tmpfs-separate/{args.log_id}/" -r -p @@'
)
you don't even need any concatenation as python auto-concatenates strings within parentheses like this
@wet folio what do you think, does the above make sense?
wow, thank you so much. it looks more clearer to me than before tho. I really appreciate your help
So those image file i keep in this directory samples/oracle/{args.fstype}-{i}.image, do you think this will iterate all the image file one after another
for i in range(1,6): cmd = ( f'AFL_SKIP_BIN_CHECK=1 "./combined/afl-image-syscall/afl-fuzz"' f' -S "{instance_name}" -b "{shm_name}"' f' -s "fs/{args.fstype}/{args.fstype}_wrapper.so"' f' -e "samples/oracle/{args.fstype}-{i}.image" -y seed' f' -i "{in_dir}" -o "{out_dir}" -u {args.cpu_id}' f' -- "lkl/tools/lkl/{args.fstype}-combined-consistency"' f' -t "{args.fstype}" -i "samples/oracle/{args.fstype}-{i}.image"' f' -e "emulator/emulator.py" -l "/tmp/mosbench/tmpfs-separate/{args.log_id}/log"' f' -d "/tmp/mosbench/tmpfs-separate/{args.log_id}/" -r -p @@' ) time.sleep(3600)
So, I am using for loop to get all the image file from that directory samples/oracle/{args.fstype}-{i}.image and then it will run each image file for 1 hour so i set a time to do it automatically time.sleep(3600) and save it to the /tmp/mosbench/tmpfs-separate/{args.log_id}/ this directory
@trail sapphire do you think my logic is ok here to set this up like this
that won't work for several reasons
first you are not even executing the command, you are just putting strings in a variable called cmd, so you will need to run those commands as well in one way or another
second, if you where to run it like that the command would run until completion how ever long that takes (if it even ever really completes on its own accord) and then it will sleep for for an hour before continuing to the next iteration of the loop, it's not like a timeout for the command