#unix
1 messages · Page 1 of 1 (latest)
bash: cannot create temp file for here-document: No space left on device
not sure, suddenly my terminal not working as it does before:)
Where is /tmp located? It is looking for space on that partition, I assume
df -h /tmp
instead of running free, run df -h . to see disk space for the device that the current directory lives on
Thanks. I removed some files and dir, now it able to make it work
this happens to me when I open a file more than once
if you don't want to deal with swap files put this in .vimrc
set noswapfile
also i would suggest using fzf to find files instead
hi
ive got the latest os for my raspberry pi 3
ive set up my wifi adapter like this https://www.youtube.com/watch?v=oM2kAnITNyE
im not sure its being used over the internal antenna bc:
-i still see the wifi signal in the task bar
-when i do ip -br link wlan1 doesnt show instead i see wlan0 is up
-when i did iwconfig i see the same thing before and after rebooting (that it is connected to the desired wifi)
df -h
I'll take a look at it, thanks 😊
Hi jahid, you can ask vim for the location of the swapfile:
:set directory?
It should output something like directory=~/...., in which vim saves the swapfile
@fast stag start by checking your routing table with ip route and then try to ping -n 1.1.1.1 and ping -n 8.8.8.8 and see if you got basic routing and reachability
Hello, I'm trying to use WSL with archwsl, but my neovim is not showing icons in telescope or with the lualine, does anyone knows what am I missing?
you need a font that supports those glyphs
look into nerdfonts
https://github.com/ryanoasis/nerd-fonts
you may be interested in caskaydia cove
Great! but how can I install that on archwsl? I mean I know how to do it on windows... just go to releases pick a .zip that you want and just double click the font... but on archwsl how do I install it?
by archwsl do you mean an arch linux system?
(as WSL)
yes!
the README in that repo i linked above offers some options
you can either use install script, or use AUR
if you are nitpicky, you can always patch your own
Thanks a lott!!
let me know if you have any hiccups
mmm it didn't work
However I can see the font on the folder
it also has this config file
however my ~/.fonts file is empty?!
added more fonts and ran fc-cache -f -v but it didn't work either... :/ maybe is just the WSL, thanks for the help anyways
might been an oversight but what terminal emulator are you running and is it on Windows
not really a Windows user so i might've missed a detail
I'm running the windows terminal
but it works on powershell
and then select the font accordingly on Windows Terminal
hmm
powershell is a type of shell, not a terminal emulator
let me check if it's a Windows TErminal issue
nvm, that was my issue!!! omgg XD
I was doing a clean install again and forgot to put the font on the windows terminal settings
ah!
❤️
have you installed 'kyazdani42/nvim-web-devicons'
a lot of plugins use this to get icons
yes I did, the issue was that I didn't updated the font on windows terminal. Thanks anyways!
you probably want the rm -f file1 to be rm -f -- "$1" and that the other strings that $1 is used in should also be inside double quotes
the dubbel dash marks the end of the command options to a command so that whatever comes after will always be treated as a filename even if the value of $1 would start with one or more dashes
i think that should work 👍
but do you want testdir to be static like that or another parameter to the script
then it's probably fine as it is
hey, can anyone help me writing a script that runs on a .log and calculates average time?
what do you mean with "a script that runs on a .log"?
i think you will probably need to explain this better to even have a chance of getting any help with this
sent you a friend request
why not write here in the channel so that others can pitch in as well if they know how to do what you want to do?
^^
There are loads of tutorials on log parsing, maybe start here https://www.learnsteps.com/log-parsing-in-python-read-how-you-can-do-it/
Hey guys
I try looking up this error, but I can't understand it from a theoretical standpoint. Coould anyone please help?
@ me if so! ❤️
it means you're missing a library for running python itself
what distro? @hasty prairie
I am trying to troubleshoot my flask app deployment on centOS7 using gunicorn and nginx. This is the entry in my nginx log for a request to login page: 2022/07/27 09:59:46 [error] 23436#23436: *9 open() "/home/adankert/archives_app/archives_application/static/main.css" failed (13: Permissio n denied), client: 128.114.223.157, server: 128.114.128.27, request: "GET /static/main.css HTTP/1.1", host: "ppdo-dev-app-1.ucsc.edu", referrer: "http://ppdo-dev-app-1.ucsc.edu/login" 2022/07/27 10:00:01 [error] 23436#23436: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 128.114.223.157, server: 128.114.128.27, request: "POST /login HTTP/1.1", upstream: "http://[::1]:8000/login", host: "ppdo-dev-app-1.ucsc.edu", referrer: "http://ppdo-dev-app-1.ucsc.edu/login"Permissions for that main.css file are full:-rwxrwxrwx. 1 adankert nginx 1182 Jul 20 10:25 main.css...and this is the nginx.conf file: ```
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
client_max_body_size 500M;
default_type application/octet-stream;
include /etc/nginx/mime.types;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
}```
...and my nginx app conf file (archives_app.conf):```
server {
listen 80;
server_name 128.114.128.27;
location /static {
root /home/adankert/archives_app/archives_application;
}
location / {
include /etc/nginx/mime.types;
proxy_pass http://localhost:8000;
include /etc/nginx/proxy_params;
proxy_redirect off;
}
}
Hello,
I'm trying to install the Nvdia's Imaginaire Librarry
Using the instructions for Conda from https://github.com/NVlabs/imaginaire/blob/master/INSTALL.md
I'm stuck at this step
# install third-party libraries
export CUDA_VERSION=$(nvcc --version| grep -Po "(\d+\.)+\d+" | head -1)
CURRENT=$(pwd)
for p in correlation channelnorm resample2d bias_act upfirdn2d; do
cd imaginaire/third_party/${p};
rm -rf build dist *info;
python setup.py install;
cd ${CURRENT};
Details of the system are as follows:
python=3.8.6
pytorch = 1.10.1+cu111
cudnn = 8005
torchvision=0.11.2+cu111
torchaudio=0.10.1
cudatoolkit=11.1.1
OS Details:
Operating System: Red Hat Enterprise Linux Server 7.9 (Maipo)
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0
This is the error I'm getting
File "~/.conda/envs/imaginaire/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "~/.conda/envs/imaginaire/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 404, in build_extensions
self._check_cuda_version()
File "~/.conda/envs/imaginaire/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 777, in _check_cuda_version
torch_cuda_version = packaging.version.parse(torch.version.cuda)
File "~/.conda/envs/imaginaire/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py", line 49, in parse
return Version(version)
File "~/.conda/envs/imaginaire/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py", line 264, in __init__
match = self._regex.search(version)
TypeError: expected string or bytes-like object
Full Traceback : https://paste.pythondiscord.com/ucuxurizaw
I guess I need to reinstall python3.9 to properly install sqlite on my centOS7 server: https://stackoverflow.com/questions/20126475/importerror-no-module-named-sqlite3-in-python3-3 What is the procedure for removing python3.9 from centOS7?
I'm getting the following traceback
ImportError: /jmain02/apps/gcc/5.4.0/lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by $HOME/mambaforge/envs/imaginaire1/lib/python3.8/site-packages/scipy/linalg/_matfuncs_sqrtm_triu.cpython-38-x86_64-linux-gnu.so)
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 33636) of binary: $HOME/mambaforge/envs/imaginaire1/bin/python
Full traceback: https://paste.pythondiscord.com/poxanigapu
I'have tried this for gcc 9.1.0 (CUDA 11.1) andgcc 5.4.0 (CUDA 10.2)but both give the same GLIBCXX_3.4.30' not found and 'GLIBCXX_3.4.26' not found respectively.
both gcc's are available as modules that can be loaded individually
The results for libstdc++.so.6 are as follows
strings /jmain02/apps/gcc/5.4.0/lib64/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
Full: https://paste.pythondiscord.com/edobizociv
And for gcc-9.1.0
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
find . -iregex '.*\.\(jpg\|gif\|png\|jpeg\)$'
Why is the period literal when escaped but the parentheses literal when NOT escaped?
I'm a bit confused
can you give an example of what you mean by "literal when NOT escaped"?
That depends on the re standard. PCRE treats (as a group, and \( as a literal paren
BRE (iirc) is a bit perverse.
You can tell find to use PCRE .... it's in the docs somewhere!
-regextype is the option I was thinking of.
This option controls the variety of regular expression syntax understood by the ‘-regex’ and ‘-iregex’ tests. This option is positional; that is, it only affects regular expressions which occur later in the command line. If this option is not given, GNU Emacs regular expressions are assumed.
posix-extended is the type for using the PCRE standard.
I want to add a path to LD_LIBRARY_PATH if it already doesn't exist.
I added the following to .bashrc, however it keeps adding path even if it is already there
if [ -d "$HOME/mambaforge/envs/imaginaire11_test/lib64/" ] && [[ ! $PATH =~ (^|:)$HOME/mambaforge/envs/imaginaire11_test/lib64/(:|$) ]]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/mambaforge/envs/imaginaire11_test/lib64/
fi
I got it!
hello, could someone help me loop this last script?
#!/usr/bin/env bash
export "NAME=$(whoami)"
export BOT=MochiBot
printf "\nWelcome, %s\n" "$NAME!"
printf "My name is %s\n" "$BOT"
sleep 1
printf "\nI will be helping you with your initial server set up!\n"
echo -e "What would you like to start with?"
echo -e " ---------------------------------
1. | User Management |
2. | Distro Update |
3. | SSH Configs |
4. | Custom Installation |
5. | Exit Menu |
---------------------------------
For help option try \"1 -h\" or \"2 -h\" and so on.
"
export one="User Management"
export two="Distro Management"
export three="SSH Configs"
export four="Custom Configuration"
export five="Exit Menu"
read -r USERINPUT
# MochiBot telling the user his/her option
for USERINPUT in $USERINPUT
do
if [[ $USERINPUT == "1" ]]; then
echo -e "You have selected: $one\n"
elif [[ $USERINPUT == "2" ]]; then
echo -e "You have selected: $two\n"
elif [[ $USERINPUT == "3" ]]; then
echo -e "You have selected: $three\n"
elif [[ $USERINPUT == "4" ]]; then
echo -e "You have selected: $four\n"
elif [[ $USERINPUT == "5" ]]; then
echo -e "You have selected: $five\n"
else
loop
fi
done
sleep 1
# This "if" statement is used for User Management Option
if [[ $USERINPUT == "1" ]]; then
printf "Please Enter A User Name\n"
read -r custom_user
echo -e "The User Name will be: $custom_user"
sleep 1
echo -e "Would you like to add a discription to this user? (y\\\n)"
read -r discription_answer
if [[ $discription_answer == "y" ]]; then
printf "What discription do you want to add to this user?"
read -r discription
fi
useradd -m -s /bin/bash -c "$discription" "$custom_user"
fi```
# MochiBot telling the user his/her option
for USERINPUT in $USERINPUT
do
if [[ $USERINPUT == "1" ]]; then
echo -e "You have selected: $one\n"
elif [[ $USERINPUT == "2" ]]; then
echo -e "You have selected: $two\n"
elif [[ $USERINPUT == "3" ]]; then
echo -e "You have selected: $three\n"
elif [[ $USERINPUT == "4" ]]; then
echo -e "You have selected: $four\n"
elif [[ $USERINPUT == "5" ]]; then
echo -e "You have selected: $five\n"
else
loop
fi
done```
This one ^^^^^^
Assuming bash supports it, I would do this with a while (true) loop and then do a break for all cases where you want to code to exit.
i.e. instead of having 'loop' as a goto type statement, you have a loop that you break out of when you have what you need.
I wish it was the same as Python 😭
So I have to use while loops instead of for loops?
then just call python with the $USERINPUT string 🙂
Wait… could I integrate my .sh with .py ?
no, assuming $USERINPUT is something that you loop over, make another loop around it
while True:
should_exit = False
for user_input in user_inputs:
if user_input == '1':
should_exit = True
else:
pass
if should_exit:
break
As long as I put an installation command inside of my .sh of py
Wait what’s the “pass” command do?
Or that’s just an example
For Python
pass does nothing, but avoid syntax error, so code is identical to
while True:
should_exit = False
for user_input in user_inputs:
if user_input == '1':
should_exit = True
if should_exit:
break
Ahh I see
But I don’t want to make them to break or exit
I want it so that the whole if statement repeats
If the input doesn’t match with any “if statement”
Is that possible with bash?
the above code should do that, but it is untested and I may be misunderstanding what you are trying to do
and yes, I assume the above should work fine in bash
just need to translate the syntax
Okiee okiee thank you so much! I’ll tinker with that code 🙏🙏
Hi, this will be kinda out of the topic but I will try to ask anyway. I am trying to learn basics of bash scripting and I have come across a strange thing. On the internet ,it is written that when you create a script with touch it should not be executable by default. But when I create it, it is already executable and it seems to have all permissions. So I would like to ask what is the reason behind that. I know that it is probably nothing important, but I would like to understand it. I run Bash with Ubuntu on my windows computer.
anyone know how to make this stop after first match?
Hey man
I found another way to do it 😮
export "MOCHIHOME=$(pwd)/test.sh" # PLEASE RE EDIT THIS EVN PLEASE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
export "NAME=$(whoami)"
export BOT="\"MochiBot\""
export LOOPEND=""
clear
printf "\nWelcome, %s\n" "$NAME!"
printf "My name is %s\n" "$BOT"
sleep 1
printf "\nWould you like to save me as a shell command? [y/N]\n"
read -r COMMAND
while [[ $LOOPEND == true ]];
do
if [[ "$COMMAND" == "y" ]]; then
alias mochibot='$MOCHIHOME'
else
$LOOPEND -eq true
fi
done```
I just did like this
lmao
Every time I restart my linux installed on TX3Mini TV Box, there is some error regarding the ethernet connection.In 3/5 of the cases it does connect but 2/5 times it fails to "establish connection". Point to note here is that the Connector is perfect, the Lan Cable is also not moved. However if Lan Cable is disconnected and then connected, the connection is "established". Recently I figured out that even if I restart the network adapter internally by turning off LAN, and turning it back on again fixes the issue - "Connection Established". This made me think that there might be some bug in the network adapter (idk what). How do I check (prolly check weather the device has got ip or not )this on every boot? and reset the Network Adapter accordingly automatically without being the root user (i.e. not using systemctl
)?
Thanks in adv
Heyy, I just switched to Mac (Apple Silicon), from linux and am not being able to install numpy or pandas. using the pip install command.
I am getting system legacy errors, I have checked github issues and stack overflow too, but nothing could solve my problem. Can someone help me out here?
post a transcript (as text, not a screenshot) showing what you're doing and what you're seeing
I've installed those packages on Apple Silicon and had no trouble
Thank you for the prompt reply. I'll add my shell logs here.
Collecting pandas==1.2.4
Using cached pandas-1.2.4.tar.gz (5.5 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
..........
clang: error: the clang compiler does not support 'faltivec', error: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -arm64-3.8/numpy/core/src/multiarray/alloc.o -MMD -MF build/temp.macosx-12.5-arm64-3.8/numpy/core/src/multiarray/alloc.o.d -faltivec -I/System/Library/Frameworks/vecLib.framework/Headers" failed with exit status 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> numpy
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: You are using pip version 22.0.4; however, version 22.2.1 is available.
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
This is just some part of it.
If we could connect on a help channel (or over a screenshare) and you could guide me, it would really help me
I am a newbie to mac, so might be missing a very basic thing too.
sure get a help channel
hi, im using ubuntu to host a flask webserver - usually i use screen so i can work on it while and have it run on the side. but now i want to set up the web server to restart daily so it stays smooth. i am thinking of either using a cronjob, or setting up the server as a service. but in either case, i am not sure how i would be able to access the "running log" of the script?
redirect to a log file?
that would be a way i guess, but i was hoping thered be a better way, like telling the cronjob to open a new screen for the process or something?
you could, but that seems like more effort for the same result
you can always just tail -f the log file if you need to follow the log
if your ubuntu server is using systemd (which i believe it normally does out of the box) you could setup a unit file for it instead of using screen for that
that works too, i guess the best way is just piping the output of the cronjob to a log file in the end
man, i need to set up some firewall rules...
If I would be doing it...
It would be flask app running in docker container with policy restart always
And there should be also second container (side car) that has access to docker Daemon though TCP or grabbed sock by volume. It would be having scheduled Cron job or Celery beat, or even dead simple while true script with sleeping for 24 hours, and launching script to kill first container, which will invoke its autorestart
Advantage? Zero dependency on OS. Everything is packed into one docker compose application with easy later migration to k8s (side car container would be still needed adjusted to work thorough k8s control instead of using docker Daemon though)
Application with autorestart is installed(or deinstalled) in one command
find out what "init system" runs on your computer, and use it. I have a machine that uses "systemd" and my recipe goes like this:
- I write a ".service" file -- pretty easy to do -- and put it in
/etc/systemd/system sudo sysctl enable my.service- to actually start it, do
sudo systemctl start myand to stop it dosudo systemctl stop my.
Tail the logs via journalctl -f -u my | less +F --chop.
In general I would not care about restarting my flask app in the first place.
Gunicorn is reliably replacing dead childs.
Rest application is not supposed to having any state stored in it / completely stateless, therefore no point to restart it if nothing is endangering it.
I would be fully satisfied with just having policy restart always
that sounds great, i wanted to take a look at docker anyways (never used it before), thanks
yea i saw that i could use services aswell instead of cron, but wasnt sure if i could pipe the output that way or if i would have to change my script to pipe the output to a file from there
Feel free to start looking from here
Just for the sake of regular Linux non docker situation, which is completely awful but I should mention:
U just need to have then in /etc/systemd script to run your flask app as Daemon(background task). systemctl start/enable my_app
And... I guess using Cron job is simplest to run command systemctl restart my_app from time to time?
Or while true script that does the same as second systemd Daemon.
Due to being awful non docker situation, I would wish to have it at least auto installed with configuration management tool like Ansible. U will be able to auto setup app, and restart, and daemons as part of one installing script
Choose /dev/sda
Remove installer when it finishes, and restart PC. U will be able in grub choosing Linux or Windows (if u kept it installed) on start to launch
Ok
I am installing grub now right?
It's on "[finishing the installation]"
Ah installation complete
Yeah. Grub is little program one the first partion of your hard drive. It just allows to choose launching which OS/partion with which OS after that
I can't see what u see
xD now be a good boy and install 50 more Linux distros to try everything. Just kidding.
Highly recommending Kubuntu anyway for nice GUI and easy to install stuff
Uh....
Where to and how to install kubantu
Hello?
https://kubuntu.org/getkubuntu/ get kubuntu desktop, write to usb, install, ???, PROFFIT!
I would prefer kubuntu 20.04 LTS or kubuntu 22.04 LTS may be it is time already to install 🤔
About 20.04 i am sure, but 22.04 could be too early
It is faster to download through qbittorrent xD
Btw that's how kubuntu looks like
I have a question
Can I veiw and use all the apps and stuff from windows in linux?
It's dual boot
u can see files, but you can't launch apps from windows unless u know Wine magic at a god like level
i live in linux for 2 years and still have no idea how to use Wine at that level xD
Damn
it is easier just to restart PC under different OS in order to launch application
Yeah yeah
Well thanks anyway
I will learn it's basics and then I'll clear the doubts here maybe
Linux has different set of easy to install programs.
Linux is best if u a web developer, or Linux developer, may be even Android devs will feel themselves cool here
Windows is best to play video games and creating programs for Windows
They have different ecosystem of applications, which sometimes can be installed at both, sometimes only at one of them
U can sort of consider Linux being operational system as full scale IDE (like pycharm / vscode), but your whole OS is a development environment
Hi guys can anyone tell me? I'm using Ubuntu since 3 months , with 4Gb RAM and 256GB SDD but while i use chrome or any browser with multiple tab then my ubuntu become get slow and freeze ? kindly anyone know?
Try using a lighter browser, like firefox.
or does it happen with firefox too?
4GB of memory is not a lot
if you run ubuntu there's a good chance you are running gnome, you might consider using a lighter weight desktop environment as well (it might be a little bit more basic but will also preserve some of your ram) like LXDE or it's qt based sibling LXQT, or possibly Xfce which might be better looking but not as lightweight
or even install a lightweight linux distribution made for low memory systems to begin with that comes with such a desktop environment as default among other things designed to run on resource constrained systems
yeah, a hard-core tiling desktop environment might not be very user-friendly if you never used one before and are coming from windows/mac/chrome book previously
but sure, it's a pretty good fit for low mem systems if i remember it right
nginx is not able to access the files in the static directory of my flask app. Here are most recent logged nginx errors: 2022/08/01 12:01:01 [error] 2651#2651: *47 connect() failed (111: Connection refused) while connecting to upstream, client: 128.114.221.1, server: 128.114.128.27, request: "GET /login HTTP/1.1", upstream: "http://[::1]:8000/login", host: "ppdo-dev-app-1.ucsc.edu" 2022/08/01 12:01:01 [error] 2651#2651: *47 open() "/home/adankert/archives_app/archives_application/static/main.css" failed (13: Permission denied), client: 128.114.221.1, server: 128.114.128.27, request: "GET /static/main.css HTTP/1.1", host: "ppdo-dev-app-1.ucsc.edu", referrer: "http://ppdo-dev-app-1.ucsc.edu/login" I was wondering how I can best serve the file from its location inside the user home directory instead of "/usr/share/nginx/html"?
I'm unsure why nginx is not able to access these files. The permissions are as permissive as possible: ```drwxrwxrwx. 3 adankert nginx 59 Jul 20 10:25 static
Would i need to change permissions for the entire user directory structure from home up-to and including static/ for the nginx user to access them?
Hi svengoolie 🙂 Are you sure that static is looking at the same directory as you are? If you change user to the nginx user can you access the files there?
yeah. I just chmodd 777 the whole user directory and now it is able to access the static files/ use the css file
Great 👍
odd that none of the instructions for standing up this stack mentioned having to do that and that it wouldn't have worked even if the files and static directory itself was chmod 777. Very frustrating.
I can imagine. I believe we use www-data as our nginx group ownership
yes, at least enough for the user or one of the groups the nginx user is a member of
you don't really need to (and should) give everyone full read permissions and absolutely not write permissions
777 is a very bad idea for almost anything when it comes to security
nginx only need read permissions to the static files and execution permissions for the directories (not the files)
i don't think it even needs read permissions on the directories if you aren't going to support presenting a directory listing
it's best to give these permissions to a group that nginx is a member of instead of using "everyone"
Both my user account and nginx do belong to the same group 'nginx'
then that is a good group to use for your static directory tree
Does it need to own it the entire path, from user directory to the static file? because it already was the group: ```
(.venv) [adankert@ppdo-dev-app-1 ~]$ stat -c "User:%U Group:%G" archives_app
User:adankert Group:nginx
(.venv) [adankert@ppdo-dev-app-1 ~]$ stat -c "User:%U Group:%G" archives_app/archives_application/static
User:adankert Group:nginx
(.venv) [adankert@ppdo-dev-app-1 ~]$ stat -c "User:%U Group:%G" archives_app/archives_application/static/main.css
User:adankert Group:nginx
if 777 is a bad idea, what about 7777?
an even worse idea
Yeah, go ahead and execute this file as me. It's ok.
hehe, yeah, not the best idea ever
I actually learned about that flag because ping was giving me errors
the solution: chmod 4744 /usr/bin/ping
the sticky bit (1xxx) is typically used for /tmp
why, did you need to flood-ping or at least ping with less than a 0.2 seconds interval?
I didn't.
All I did was ```console
$ ping google.com -v
ping: Operation not permitted
I'm going to blame it on installing fedora into WSL from scratch
oh, wsl...
by scratch, I mean I used the fedora docker image as a base
and i don't know about how complete of a system the docker image is
so, might not be the best starting point for a system
I was following a guide. It seems to work fine after I did dnf group install "Minimal Install"
and the guide was technically for windows 11 while i had 10
still, [the docker image] might not be the best starting point either way
Honestly, My laptop isn't the best to use WSL.
There's a bug with Cisco AnyConnect that causes wsl's default gateway and dns servers to be wrong.
I have to disable wsl networking and configure it manually
you mean that the wsl system won't use the VPN?
that is unfortunately quite common with both wsl and virtualization together with VPNs
even if I'm not connected to the VPN, it won't work
oh, that's a twist, usually it's just that it will not use the VPN and use the normal network as if there was no VPN connection
anyconnect is used by corp to make sure our laptops are compliant before we can access any internal resources.
that is also quite common, then it can be a problem using the network with any virtual systems
depending on how it's setup in the enterprise network you might be able to workaround that, in other setups you more or less can't
I workaround it by disabling wsl networking and configure it manually
Hi guys, I am having an issue to create ext4 file, before I used similar command and it worked but now its not working:) Can you please help, what could be the reason. The command i used as follows:
$ mke2fs –t ext4 –c ext4-04.img -F -I 128 –O inline_data
mke2fs 1.44.1 (24-Mar-2018)
mke2fs: invalid blocks 'ext4' on device '–t'
just increase swap https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04 (to utilize your SSD as RAM)
and optionally enable ZRAM https://www.maketecheasier.com/configure-zram-ubuntu/ if u have fast CPU (to utilize your RAM.... as more RAM through data compression)
Hey All, having some issues with a library.
I wonder if anyone recognizes the issue below and could help?
[ERROR] OSError: [Errno 8] Exec format error: '/var/task/ffmpeg'
Traceback (most recent call last):
File "/var/task/CreateThumbnail.py", line 101, in handler
create_video_thumbnail(bucket, key, file_name, extension)
File "/var/task/CreateThumbnail.py", line 74, in create_video_thumbnail
resize_video(thumb_download_path, thumb_upload_path)
File "/var/task/CreateThumbnail.py", line 32, in resize_video
with VideoFileClip(video_path) as video:
File "/var/task/moviepy/video/io/VideoFileClip.py", line 88, in init
self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,
File "/var/task/moviepy/video/io/ffmpeg_reader.py", line 35, in init
infos = ffmpeg_parse_infos(filename, print_infos, check_duration,
File "/var/task/moviepy/video/io/ffmpeg_reader.py", line 257, in ffmpeg_parse_infos
proc = sp.Popen(cmd, **popen_params)
File "/var/lang/lib/python3.9/subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/var/lang/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
Additional bits of info:
Value for proc: [‘/Users/Tom_Hanks/Documents/CreateThumbnail/ffmpeg', '-i', '/tmp/-866f0413-cb25-4f7d-8916-f8104c03fb5cunicorndrops-public-drops---sample-video.mp4']
executable binary value: os.environ["IMAGEIO_FFMPEG_EXE"] = f"{CWD}/ffmpeg"
i reckon you should make a help channel for this mate
Yes , same problem causing with firefox also
which ubuntu
looks like mac to me
Help!!
Someone
cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
What to do
I've just ran top, and got this (not my VPS): PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2573975 sammy 20 0 3375900 2.3g 3008 S 793.4 7.8 10229:36 kswapd0There's no way this is normal, is it?
Ah I see, I wonder what the cause of it would be. I just ran this: dan@vmi840593:~$ sudo find /home -name kswapd0 /home/sammy/.configrc/a/kswapd0
Though I'm not entirely sure what it means
I ran cat on that file and it's just a bunch of weird symbols, the rhombusus (rhombusi?), as though you're looking at a corrupted file on Notepad, and there's just so much of that, took 10 seconds until it stopped scrolling automatically.
I've seen some posts about people hacking in and using cryptominers on VPS', it's not my own VPS, so I'm not quite sure what security measures are in place. No SSH keys for all I know.
kswapd0 manages virtual memory
Hello, idk if this is ok but would anyone like to review my code? or maybe test it and see what I could improved to it?
||https://github.com/mochimosh101/MochiBot||
Ergh. Dunno how to say it nicely. Ergh... you made a wrong choice of technologies in the first place
Writing complex CLI interfaces in Bash? That's just a recipe for disaster
recommending stuff like argparse library since we are in python server
it is possible to build a python program without any dependencies if desired, or having it actually compiled to binary for reusage at any distro
with python it w ould be possible to have it written architecturaly nice? 🤔
#unit-testing message I kind of bubbled about it there
firstly i would like to see actually unit tests for your program? 🤔
using argparse or similiar libraries usage of your thing would be self documented, as it auto builds help information and which choices can be made in CLI interface
Ahh I see thank you so much, I don’t really mind if you bash on that code since it’s the very first code I ever made 🤣
I’ll try to redo it with Python
But what is argparse?
feel free to read stuff like Code Complete by McConnel in addition https://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670
people like clean readable code
where each variable / function / class name are carefully chosen and linked to each other to try telling... in human language what is going on
together with tests, which describe usage cases, it makes almost complete self documentation
which is having filled gaps with comments in difficult places, and docstrings to describe usage more fully
writing code is about writing something that u will be able to read and remember what it does a year later (or by other programmers)
something like
find ./ -name *.log- for each above result
grep "galloc" $each, add them to an array? - https://stackoverflow.com/a/1951523 command $(dirname -- "$array_item")/*.gjf
I hope there's a better way, but until you find it -- ```
find /tmp/ -name '*.log' -print | while read lfn; do (cd $(dirname $lfn) && grep -q galloc $lfn && echo $lfn); done
one problem that leaps out at me: if the file name contains spaces, it'll break
this is the sort of thing I'd use python for, not bash, just sayin'
this is another way for each in $(ls -1); do echo "$each";done
use find instead of ls -1 of course 😄
Hi guyes any idea why I am getting such error while this works before but now its showing this error:)
$ dd if=/dev/zero of=ext4.img bs=8k count=2048
$ mke2fs –t ext4 –c ext4.img -G 16 –N 32 –O flex_bg
mke2fs 1.44.1 (24-Mar-2018)
mke2fs: invalid blocks 'ext4' on device '–t'
your dash characters seem wrong somehow
look at the -G. That's a normal dash. The other ones are longer
idk how that would happen
– vs -
looks like it's an En Dash character
@wet folio
hi everyone, i have this bash script which im trying to write on python but after hours of reading i cant find a way
#!/bin/bash
for i in seq $2 $3
do
ip="${1}.${i}"
[[ -n $(ping -n -q -c2 ${ip} | grep -w ms) ]] && echo $ip
done
for example seq $2 and $3
how can i add them on python to my script?
Thank you, I'll try it again and see if it works or not:)
maybe ask in a help channel
btw what do you mean by "on python"? Do you mean you want to translate that script into python?
yes, someone already did help me
thanks
also: any reason you're not simply using nmap?
can someone tell me if there is a good list of compatiblities between ubuntu versions and python? e.g. 20.04 only supports python 3.9 apparently, and ubuntu 18 only 3.8
What?! i have installed python3.10 at my ubuntu 20.04
https://computingforgeeks.com/how-to-install-python-on-ubuntu-linux-system/ u just need to add necessary repo to apt
plus i added to the end of file ~/.bashrc
alias python='python3.10'
alias python3='python3.10'
which ensured it being my default python in CLI interface
personally i don't recommend using the system-provided python at all if you care about what version of python you are using
that alias should be mostly safe though
in general, python should be considered a core system dependency, much like libc and perl. if you want a specific version, use a separate package manager like pkgsrc or homebrew, or a version manager like pyenv or asdf-vm
obviously it's fine for just plunking around, but if you're doing serious software dev you'll want a bit more control than "whatever is in my os package repos"
i know but i thought that python 3.10 just wasnt compatible, after all python 3.8? doesnt run on win7 either
good question. python 3.10 should definitely run on any linux-based operating system unless something is really really weird in the os
you mean when they call it android ?
For serious package manager version, I just attach my IDE to running app container in docker compose, which has grabbed current project folder in volume for hot reloading. All project dependencies including necessary installed compiling libraries are surely present and documented as code xD and required dB versions and etc
I still wish installed python3.10 so I could run my small scripts which use match-case syntax and new typing
@loud crypt Sorry i think i met with the wrong guy
okay
20.04
Because im pretty sure i tried to install 3.10 on 20.04 and it didnt work, but maybe i did something wrong (i did change repo)
I have 20.04 with successfully installed python 3.10, u just did something wrong. Follow guide I linked, I did it
what IDE do you use, pycharm? i had been looking for a good workflow w/ containers like this but the tooling support seemed deficient, especially for things like interactive debugging
vscode, official free Remote Containers plugin from microsoft.
- pytest explorer is my favourite plugin due to enabling visual debug during pytest execution. So interactive debugging is pretty much working from within containers.
Filenames that end with ~ - usually temporary build files or similar
thanks, that worked just fine!
actually, seems like it doesnt really work fine? i could install python3.10, but the venvs seem to be broken, and pip isnt included either - i also had to install python3.10-venv, so the venv works at least now
pytest explorer is also a vs code extension? i had heard that vs code had good support for working in containers.. i really do NOT want to use vsc though, so maybe i'll stick to docker exec -it for now 😛
if you don't mind, i had two more questions about container workflows:
-
pip install and wheel caching across containers and image rebuilds, beyond what you can do by just ordering dockerfile stages cleverly. i read some articles showing that it was possible, but it seemed like it required some pretty advanced knowledge of docker. is it actually complicated or not that bad?
-
handling a project in a monorepo with multiple local dependencies. i always ended up having to
rsyncfiles into my current source tree, and use anentrypoint.shscript with some version ofpip install --no-deps -e . -e ./.sync-- is there a better way?
- is easy, nothing advanced, I ll write once I reach PC
- could u clarify what u a doing there better, why are u doing it
Its been pretty annoying to type in the password for sudo every single time I use it, is there a way to disable it safely, I know I could disable the prompt for sudo enabled users - but is this really a good idea? I could set up an AHK hotkey to paste it in, though prior to this I thought I'd ask.
- it's relatively easy, we use three image bases for over 200 microservices. No major issues
- I use
docker cpsome times when I need stuff from my containers in my local tree. I have also use volumes for that but I don't like to change too much the way containers are created between envs
sudo -s
do you create a new base image for a project whenever a dependency is added or changed?
I'm aware of this solution but I've been told its not really safe
sudo -s as a single command before other commands
regarding volumes, i find them essential otherwise my development cycle turns into "write, build, wait, test" at which point i might as well not be using Python anymore. do you just use a more asynchronous development workflow?
U can't have security and disabled security at the same time. U need to make a choice xD
usually by default you don't have to type it in again for the next 15 minutes or some thing like that, within a single shell session
yes, we are constantly changing the base. That implies we also need to constantly run tests to ensure nothing unexpected gets broken. Bumping version is done manually per microservice, usually when it is required and not a routine task
i see, that makes sense. in my last org we only had 1 base image which was just the lowest common denominator for all images, and modifying it it was very rare / frowned upon, so every microservice had a bunch of its own deps added on. so maybe that was more of an institutional failure there.
there are scenarios where I need to rebuild the whole image, e.g. for aws lambda images, I use nodemon to catch changes, kill the container, build it and run it again, sounds too much but doesn't take more than 1 or 2 seconds to reload everything
one day i will find a cure to this ball cancer inducing feature
make the timeout longer? i think there's a way to set it such that you only have to type it once per shell session
1 or 2 seconds to reload everything
this is not my experience in general, i felt like 5+ second startup was typical even without rebuilding any layers
we still have dependencies in every microservice. But something like flask, requests, etc. It's controlled in the base
right, i was talking about caching downloads and wheel builds for the service-specific dependencies
again, docker layer caching mostly fixes it, but not always (and not at all in CI, where it was the biggest annoyance & i felt like we were really abusing pypi)
but that cache remains in the base, isn't it?. Can you describe a flow scenario?
if you run pip install in the dockerfile for your microservice, it still needs to connect to pypi and fetch the packages and install them. i'm talking about deps that are not in the base image. so that's why i asked if you created a separate base image for each service, which would let you avoid that issue.
ahm. Yes, that's correct. We have not a solution for that 🤔
i've been wanting to run a local pypi mirror at least as a workaround
I know we have images mirrors, not for python packages though we have our own packages in a kinda pypi server
you can have it in CI, docker build --cache-from image, then u will be abusing just your docker registry xD
also as a choice... CI can be using persistent docker daemon, then it would be natural docker caching, then there will be no abuse at all.
CI can be using persistent docker daemon
i've never been in control of my own CI system so that's pretty cool. seems like it would save a huge amount of computation and network i/o compared to what i've used in the past.
this is also useful for me. Thanks 🙂
Why can't root see modules installed as non-root?
I installed pythonping without root, now since python needs root to be able to ping I need to install pythonping AGAIN now with root
same with every other library
when you installed as non-root, the modules went into ~/.local; when you're root, that directory isn't on the PYTHONPATH
oh ok
I second this. Use it all the time in CI, though it's for personal projects so I've not had to worry about abusing the GH registry. Instead of using the registry, the image could be uploaded as a tar elsewhere and loaded in with docker load.
Hi guys, I got a question, Why is flex_bg in mke2fs used in place of (-G) blocks_per_group? Isn’t flex_bg a feature that doesn’t take values?
Can someone recommend a linux centered discord server? I want to ask a few questions about user management in linux
Thanks. Kinda crazy that they want you to fill out a google form to gain access to the channels. Seems fishy
does anyone know the best way to query an AD from a python script on linux? ldap3 only works on windows, and i couldnt find which other module works as well and is as simple as ldap3 but runs on linux
<@&831776746206265384> swearing
Random screen shots of code is off topic and not appreciated.
hey,
I've updated my VS a few weeks ago, and I'm having weird visual glitches in VSC since.
On the left it can be seen that selected sections overlap, and on the right.. well..
maybe in #editors-ides ?
Forgot to mention, I'm running PopOS (Ubuntu 22 04 LTS), that's why I posted it here.
But sure, thanks
Maybe try Codium, I find it sometimes more stable then VS Code on Linux but completely identical otherwise
I've been using a VM for my Arch install forever now, but i'm spending so much time in it that I should just dual-boot.
Is it worth sharing an NVMe with Windows if I don't have a second or should I just chuck it on my 860 EVO?
I heard windows updates fuck with grub.
Windows used to make a mess of GRUB, iirc. At worst all you need is a boot USB stick to rewrite the grub/EFI partition. I think Windows is better now, but I can't swear to that as I don't have any recent dual boot experience.
Yeah, I used to share linux and windows on a drive and had some boot problems but this was years ago now.
mm yeah, that's why for extra carefullness it is nice to have...
Windows having alocated its booter at the beginning of one disk
Linux is alocated at another physical disk
no problems to run both xD
Feels like a waste not to utilize this free space on my NVMe
😩
Just gonna slam it in there for now
If they don't play nice i'll move it
Trying to use a windows share on a centOS7 server. I mount it with this command:
0777 //ppcou.ucsc.edu/Data /home/adankert/mnt``` ...but when I try to use it with python I get ```ConnectionRefusedError: [Errno 111] Connection refused```
I am using the correct user: ```py
os.getuid()
233846
Any thoughts on what might be amiss?
sed -nr '/[A-Z]*mouse/,/[A-Z]*mouse/{s/.*/Lamb/;gIw lambout.txt' alice.txt I am trying to replace all the text inbetween case insentive *mouse and a second *mouse with the word Lamb. I believe I am on the right track, but I keep getting errors
Any ideas?
Hm, is that some fork?
Free/Libre Open Source Software Binaries of VSCode
You'll need an extra package (available on AUR) to enable pylance
Uh
how do i install the python3-config command on linux ec2 instance?
It may depend what image you're using, is it Amazon Linux? And are you asking about the pip package 'python-config` or something else?
no
not the python3-config package
the command
and it is amazon linux
Maybe dnf install python-configparser but I'm not sure
dnf command not found
How about yum ?
need to be root user, which i am not
i just tried sudo yum install python-configparser, it says there is no package named "python-configparser"
nvm i installed it
python3-config
$ mke2fs -t ext4 -c ext4.image -O casefold
mke2fs 1.44.1 (24-Mar-2018)
Invalid filesystem option set: casefold
Hi guys, any idea why this command is not working:)
how do I check which kernel I am running? Do i need to install latest mke2fs?or update?
$ uname -r 5.8.0-050800-generic
$ sudo mke2fs.ext4 -V sudo: mke2fs.ext4: command not found
Isnt is the latest one?
no idea if latest but new enough. no idea why it's not working then, was just a blind shot. and it's mkfs.ext4 -v i think
You most likely need python3-dev, too (which depends on python3-config)
I am working on mke2fs, isnt both are different to each other?
i believe mke2fs -t ext4 just calls mkfs.ext4
@wet folio still no idea why it's not working for you. it work in my setup:
10+0 records in
10+0 records out
10485760 bytes (10 MB, 10 MiB) copied, 0,0812773 s, 129 MB/s
% mkfs.ext4 -c xxx.img -O casefold
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 2560 4k blocks and 2560 inodes
Checking for bad blocks (read-only test): set_o_direct: Invalid argument/0/0 errors)
done
Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
% mkfs.ext4 -V
mke2fs 1.45.5 (07-Jan-2020)
Using EXT2FS Library version 1.45.5
% uname -a
Linux logrus 5.15.0-41-generic #44~20.04.1-Ubuntu SMP Fri Jun 24 13:27:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux```
just nearly fully upgraded ubuntu 20.04
I'll give it a try on Ubuntu 20 then, I was using Ubuntu18 tho. Seems yours is latest:)
Thank you for trying on your end to verify it. Its helpful
Does uname -a or -r is same as check LKL version as well?
Or it needs different command to check LKL version
$ mke2fs -t ext4 -c ext4.img -E encoding=3 -O casefold
mke2fs 1.45.5 (07-Jan-2020)
Invalid encoding: 3
Bad option(s) specified:
Extended options are separated by commas, and may take an argument which
is set off by an equals ('=') sign.
Valid extended options are:
mmp_update_interval=<interval>
num_backup_sb=<0|1|2>
stride=<RAID per-disk data chunk in blocks>
stripe-width=<RAID stride * data disks in blocks>
offset=<offset to create the file system>
resize=<resize maximum size in blocks>
packed_meta_blocks=<0 to disable, 1 to enable>
lazy_itable_init=<0 to disable, 1 to enable>
lazy_journal_init=<0 to disable, 1 to enable>
root_owner=<uid of root dir>:<gid of root dir>
test_fs
discard
nodiscard
encoding=<encoding>
encoding_flags=<flags>
quotatype=<quota type(s) to be enabled>
Why its showing invalid encoding 3, isnt it right number to use?
Any suggestions please:)
would like to see this one please:)
encoding=3 was not working for me either, same error
I see. I don't see anything they mentioned like number or else. But previous one worked as you mentioned when I tried on Ubuntu 20, latest.
Hello guys, How can I execute a pyqt script through ssh on a remote deskop?
When ever I run the script, I get xhost: unable to open display
I have a remote desktop open on the side. I want to launch the script on this remote desktop rather than the actual monitor.
Running xrandr --query on the rdp client gives
Screen 0: minimum 256x256.....
rdp0 connected primary 1980x1080+0+0 0mmx0mm
1920x1080 50.00*
I then exported the name rdp0 using the command export DISPLAY=:rdp0
and When I run xhost +username I get xhost: unable to open display ":rdp0"
What am I doing wrong ? is this not possible ?
As in export DISPLAY:${rdp0}
Not sure, how can I check that. That's the exact output of the command
Try it, see what echo $DISPLAY says
After running the above echo results :
from which operational system to which one you are connecting?
So $rdp0 is not set
I got it. I was doing echo $DISPLAY on the ssh 
instead of the rdp client
which returned me :10.0 and using that it start the session
Thank you
;)
Hi guys, anyone could help, how to install or update mke2fslatest version on my Ubuntu 18
No idea if that's feasible or not, but have you tried https://sourceforge.net/projects/e2fsprogs/ ?
Download Ext2/Ext3/Ext4 Filesystems Utilities for free. The Ext2/Ext3/Ext4 Filesystem Utilities (e2fsprogs) contain all of the standard utilities for creating, fixing, configuring , and debugging ext2, ext3, and ext4 filesystems.
Hey guys, Does any of you know of a good Linux Distro for hacking and etc..
kali or parrot
both come with all the tools you would need for "hacking"
but definitely not a good idea to daily drive
No, I was thinking of pip install it but could not find anything. kinda bothering me
Any idea guys, how to use encoding in this syntax to make this work?
@wet folio it says that by default it's UTF8 and when I use -E encoding=utf8 it works. I found one page (from 2020) that says there's no plans for other encodings, not sure if it's legit or not, you have to look in kernel code to be sure I think
sure, i will do it then
Thank you so much
Btw can you share that page link please:)
uh closed it already and can't find it again. but this guy is showing where to look in kernel source: https://unix.stackexchange.com/a/559022 (i didn't check latest linux)
@wet folio ⬆️
Thank you so much, I will look into it
$ sudo apt-get install e2fsprogs
Reading package lists... Done
Building dependency tree
Reading state information... Done
e2fsprogs is already the newest version (1.44.1-1ubuntu1.4).
The following package was automatically installed and is no longer required:
linux-hwe-5.4-headers-5.4.0-121
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ e2fsck -V
e2fsck 1.44.1 (24-Mar-2018)
Using EXT2FS Library version 1.44.1, 24-Mar-2018
``` Not sure, why its not updating the version to 2020 one, still keeping the old 2018
Is there any way to update LKL version?
is there a way to put an if statement in this so if theres more than 10 connections it will just reply with the amount of connections?
ex:15 total connections
netstat -tn | grep tcp
You want to do this in bash? Should be possible as it does support conditionals... wc -l gives you line count which I guess would be same as number of results. Would make an ugly one-liner but I think you can do it
instead of echoing over and over which fills up the screen, is there a way to keep the TCP connection(s): part and replace the $est part?
INTERVAL="0.5"
host=`hostname -I`
IF=$1
while true
do
est=`netstat -a | grep established | wc -l`
echo -e "TCP connection(s): $est"
done
use a carriage return (\r) perhaps
Guys, please help, how can I debug such file below on gdb or llvm:)
$ ls
id:000000,src:000247,op:fs-havoc-generate,rep:4
:(
So when I type like this it gives me such output
$ file id:000000,src:000247,op:fs-havoc-generate,rep:4
id:000000,src:000247,op:fs-havoc-generate,rep:4: Maple help database
anyone using dwm?
can someone help me out with setting up things like dunst, redshift etc?
better? they are making it an nightmare to dual boot it with linux
does anyone know how to get a python script running in a screen session via crontab? im on ubuntu 22.04 and sudo crontab -e -> @reboot /usr/bin/screen -dm python main.py doesnt work - i think i need to tell it the correct path, but whats confusing me is that there is no screen session open at all when i use screen -r which i would expect
why would you need running script in a crontab from session? 
why not to run python script just in crontab? without session?
so that i can see stdout without having to pipe the output to a file (its a flask app)
hmm... a more proper way within baremetal linux way would be to put your script into systemd service (google guides like https://unixcop.com/how-to-create-a-systemd-service-in-linux/ ) and activating your crontab as systemctl start service_name
and then requesting short logs as systemctl status service_name
or full logs as journalctl -u service_name.service (https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs there is flexibility to choose in which time range)
then it is configurable to have log time retention. or may be it is even in default
then u will be using... default log system of a linux OS.
it is much more proper than hacking session which is meant for users TUI usage only
yea thatd be the best case but as it is really not a big application i wanted to avoid a large logging or service backbone, but i guess then i am stuck with just running it directly in cron with piping the output
get used to creating systemd daemons. that's easy
if u run stuff in baremetal linux that's best way. everything else is just a hack and you risk overfilling your logs or reinventing more hacks. If you use proper tools, you get results out of the box
a trully best way would be to run as docker container, but that's already entirely another story.
Hi guys, any idea how can I further investigate the information shown in hexdump -C of the hangs? any suggestion please
How do i read or find out the reason for the hangs from hexdump results:)
$ for i in `find id:000000,src:000247,op:fs-havoc-generate,rep:4 -type f`; do echo$i; done
echoid:000000,src:000247,op:fs-havoc-generate,rep:4: command not found```
not sure even i have the right file but its says command not found
I'm trying to loop over arguments to call a command with different ones for POSIX shell, yet shellcheck keeps warning about word splitting (https://www.shellcheck.net/wiki/SC2086).
I've tried using pseudoarrays, and playing with IFS too, with no luck. I understand you can try fit the arguments in $@, but then you'd need to do a second pass to group together each option with its value set -- autobackup 0 docfiles 1, and I'm not sure of a way to solve this without resorting to bash/ksh arrays
Help much appreciated 🤍
#!/bin/sh
setopts() {
for i in 'autobackup 0' 'docfiles 1'
do
sudo tlmgr option ${i}
done
}
if it does what you want it to do why are you bothered anyway?
besides there is exceptions section on that page you linked and there's exactly your case there:
Hi, in the manual "man hexdump", any reference? 
hey thanks for reaching. I was curious of alternative ways to achieve the same thing that prevent the warning
I found out that by using eval it will also work and I won't get the warning
#!/bin/sh
setopts() {
for i in 'autobackup 0' 'docfiles 1'
do
eval "sudo tlmgr option ${i}"
done
}
which line triggers the warning? eval does not actually fix the problem on line 6, it just prevents shellcheck from understanding that the problem is still there.
#!/bin/sh
setopts() {
for i in 'autobackup 0' 'docfiles 1'
do
sudo tlmgr option "${i}"
done
}
this is all you need i think
the warning about word splitting is probably because $i was unquoted.
i='autobackup 0'
foo ${i}
you want this to expand to foo 'autobackup 0', two "words", but it actually expands to foo autobackup 0, three "words".
this is because the shell performs word splitting on the results of parameter expansions
you need to quote the parameter expansion to prevent word splitting
hence the shellcheck warning
What do you use to get email notifications in Ubuntu’s system tray? I use thunderbird but I don’t get notifications unless it’s already running which seems stupid.
does thunderbird have "exit to system tray" feature?
i thought it did, but i'm not sure
Has anyone used it before? I read the GitHub read me and got the impression that Birdtray shows you a notification when you get an email or anything email related. The install and setup is very simple. Am I wrong about what it’s meant to do?
seems like that's exactly what it does
I must’ve done something wrong then I’ll try to figure it out. I’m still only getting a notification while thunderbird is open.
(gdb) run
Starting program: ~/afl-image-syscall/afl-fuzz -S fuzzer_ext4-cpu4log10grp1 -b shm_ext4-4 -s fs/ext4/ext4_wrapper.so -e img/ext4-01.img -y seed -i in-ext4-1 -o out-ext4-1 -u 4 -- lkl/tools/lkl/ext4-combined-consistency -t ext4 -i img/ext4-01.img -e emulator/emulator.py -l /tmp/mosbench/tmpfs-separate/10/log -d /tmp/mosbench/tmpfs-separate/10/ -r -p @@
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
afl-fuzz 2.52b by <lcamtuf@google.com>
[+] [fs-fuzz] shm name to store image buffer: shm_ext4-4
[+] [fs-fuzz] target wrapper (.so) path: fs/ext4/ext4_wrapper.so
[+] [fs-fuzz] seed image path: img/ext4-01.img
[+] [fs-fuzz] syscall input directory: seed
[+] You have 16 CPU cores and 3 runnable tasks (utilization: 5%).
[+] Try parallel jobs - see /usr/local/share/doc/afl/parallel_fuzzing.txt.
[+] Found a free CPU core, binding to #4.
[*] Checking core_pattern...
[*] Checking CPU scaling governor...
[+] [+] Open shm shm_ext4-4 success.
[+] [+] Map shm shm_ext4-4 at 0x7ffff5c15000 size: 0x800000.
[-] image img/ext4-01.img compression failed.
Location: compress(), ext4_fuzzer.cc:222
[Inferior 1 (process 41441) exited with code 01]
(gdb) bt
No stack.
Guys, any idea why my bt command showing nothings?
Hey thanks for pointing out. It'd be line six
From shellcheck:
Line 6:
sudo tlmgr option ${i}
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
I appreciate the effort. When double quoted the "${i}" var it won't work:
tlmgr: option autobackup 0 not supported!
tlmgr: An error has occurred. See above messages. Exiting.
tlmgr: option docfiles 1 not supported!
tlmgr: An error has occurred. See above messages. Exiting.
but when no quoted (${i}) it will :
tlmgr: setting option autobackup to 0.
tlmgr: updating /usr/local/texlive/2022basic/tlpkg/texlive.tlpdb
tlmgr: setting option docfiles to 1.
tlmgr: updating /usr/local/texlive/2022basic/tlpkg/texlive.tlpdb
i see, so you are actually relying on the shell splitting behavior here
in that case then this warning is just telling you what your code is doing
i would not try to work around it with eval, just annotate that line to silence it
yea!
Oh! I had no idea you could write silencing comments thanks so much 🤍
Any ideas of how I could merge these two loops together?
@for file in ./src/pb/*.cc; do\
sed -r -e 's/(#include "[a-zA-Z.]*\.pb\.h)"/\1pp"/g' -i $$file;\
mv "$$file" "$${file%.??}.cpp";\
done
@for file in ./src/pb/*.h; do\
sed -r -e 's/(#include "[a-zA-Z]*\.pb\.h)"/\1pp"/g' -i $$file;\
mv "$$file" "$${file%.?}.hpp";\
done
Ext2/3/4 file system utilities. Contribute to tytso/e2fsprogs development by creating an account on GitHub.
Guys any suggestion how can I create a man page from this code repo? Is there any python or shell code that can parse the info as a template
it already has manpages
Is anyone around developing on Mac? I want to compile some C++ code using boost-python and can't get pkg_config to work properly ..
how did you install boost? you might need to set PKG_CONFIG_PATH if you installed it with homebrew or macports
i'd consider writing a standalone script for this and invoking that script in your make recipe, or using a make pattern like %.hpp: &.h ...
also why use -i but then also mv?
src/pb/%.cpp: src/pb/%.c
sed -r 's/(#include "[a-zA-Z.]*\.pb\.h)"/\1pp"/g' $< > $@
src/pb/%.hpp: src/pb/%.h
sed -r 's/(#include "[a-zA-Z.]*\.pb\.h)"/\1pp"/g' $< > $@
build/pb/foo.o: src/pb/foo.cpp src/pb/foo.hpp
...
also did you intend to make the patterns different? the .h pattern has [a-zA-Z] and the .c pattern has [a-zA-Z.]
Yes, I used homebrew. Haven't heard of macports yet, is it any good?
i think macports is a significantly piece of software overall. but homebrew is more popular so it tends to have more packages (and sometimes they are more up-to-date)
I found the place(s) where boost stores the .pc files, but there are none for boost
ah, that's annoying
ah, sorry! I found the place where homebrew store them
i find that a lot of homebrew and macports packages both are missing the .pc files you would want
I was under the assumption that they could somehow be created automagically from the information available at build time..
so I am really flabbergaster to find that that's an actual issue
btw in general you can write brew list <pkg> to list all files in a package, if that helps
you can also look in brew --prefix <pkg>
yeah, I learnt that and that's where I noticed boost does not have any .pc file
yeah i don't know why some libraries don't have .pc file in their packages
if it makes you feel better i don't even see boost-python at all in macports, so i guess nobody has gotten around to packaging it yet
The updates the file, mv renames it to match the changes
I ended up just keeping the two loops
sure, but why not just make a copy of the file? you can remove the old one after if you want, but this is a makefile so i feel weird about removing the dependencies of a recipe
plus -i isn't really portable, this won't work on macos for example unless you do SED = gsed and use $(SED) -i
Well, the target generates files and renames them to match the rest of the project
i mean suit yourself, it's your makefile! but i think my version is more robust, more portable, and less complicated
What do you think are the reasons for that? It sounds like it makes homebrew partly unusable for dev purposes. But maybe that's not even close to the goal of homebrew ..
probably because whoever wrote the package didn't think about it or didn't know about it or didn't think it was important
a lot of homebrew packages include (or used to include) a "caveat" section telling you to add -L... -I... when compiling stuff
maybe file an issue on the homebrew issue tracker? i guess it's also easy enough to write your own .pc files. i don't know if homebrew has a way to generate them when defining a package
I'll dig into that, it's too intriguing to let it slip by. Thanks for your help!
@sinful idol i also don't really know if there is other dark magic that powers pkgconfig. try brew install pkg-config and then specifically invoking the version installed w/ homebrew using its full path
pkg-config fails to find libraries installed by Homebrew, so I decided to investigate. pkg-config --variable pc_path pkg-config gives /opt/local/lib/pkgconfig:/opt/local/share/pkgconfig. I would ex...
I was already using the brew version of pkg-config but re-installed anyway. No effect, though. And /opt/homebrew/lib/ is full of pc files, but none for boost, so it seems it's really a package related thing, like you said
Good that the .pc files are plain-text and not too complicated, I might roll my own for the time being
yeah there is an example of writing your own for opencv here https://prateekvjoshi.com/2013/10/18/package-opencv-not-found-lets-find-it/
it might be an upstream thing too
e.g. i have .pc files for apache arrow but i don't see anywhere in the formula where they are explicitly generated https://github.com/Homebrew/homebrew-core/blob/master/Formula/apache-arrow.rb
so it's possible that apache arrow just includes them in their build/install process
aha, apparently boost in particular has a long history of not providing pkg-config files @sinful idol https://stackoverflow.com/q/3971703/2954547
https://svn.boost.org/trac10/ticket/1094 15 years and counting! 😬
Wow! 
This jam stuff again ..
Maybe I should be looking for a replacement for boost then. I ended up with it for writing Python modules in C++ and there might be other, more portable libs supporting that.
there's a recipe for a python script that will generate .pc files for a boost installation. idk if it's a bad idea for any reason
where?
in the stackoverflow thread i linked, sorry i forgot to specify where
ah, ok, I'll have a look, thanks
afl-fuzz: ../mutator_wrapper.cpp:23: void mutate_havoc_init(uint8_t*, uint32_t, uint32_t): Assertion `havocStage == nullptr' failed.cpy a2 read inline(0x7ffe30280690, 0x55d65304a478 + 53183, 8);
Aborted memcpy a2 read inline(0x55d651ffdbc0, 0x55d65304a478 + 53191, 1);
Guys, anyone knows what could be the reason for such error?
yeah: havocStage is not == to nullptr
semi-snarky, but that's C++ code, not python
🙂
Can I upgrade kernel to 5.18 on Fedora 36 without any problems?
When will linux mint 21 edge come?
Will it come with 5.18 kernel?
char v2[] = ".";
char v3[] = "foo";
...
v12 = syscall(SYS_open, (long)v2, 65536, 0);
syscall(SYS_chmod, (long)v3, 3072);
Anyone, please explain the last two lines based on the first two lines? Usually second last one should open the syscall using v3 but it's using v2.
I was trying to connect my usb to a windows 10 VM so
I went here https://wiki.archlinux.org/title/USB_storage_devices
first added the current user of the vbox users group, rebooted then
entered this mount -o gid=users,fmask=113,dmask=002 /dev/sda1 /mnt/usbstick
successfully mounted, no problems on my host machine, so I went and checked the virtual box settings, nothing wrong as far and as I know. But when I boot into
my windows 10 VM I don't see my usb, I just can't access it. Any clues? about what's wrong?!?
on arch forums, they told me to go read the wiki again so I did but I just can't figure it out 😦
macports or homebrew?
Homebrew is the more popular and supported choice, I think
you can also manage packages using Nix, but I haven't tried that
homebrew for sure
I don't know anyone who uses macports -- and popularity matters
How can I start the ssh service on boot?
in debian family, systemctl status service_name allows to check if it is already enabled for auto start
if not, it can be enabled as systemctl enable service_name to be booted at start
there is always an option to add anything into systemd daemons for auto start and etc
though as it was said, any distro adds ssh automatically into auto start
Never tried it before. Its ubuntu. Although in my kali vm i need to manually enable it each time using service ssh start
It makes sense to me that Kalli would keep services like that disabled by default... It's definitely not a normal distro
I'm pretty sure Docker containers don't use systemd so that's a different story
a docker container is generally a single process, or 2 or 3 very closely related processes.
it's not at all the same as a "real" computer
why what?
why don't I know anyone who uses macports? I dunno.
Why does popularity matter? Because a more popular platform will attract more and better developers, and because you're more likely to find someone who can help you use it.
Thanks ill look at it
oh ok
they both seems to be popular
imma try both
and see how it goes
i think macports handle packages better compare to hombrew
it works similar to flatpacks
🤷
I've used a Mac for work for many years, and my coworkers do too, and I cannot ever remember any of us using macports.
Also, having an error with ssh keys. Used ssh-keygen to generate an rsa key. It automatically saved it at ~/.ssh. I created the authorized_keys file (added rw perms) and copied the public key inside it. When i try to ssh with the key, it asks for a password
re-run ssh with -v, post the output
of course
rw for you but nobody else
you created the authorized_keys file on the remote machine, right?
forgive me if that's an insulting question, but I have no idea how familiar you are with ssh
Yeah no worries, yes i did.
1 sec
Too big to upload. Something tht might be interesting is id rsa type 0 and id rsa cert type minus 1
I think minus 1 means "I couldn't find that file"
After that tries uthenticate as my current user and then some fails trying to open known hosts file
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.
?
but that's OK, you don't need to use a certificate.
ssh is filled with rarely-used features; I think that's one of them
that's the whole output?
also I have no idea what "a ctf" is
if that's the whole output, my best guess is that you did not properly create the authorized_keys file
Capture the flag game
how is that relevant?
?
now that I know you're making a "capture the flag" game, how does that help me diagnose your ssh problem?
Based on the scenario the attacker shall gain acces to an admin page of a vuln web app and gajn a eession using the idrsa file
let's take this one step at a time
let's see if we can get ssh working at all before we worry about attackers and stuff
No i was answering to your what is a ctf questin
well sure
Yeah i can gain a session usinga password
here's an idea:
get that session, recreate the authorized_keys file just like you did last time, but this time capture your session in a transcript so I can see it.
you may have done something wrong.
make sure it doesn't have any secrets in it before you show it to me, of course
[it probably won't]
Alright although im afraid i will not have internet connection soon. I willlog the session and will message here probably tomorrow.
Thanks for the help
and I have to go to work soon, so ... sigh
i want to parse this so it so it says size:23G - used:2.8G - available:19G - used:14% but i dont know how to split the data up, can anyone help
@main oliveNot exactly sure what you want, but this seems like a good start
import pprint
import subprocess
cp = subprocess.run(["df", "-h"], capture_output=True)
fields, *data = [line.split() for line in cp.stdout.split(b"\n")]
pprint.pprint([dict(zip(fields, datum)) for datum in data])
# python3 yoria.py
# [{b'Avail': b'13G',
# b'Filesystem': b'/dev/disk3s1s1',
# b'Mounted': b'/',
# b'Size': b'229G',
# b'Use%': b'95%',
# b'Used': b'216G'},
# {b'Avail': b'13G',
# b'Filesystem': b'/dev/disk3s6',
# b'Mounted': b'/System/Volumes/VM',
# b'Size': b'229G',
# b'Use%': b'95%',
# b'Used': b'216G'},
# ...
you'll have to collect the "Available" or "Used" fields yourself; probably best to not pass the -h flag, so that you get something you can easily do arithmetic with
oh thanks, this is somewhat what i needed
Hey guys I have a question about ubuntu I configure my NetworkManager.conf file like in the following snip but for some reason I'm still facing with mac leakage how can I stop it. The following snip is working completely fine on kali """[device]
wifi.scan-rand-mac-address=no
[connection]
ethernet.cloned-mac-address=preserve
wifi.cloned-mac-address=preserve
"""
What discord rich presence lib do u use on linux systems?
Pypresence seems to not working
use awk
df -h | rg 'rootfs.*/$' | awk '{printf "size:" $2 " - used:" $3 " - avail:" $4 " - use%:" $5}'
!paste
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.
Someone here can help me with deploying django website?
I've already wrote all in #help-mushroom
It's localhost
Ye
So what i suppose to do?
Does the localhost work
No
Ye
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.
Log
Yup seems fine
Idk what really is the problem here. Have you changed the default nginx port
Hello, I was trying to programmatically detect if a certain process is waiting for input or not, my idea was to epoll the fd and verify if there's a block, but then the issue here is, we don't know for how long to poll the fd before verifying if the input is read or not
does anyone know anything better than using epoll here?
You've created an authorized_keys file on the same box as that which holds the private key. That makes no sense. It belongs on the remote box
any preference between these two?
## Option 1
1>&2 printf '%s\n%s\n' \
'Command `brew` not found!' \
'You must run `./scripts/install-system-requirements.sh` before running this script.'
## Option 2
1>&2 cat <<\ERR
Command `brew` not found!
You must run `./scripts/install-system-requirements.sh` before running this script.
ERR
consider echo since it's a almost always a shell built-in
echo -e 'Command `brew` not found!\nYou must run `./scripts/install-system-requirements.sh` before running this script.' >&2
my linux hyper-v vm doesnt boot properly. it starts up, loads GRUB, boots, prints some text, shows the startup animation, prints some more text, and then gets stuck on the terminal interface with a flashing cursor and nothing else. any ideas what might be wrong here?
before it gets stuck, i see the login: flash for a split second, which is normal before the gui loads, but for some reason the gui fails to load and the login prompt disappears
try ctrl-alt-f1
nice. that let me log in through the terminal, but is there a way i can get the desktop environment to work?
its xfce iirc
sounds like you are probably using X11 but there are so many configurations. it's very hard to make generic suggestions
i'm not sure what distribution you are using
i downloaded kali from their page, the "bare metal" image, since they dont have a prebuilt for hyper v
did it work at one point in the past? they might just not have a display driver that's compatible with Hyper-V's virtual display adapter. I'm not very familiar with Hyper-V. You could also try running it from VirtualBox instead
if it's an iso-type image it's probably difficult to impossible to reconfigure. I would recommend trying in a different hypervisor unless you're absolutely tied to Hyper-V for some reason
i'd guess they probably eliminated a bunch of possible display drivers in an effort to keep the image reasonably small, and hyper-v's emulated display adapter just isn't supported
i am, unfortunately this pc is quite old and for some reason its having issues running vbox, runs into bluescreens often, while hyper-v at least doesnt crash it
i dont think display drivers are the issue here, since it shows the startup animation just fine, and terminal interface works too
probably an issue with xfce
the startup animation is completely unrelated to the drivers X11 will need to run, and xfce is just a window manager that runs on top of X11 and doesn't actually display graphics on its own
a lot of blue screens and crashes tend to point to hardware issues, though. possibly heat buildup or a bad connection on a RAM module
or try to go back to an older release of Kali
I just don't think Hyper-V is very popular among the linux crowd so it's not too surprising if they haven't tested it or built images for it
if i remember correctly the issue was with network drivers. either way im already using hyper-v for other vms and docker as well
you can also just try a different distro other than kali such as lubuntu. they also have a live image available.
just to break it over multiple lines
believe it or not, printf is considered more portable (because there are so many non-conforming echo variations) https://unix.stackexchange.com/q/65803/73256
sure, i was contrasting against cat which is typically provided by /bin/cat thus requires another process to be read from disk and launched
printf is fine to use
oh that's a very good point
recreated the vm from scratch, this time as generation 2, and now it works 
nice.
How do you guys install python on macos?
installer from python
homebrew
macports
pyenv
macports for general quick use, conda or pyenv for more serious projects
the one thing i like about brew that macports doesn't have is its system of Cellar->opt->root symlinks
but macports is overall a nicer user experience
whats pyenv?
oh its in homebrew
pretty sure in macports you can switch python versions
does it take a long time to recieve python update
b/w brew and macports
right, but they function differently. macports has its select feature which is actually more useful than brew in a lot of cases. but i still like the brew design in principle.
whats brew design principle?
from what i read
brew depend on the system libraries
and if there is was update to those
it can break stuff
i was talking about the symlinks from "versioned" directories in BREW_PREFIX/opt/pkg/version/... to BREW_PREFIX/{bin,lib,...}
macports "containerise" stuff like flatpack
but yeah that's the other difference. homebrew tries to reuse as much as possible provided by macos, whereas macports explicitly doesn't
what do you mean by this?
i don't believe they use any form of isolation like flatpak
All apps and dependencies are self-contained and managed by MacPorts. Any kind of MacOS update that changes library versions will never affect an app installed by MacPorts. Kind of the same concept as Flatpaks
it was from reddit
so
that's a really weird analogy
macports is like literally every other package manager in that regard
flatpak is a completely different design, don't believe everything you read on reddit
what advantages does this bring?
it's only like flatpak in that flatpak isn't connected to your system's package manager
from a user perspective, it's a lot easier to deal with than a bunch of suffixed binaries like poetry-3.10
im still not sure what you mean
i mean that the analogy to flatpak is weird and doesn't make a lot of sense
ok
what about the part where macos update to system libraries
can break stuff with brew
that is true. when you update macos you might need to reinstall all of your brew packages
I'd use the term "isolate" instead, because that is what is happening in practice. You isolate the libraries provided by the OS from 3rd party code.
someone made a comment about that
sound likes it can break stuff
yeah but only in a weird tautological way. if i write 2 shell scripts that don't refer to each other, then arguably they are "isolated" from each other 🤷♂️
macports, homebrew, pkgsrc, nix, guix all fall into the category of package managers that live alongside your main os. they all differ in how much of the main os they depend on.
pkgsrc requires you to have bsd make, svn, and a c compiler w/ libc. that's literally it. everything else is built up.
im new to macos
but experinced in windows and linux
so how these macos packages differ to package mangers like apt,dnf
macports i don't think even requires a c compiler technically as long as binary packages are available for your system, you just need a tcl installation that can connect to the network
or choco & winget
identical in concept to scoop or choco
yes. but choco only differs from apt in that apt assumes it has full control over / whereas choco only assumes it has full control over a specific part of the filesystem
in deb and rpm packages, the filenames are literally hard-coded relative to /. that's why if you want to run a separate apt installation (e.g. to install specific dependencies for building debian packages), you have to do it in a chroot, because all the packages have / hard-coded as the root installation prefix
is this an advantage?
does it make ports faster?
it's a tradeoff. fewer dependencies on the host system means that the developers have more control over their own system. but then it means that there might be some incompatibilities or inconsistencies with the host system.
no. macports is faster because it's just a better-engineered piece of software. homebrew is astoundingly slow, even for a ruby program.
homebrew has come a long way in terms of its design, but it's still insultingly slow even on my m1 mac with an ssd
brew info <pkg> takes 2-3 seconds whereas port info <pkg> is nearly instant. there is no reason why brew info <pkg> should not also be nearly instant.
so ultimately i recommend macports over homebrew because macports is a much nicer user experience because it's a better-designed piece of software. however i also recommend keeping homebrew around anyway in case there is something missing from macports. on m1 mac they install to /opt/local and /opt/homebrew so as long as you set up your PATH correctly they should not really conflict
(i wish they would give you the option to install to /opt/homebrew on non-m1 systems too, installing to /usr/local was also a very sloppy design choice, although understandable at the time they did it)
homebrew is great because it has so many packages and they are usually kept very up-to-date
i even install it on linux ("linuxbrew" was merged into homebrew a few years ago)
whereas pkgsrc has approximately nothing i need and sometimes straight up didn't work even when following the exact installation instructions, on linux. i'm sure it's good too but i'm more practical than that. macports does a much better job on macos for my purposes, and on linux i usually just don't need it. although it'd be pretty cool to have a solid cross-platform pkgsrc setup you can take with you anywhere.
if i have install them both is their gonna be any conflicts between them
there can be, but i haven't encountered many. i make sure that /opt/local/bin is before /opt/homebrew/bin in PATH, but i also have a very complicated shell environment setup that lets me exercise precise control over such things and is meant to work on both mac and linux
you will also need to make sure that MANPATH, INFOPATH, PKG_CONFIG_PATH, etc. are also all set up the way you want them
you can even write a shell script that "activates" homebrew and/or macports by setting env vars, much like activating a python venv
isnt it good idea to install them on a user folder
reduce the chance of being messing the system files
/opt/homebrew
they will not mess with system files
sound like a root directory
/opt is specifically designated as a "do whatever you want" location in the unix filesystem hierarchy, and macos respects that. it will not mess with /opt
/usr/local kinda-sorta used to be like that historically, but macos uses it for some things so it's a good decision that homebrew was forced to move away from it due to security restrictions
btw what about the location ports uses
/opt/local
k
i wish it was /opt/macports but that decision is stuck
i've check the packages i want to install
and they seems to be on macports
which is python and hugo
yeah you should be able to do sudo port install python hugo and be able to use it
cool
thanks so much clarifying this stuff
btw one more question
prob not related to unix
what poetry do?
ive seen that on replit
is like venv
also how is the experince with conda
on macos
i didnt like it much when i used it in windows
kinda found it confusing
and the ui it had was very slow
it's a replacement for setuptools that also creates venvs for you
it's consistent across all os'es. same as anywhere else (which is a good thing)
it's particularly slow on windows for some reason. i use Mamba which is a reimplementation of Conda written in C++ and it's much much much faster. you can use Conda envs with Mamba and it's basically drop-in replacement
whats setuptools do
so it creates a venvs automatically for new projects
instead of manually doing it
It looks like it can be use to create packages.
another question about ports vs brew
for homebrew
Every installed package is cleanly sandboxed into its own cellar so you don't have stray files all over your system, just symlinks from bin, man, etc.
is this true for macports?
it is 10 years old
so
sorry gtg to bed now
i'll reply to any messages tmr
that's what i was talking about before with the homebrew model vs. the macports model. no, it isn't true about macports. macports also doesn't put files "all over your system", but they don't have isolated trees for individual packages that are symlinked into the primary tree, everything just gets put directly in the primary tree. so it's a bit less well-isolated, but in practice it shouldn't matter much because packages shouldn't come into conflict
admittedly i don't know what happens if you install both moreutils and parallel for example, since they both have a parallel binary. it's possible that macports refuses to install one or the other, or uses port select. i'll look into it
Yeah sorry forgot to mention that i transferred th file afterwards. I just forgot it
Hey are there any risks for using chocolatey package manager?
Depends on how much you like fudge
Chocolatey has the largest online registry of Windows packages. Chocolatey packages encapsulate everything required to manage a particular piece of software into one deployment artifact by wrapping installers, executables, zips, and/or scripts into a compiled package file.
Package submissions go through a rigorous moderation review process, including automatic virus scanning. The community repository has a strict policy on malicious and pirated software
There are always risks to everything. It sounds like they try to make a good effort at securing things, but nothing's perfect. No way of automatically knowing if they do a better job than, say, Debian or Canonical, but it seems unlikely.
I don't see anything on here about unix anyway, so is this even what you're talking about?
ok so when it come to this
homebrew is "better-engineered"
by using symlinks
and the only advantage it brings is everything organzied
like in windows application can store their config all over the place
but in linux based distros application put their config in config folder
and when i uninstall an application only the stuff in the config are not deleted
what about in macos
Linux doesn't restrict an application from storing it all over the place either
nor does macOS
oh ok
Ill take it from the start. I gain a ssh connection to the server using password authentication. I generate a ssh key pair, transfer the private key to the client machine (my machine). Authorized keys belong where? I am straight up confused. In my understandjng with each new key pair we append the public key to the server's authorized keys file so that it accepts them. I
I did what i mentioned above to an ubuntu server and it worked.
yes, authorized_keys lives on the server.
it's a list of keys that are authorized to log in to that account on that server.
Yeah.
My bad should have mention this was the server
Welp i should have deleted the id rsa file so it would become obvious
it's weird to create your private key on the server, and then ship it back to the client.
the server doesn't need, and shouldn't have, the private key.
generate the keys on the clients instead.
private keys should never traverse the network. That's why they're called "private".
macports overall is better engineered imo, but this particular design decision by homebrew was a good idea that other package managers generally don't use
windows applications usually store configs either in their install directory (e.g. C:\Program Files\The App) or somewhere in your user directory, e,g, %LOCALAPPDATA, or sometimes the windows registry
linux/bsd (and other unix-oriented) applications usually store configs in /etc (or whatever their installation prefix is, e.g. /usr/local/etc or ~/.local/etc) or in a "dot directory" in the home dir, or more recently under ~/.local and/or ~/.config
macos applications use /Library or ~/Library, e.g. ~/Library/Application Support/The App. however, a lot of applications that are written with linux in mind, or that are cross-platform, use ~/.config which is perfectly acceptable and common on macos.
sometimes you even see %USERPROFILE%\.config on windows too, but that's rarer. usually porting an application to windows requires so much "internal" work that you can afford to use a different config directory that is more conventional for the windows platform
and yes, like moyenperson said: there is no requirement to store configs in any particular place. this is all dictated by convention
If this hasn't been mentioned there is a library perfect for this purpose
!pypi appdirs
oh ok
but i like the fact that macos ask permission if it trys to access a different folder
but dont ask for permission to use the library folder
like any app could change the library folder without perimission
like AppCleaner
does the Library folder also contain binaries for applications?
oh there is two different Library folders
btw how do i get pip?
kinda surprised mac doesn't come with python installed
but comes with git
example.txt
a
2
start
a
b
615
b
d
end
f
a
g
start
610
h
i
end
b
3
start
e
e
615
s
s
end
a
How would you go about deleting blocks of [start;end] if the block contains 615?
magic example.txt > output.txt
output.txt
a
2
f
a
g
start
610
h
i
end
b
3
a
python -m ensurepip
probably looking for more clever solution, anyway this is not nice but it works 🙂
out = []
temp = []
save = out
for el in data.split():
if el == 'start':
save = temp
save.append(el)
if el == 'end':
save.append(el)
if '615' in temp:
del temp[:]
else:
out.extend(temp)
save = out
if el != 'start' and el != 'end':
save.append(el)
and now try python -m pip
Hello, a quick way to install all python developer dependencies on fedora? I encounter a problem when try to install numpy. edit: I resolved this, it was a problem with an old version of numpy
what about the warning?
add the mentioned directory to the shell PATH, I suppose
Oh ok
I uninstalled every package in ports
And installed python again. Pip seems to be working
Hey, thanks for your effort, couldn't get your solution to pass my test though, so my WIP solution so far is:
from pathlib import Path
class BlockPruner:
def __init__(self, start: bytes, end: bytes, needle: bytes) -> None:
self.start = start
self.end = end
self.needle = needle
self._temp: list[bytes] = []
self._save: list[bytes] = []
self._keep_block = True
self._inside_block = False
def prune_file(self, input_file: Path) -> bytes:
with open(input_file, "rb") as input_fp:
for line in input_fp:
self._feed_line(line=line)
return b"".join(self._save)
def _feed_line(self, line: bytes) -> None:
if line == self.start:
self._inside_block = True
if self._inside_block:
self._temp.append(line)
if line == self.needle:
self._keep_block = False
else:
self._save.append(line)
if line == self.end:
self._keep_or_disregard_block()
def _keep_or_disregard_block(self) -> None:
if self._keep_block:
self._save.extend(self._temp)
self._temp = []
self._keep_block = True
self._inside_block = False
Which passes the test:
from pathlib import Path
import pytest
from block_pruner.block_pruner import BlockPruner
class TestCase:
__test__ = False
def __init__(
self,
start: bytes,
end: bytes,
needle: bytes,
expected_fname: str,
input_fname: str,
) -> None:
self.start = start
self.end = end
self.needle = needle
self.expected_file = Path(f"tests/data/{expected_fname}")
self.input_file = Path(f"tests/data/{input_fname}")
def actual_matches_expected(self, compare: bytes) -> bool:
with open(file=self.expected_file, mode="rb") as expected_fp:
return expected_fp.read() == compare
test_cases = [
TestCase(
start=b"start\n",
end=b"end\n",
needle=b"615\n",
expected_fname="simple-expected-output.txt",
input_fname="simple-input.txt",
),
]
@pytest.mark.parametrize("test_case", test_cases)
def test_prune(test_case: TestCase) -> None:
pruner = BlockPruner(start=test_case.start, end=test_case.end, needle=test_case.needle)
actual: bytes = pruner.prune_file(input_file=test_case.input_file)
assert test_case.actual_matches_expected(actual)
Need to come up with a clever solution for supporting bytes and strings though haha, and have regex support for the needle I guess
I have lines like this in my text file:
--More-- ^M ^M
How do I find and replace them to blanks in vi?
I tried
:%s/--More-- ^M ^M//g
But it doesn't work. I don't know what that ^M is
you were kinda there, but don't type ^M verbatim, do ctrl + v (hold) then m
Ctrl-V (insert raw character) then press Enter/Return
you probably need to escape it ^ -> \^
Which Linux distro I can use for programming?
technically any distro, but i highly recommend Kubuntu, for... debian family often chosen as servers, and having awesome KDE plasma konfortable GUI
What about fedora?
I have used KDE over Debian for ages but couple of weeks I started using Linux Mint and is a beautiful experience
I have also tried Ubuntu and is good too
Hmm
I prefer deb over rpm (answering your question), no scientific reason. I found deb management more natural
u will find development easier when your dev machine is debian family one (Kubuntu belongs to ubuntu/debian family)
it is common to use debian family and alpine for container images
but alpine is really not meant for development
debian is way more stable and easier to use
oh good point about docker images. Most of images you find out there are debian based, including official python images 😄
kde is a desktop environment, not an operating system like debian. are you talking about kde neon? that one is based on ubuntu.
personally i recommend fedora, i find that administering a fedora system is much easier than administering a debian system. i also think dnf is easier to use than apt.
btw, KDE indeed can be used with anything. With Debian, Alpine, or other distributions.
I wanted to say, KDE on Debian 😅
oh i see! i totally misunderstood what you meant
probably you understood fine and I explained it wrong
kubuntu hmm
How does software like lshw get data from memory module SPD?
Looking at the source code, I am not sure if it gets it from a device file.
https://docs.kernel.org/misc-devices/eeprom.html this gives me more of an idea
Hi
Hi
hey i am using netcat does anyone know what nc -ul does
ping me if you know
https://www.unix.com/man-page/Linux/1/netcat/
-u says use UDP mode
-l means behave as a listener
you'll also need to supply a port number or the command won't work
Need help deploying a flask application with apache2.followed lots of guides nothing seems to work
Hello Guys. I am trying to install ubuntu on my HP Compaq dc5800 but it is giving me an Kernel Panic Error 0x00000009
does anyone knows what it is and how can i fix ?
Was this after going through the installer and rebooting? What Ubuntu version is this?
HP is nightmare in general
Lenovo ftw
os: panic
Try installing 20.04 out of curiosity
Oh I remember something
I've heard POP os is a pretty good alternative for HP laptops.
During installation of HP manually downloaded drivers can be required inserted before installation start
Since HP dev one it also has all drivers supported.
i will try. i hav e pop os on my asus laptop
so because it is an old pc it needs an older version of ubuntu for like 18 lts version maube
If I have Zsh + OhMyZsh installed, and need to install the Poetry auto completions, which one do I install?
The one for Zsh or the one for OhMyZsh?
Mostly can someone help me understand in general where do I install when plugins come for both of them?
If there really are two, I'd pick the OhMyZsh one, on the assumption that it's newer and shinier
Hi, how can I copy a file -> replace all instances of a certain text from that file and paste than new replaced file in a new directory
This is a task on this udemy course self paced
I am just lost that's why I am asking if someone could point me in the right direction
I am looking at awk atm
hoping to pipe things together
Hello,
I'm writing a Bash script and I'm trying to get both the PID and the output of a process executed in a subshell (thanks to command substitution). I was able to get the output of the process but I can't seem to figure out how to get its PID (I'm still a beginner in regarding to subshell behavior).
This is what I've done so far
# Assuming that cmd_to_run is the process to run
my_command_output=$(cmd_to_run)
# How do I get the PID of cmd_to_run? I've tried $! but it doesn't work in subshells)
Thank you so much!
Since we are in python, i would recommend Python solutions:
why don't u use Popen https://docs.python.org/3/library/subprocess.html ? 🙂
it has pid as resulting process ID
from subprocess import Popen
print(Popen("ls", shell=True).pid)
P.S. the process can be not finished at that time, it requires waiting for its end with prod.wait(), it already has assigned pid though
p.S. and
Popen.pid
The process ID of the child process.
Note that if you set the shell argument to True, this is the process ID of the spawned shell.
Hi
How can I pipe this
sed -i -r 's/\-{3}/\s\-\s/g' ./test/CainsJawbone.unix.utf8 ```
to a new file
like whatever the output is
i put it in a new file
in bash
echo "123" > filename.txt
> redirects output and creates new file
>> adds to the end of file if possible
| redirects output to a next chained command
Oh okay
So i need to just add > newfile.txt
Here
I did
Cp file newfile
Then did newfile here
Last login: Tue Sep 6 18:16:37 on ttys004
You have new mail.
/Applications/Python\ 3.8/Install\ Certificates.command ; exit;
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
user-MacBook-Air:~ user$ /Applications/Python\ 3.8/Install\ Certificates.command ; exit;
-- pip install --upgrade certifi
Collecting certifi
Using cached certifi-2022.6.15-py3-none-any.whl (160 kB)
Installing collected packages: certifi
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/certifi'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 21.1.1; however, version 22.2.2 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -m pip install --upgrade pip' command.
Traceback (most recent call last):
File "<stdin>", line 44, in <module>
File "<stdin>", line 24, in main
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8', '-E', '-s', '-m', 'pip', 'install', '--upgrade', 'certifi']' returned non-zero exit status 1.
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
wdym by match? if you want to match Á specifically just put it in regex. if you want A to match Á then as far as ik there is no way of doing this just using pure regex however you can try converting input to ASCII from wharever encoding that you are using(for example by using iconv) and then running regex on it. if you want to match word with Á then you probably should use [^\s]+ ie any character that is not whitespace
I don't think bash has byte arrays as a type
oh okay
I converted hex to bytes
and i am stuck there
grep --color='auto' -P -o "[^[:ascii:]]" ./data/CainsJawbone.utf8 | sort | uniq -c | sort -r | cat -v | od -x | tail -4 | head -1 | xxd -r -p```
you want to convert hex to sring?
q1
q2
then you can just convert hex to byte and then byte to char and just print it. or you can do it the C way and just print byte directly skipping abstractions
how to od byte to char?
