#unix

1 messages Β· Page 26 of 1

oak shell
#

that should be the same in all 3.7.x, I believe

stone pier
#

yea i think that was introduced in 3.6 or something

oak shell
#

the micro versions should not introduce new features

#

I'd say just try if what you want works with the 3.7 you have installed

sour mesa
#

3.6 introduced ordering for dicts to CPython

#

3.7 introduced it to the spec

copper hatch
#

I must have read it wrong somewhere then, thats true

#

but regeardless I want final release πŸ˜„

#

DO you know where I can find resources to add deadsnakes repo ?

#

and is that official python repo?

oak shell
#

it's not official

#

but a very established and common one

sour mesa
#

@grand bane you don't need to erase it

#

download Rufus on the XP laptop

#

and the ISO

#

use Rufus for the ISO

#

on the USB

#

then move it to the computer with kali

#

and use it to install Windows

odd hollow
#

that might work

#

replace 3.7.0 with 3.7.3

#
sudo apt-get update -y
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev -y
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
tar xf Python-3.7.3.tar.xz
cd Python-3.7.3
./configure
make -j 4
sudo make altinstall
copper hatch
#

@odd hollow yes this is possible, but I won't be able to unintsall it

odd hollow
#

why not

sour mesa
#

uh

#

not with that attitude you won't

copper hatch
#

πŸ˜„

odd hollow
#

you should be able to

copper hatch
#

just doing make uninstall will do it?

#

I will try to do that, lets see what happens! thanks guys

#

Do i have to put it in the /usr/bin folder?

#

or any location is good?

sour mesa
#

you can run the commands anyway

#

anywhere*

#

it'll be put in /usr/bin

copper hatch
#

@sour mesa thank u sir

oak shell
#

/usr/bin should be for stuff managed by the package manager only

#

for manually compiled or extracted things, prefer /usr/local/bin

sour mesa
#

oh uh

#

yeah local

#

it's so weird seeing prefer as a verb

#

idk why

#

eh, you know what I mean

grand bane
#

i cant start the rufus application

#

on the windows xp

#

it starts

#

and also in the task manager you can see it

#

but then it dissapears

sour mesa
#

uh oh

#

@grand bane the latest version of Rufus doesn't work on XP

#

download an older one

sour mural
#

hi
I did apt-get install pip3
and I did pip3 install <wheel>
however when I try to execute that wheel from command line
it says command not found
how do I add pip3 to path
in ubuntu

grand bane
#

oh alright

#

but @sour mesa am i able to compress windows 10 iso with the older rufus verison

grand bane
#

hey guys

#

my experience with rufus

#

and windows xp didnt end very well

#

so i asked myself is there any possibility to install ubuntu with kali

#

and then with ubuntu and woeusb

#

installing windows??

oak shell
#

Ubuntu isos can simply be flashed with dd or the disk image writer tool that should also be available in Kali, as part of the standard gnome utilities

grand bane
#

alright

analog hornet
#

Where is the default save directory for WSL? I spent a couple days working on a project in jupyter notebook. Went to open it up today and it's gone. The .csv's I created in the folder are there, but the code is gone. Is there a way to search for all the files in the WSL drive similar to windows explorer?

spice yarrow
#

anyone have any idea why disk use could be going up as I delete files? Not sure i can get an answer here, since it has to do with our HPC

haughty verge
#

Do the changes take effect on disk if you run sync?

distant prawn
#

@analog hornet find . -type f -iname '*ipynb"

spice yarrow
#

@haughty verge nope

#

i contacted the IT people so hopefully i'll get an answer

#

i'm just very confused about how deleting files added 2 Terabytes of data

analog hornet
#

@distant prawn it’s not there. I’m pretty confused as to where it went. It was mostly debugging so I was able to reconstruct most of the changes in a more timely manner than the first time.

distant prawn
#

did you save the notebook?

analog hornet
#

Yes

#

It’s should’ve auto saved every 5 minutes as well.

spice yarrow
#

oh wait, now I'm down to 2.74 TB? so maybe sync did work

spice yarrow
#

@haughty verge yeah, sync worked. Thanks!

haughty verge
#

Wew!

somber stirrup
#

I have a device that I am connecting to directly with a crossover cable. This device hosts a web application, and it's default IP is 192.168.0.100.

I am trying to access that web application but I keep getting served the default apache2 web page. It seems like I am missing a step. Here is what I've done so far:

sudo ip address add 192.168.0.100/24 dev eth0
sudo ip route add 192.168.0.1/24 dev eth0  # Not sure about this

By networking knowledge is subpar at best, hopefully someone can clear this up for me.

oak shell
#

if you see the apache page, the network connection is fine

#

you might need to adapt the sites settings for your IP/hostname

somber stirrup
#

The Apache page is from my computer right? Shouldn't opening 192.168.0.100 serve the application on the device I'm connected to?

oak shell
#

depends on what your own machine's IP is and what's the IP of the other

#

Can you show the output for the relevant interfaces of ip addr and your route output?

somber stirrup
#

Yeah, I can in a few. On my way back to the office atm. I'll ping you when I have it ready again.

grave jolt
#

your apache config is also relevent I think. you can have apache serve a different page based on what hostname the http request header has iirc.
similarly it can change it based on what ip you use to access the server

somber stirrup
#

enx00e04c3601ab is the ethernet adapter

oak shell
#

yikes, what a name

#

reading...

somber stirrup
#

ikr

oak shell
#

yeah, the 192.168.0.100 is your local machine from which you rant hese commands, not anything connected to it

#

might try sudo arp-scan -I enx00e04c3601ab to check if you can find the server

somber stirrup
#

hmm

zer0@zer0:~$ sudo arp-scan -I enx00e04c3601ab
Interface: enx00e04c3601ab, datalink type: EN10MB (Ethernet)
Usage: arp-scan [options] [hosts...]

Target hosts must be specified on the command line unless the --file option is
given, in which case the targets are read from the specified file instead, or
the --localnet option is used, in which case the targets are generated from
the network interface IP address and netmask.

You will need to be root, or arp-scan must be SUID root, in order to run
arp-scan, because the functions that it uses to read and write packets
require root privilege.

The target hosts can be specified as IP addresses or hostnames. You can also
specify the target as IPnetwork/bits (e.g. 192.168.1.0/24) to specify all hosts
in the given network (network and broadcast addresses included), or
IPstart-IPend (e.g. 192.168.1.3-192.168.1.27) to specify all hosts in the
inclusive range, or IPnetwork:NetMask (e.g. 192.168.1.0:255.255.255.0) to
specify all hosts in the given network and mask.

These different options for specifying target hosts may be used both on the
command line, and also in the file specified with the --file option.

use "arp-scan --help" for detailed information on the available options.

Report bugs or send suggestions at https://github.com/royhills/arp-scan
See the arp-scan homepage at https://github.com/royhills/arp-scan
oak shell
#

huh

#

oh, gotta add --localnet

#

I thought that was implied if you specify an interface with -I, my bad

somber stirrup
#
zer0@zer0:~$ sudo arp-scan -I enx00e04c3601ab --localnet
Interface: enx00e04c3601ab, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.9.5 with 256 hosts (https://github.com/royhills/arp-scan)
192.168.0.100    00:0b:dc:01:3c:aa    AKCP

1 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9.5: 256 hosts scanned in 2.492 seconds (102.73 hosts/sec). 1 responded
#

That's it

#

til arp-scan, neat

oak shell
#

that is weird

#

could both your server and client believe they have the same IP?

#

I'm not really in touch with direct cross-over links, but unless you set a static config on both, I'd have assumed they do some kind of auto-negotiation

somber stirrup
#

Well I assigned everything statically so it is probably my fault somehow

oak shell
#

oh, yeah.

#

Then it's layer 8.

#

As it seems to me, both have the same IP .100

somber stirrup
#

When I don't assign a static IP, the device fails to connect

oak shell
#

because arp-scan would not show your own machine, and it shows a different one with different MAC than yours from ip addr

somber stirrup
#

Ah I see

oak shell
#

what networking stack is this?

#

netplan? or the older one

somber stirrup
#

How do I find out?

oak shell
#

how did you config the static ips?

somber stirrup
#

Just with those commands I posted earlier

#
sudo ip address add 192.168.0.100/24 dev enx00e04c3601ab
sudo ip route add 192.168.0.1/24 dev enx00e04c3601ab  # Not sure about this
oak shell
#

oh

#

hmm

somber stirrup
#

Blindly following a tutorial

oak shell
#

cat /etc/network/interfaces and head -n1K /etc/netplan/*

somber stirrup
#

sudo lshw -c network https://hastebin.com/ibiwibilon.bash

zer0@zer0:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
zer0@zer0:~$ head -n1K /etc/netplan/*
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
oak shell
#

so looks like NetworkManager with netplan backend or something like that.

#

but anyway, if the above there worked, remove those two routes again and try e.g. sudo ip address add 192.168.0.101/24 dev enx00e04c3601ab

#

maybe then your client gets .101 and the server can be reached on 100?

#

That's just guessing though.

somber stirrup
#

Hmm

oak shell
#

You could shut down your local apache just to be sure it doesn't pick up anything from localhost

#

also clear browser cache maybe

#

or try with curl

somber stirrup
#

good idea

oak shell
#

and you could check the ip addr and route outputs again to see if your own address is now 101 or still 100

somber stirrup
#

It was, routes looked good too

oak shell
#

🀷

somber stirrup
#

It looks like using the link-local option let the autoconnect work fine

#

I'm trying arp-scan again but it's taking a while aniblobsweat

oak shell
#

don't format the internet

#

we still need it

somber stirrup
#

lmao

somber stirrup
#

Alright I finally got it, thanks @oak shell for clearing shit up

#

Just had to let the auto-config do its thing, then add the route again

oak shell
#

cool πŸ‘

blissful sage
#

hey so I don't want to destroy my computer

#

I am trying to add somethign to a path variable

stable plinth
#

do you mean a variable containing a path to a file or the path environment varibale

paper nacelle
#

Path to variable ?

blissful sage
#

path environment variable @stable plinth

blissful sage
#

do I have to append the full file path?

#

or can I use export path="$PATH:~/directory_name"

simple citrus
#

Hey everyone , I wonder how can I schudule for example my one python script? Everyday I want run a command at 1 pm sample? What is the code for it?

robust cave
#

what OS are you using?

#

wait you’re asking in unix haha

#

check out cron

simple citrus
#

come on @robust cave πŸ˜ƒ I am using Ubuntu 16.04.05

#

and yep cron is what I am looking for thanks

stable plinth
#

@blissful sage


my_path = '/my/new/bin/dir'

os.environ['PATH'] = os.environ['PATH'] + ':' + my_path

os.environ['PATH'] = '{}:{}'.format(os.environ['PATH'], my_path)

os.environ['PATH'] = f'{os.environ["PATH"]}:{my_path}'

paths = os.environ['PATH'].split(os.pathsep)
if my_path not in paths:
  paths.append(my_path)
os.environ['PATH'] = os.pathsep.join(paths)
#
export PATH="$PATH:~/directory_name"
```  is fine, bash will expand ~ unless it's in single quotes
main olive
#

pyaudio can record audio just fine, but if i try to do it again after terminating the PortAudio session i get

python: src/hostapi/alsa/pa_linux_alsa.c:3636: PaAlsaStreamComponent_BeginPolling: Assertion `ret == self->nfds' failed.
Aborted (core dumped)
``` help please
#

nvm fixed it

#

had to install pulseaudio-alsa

edgy minnow
#

anyone used tclkits? and/or cloudTk?

#

well cloudTk is just vnc session served over sockets... issue is more with getting a kit with all the needed packages to compile/run on aarch64

glossy ridge
#

@blissful sage ls /Users/username/.pyenv/versions/3.7.3/bin/activate is this file there

blissful sage
#

checking

#

no

#

activate isn't there

glossy ridge
#

ok, find the activate script inside the virtualenv

#

and put the correct path

#

I don't remember what it is, but it should be somewhere there

blissful sage
#

so I'm in pyenv

#

specifically the bin folder

#

when I try to cd into virtualenv

#

it tells me it's not a directory

glossy ridge
#
cd /Users/username/.pyenv/versions/3.7.3/
find | grep activate
blissful sage
#

one moment

#

hmm

#

well I'm in the 3.7.3 folder

#

and I type find | grep activate

#

and I get

#
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
       find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]```
glossy ridge
#

find . | grep activate

#

weird, your find requires a path

#

which os are you using

blissful sage
#

unix

#

mac

glossy ridge
#

oh ok

blissful sage
#

ok so I have some output

#

the regex found somehting

#

I have 3 outputs

#
./lib/python3.7/venv/scripts/posix/activate.csh
./lib/python3.7/venv/scripts/common/activate```
#

I'm assuming I go with common/activate

glossy ridge
#

yep, you're not using fish or csh

#

that should solve the first error

blissful sage
#

would I have to paste the full path

glossy ridge
#

yes, not starting with ./

blissful sage
#

so I should just append ./lib/python3.7/venv/scripts/common/activate

#

to the pwd

glossy ridge
#

/Users/username/.pyenv/versions/3.7.3/lib/python3.7/venv/scripts/common/activate

blissful sage
#

hmm ok

#

now I kinda have a different error

#
/Users/username/PycharmProjects/NYCJobs/update_nyc_jobs_data.py: line 2: import: command not found
/Users/username/PycharmProjects/NYCJobs/update_nyc_jobs_data.py: line 3: import: command not found
from: can't read /var/mail/tempfile
from: can't read /var/mail/quickstart ```
#

temp and quickstart are files my script referrences

#

quickstart is a .py file that I make a call to

#

tempfile is library

#

@glossy ridge lmk what you think when you're free

glossy ridge
#

@blissful sage show your full shell script, how is it now

blissful sage
#

well

#

it carries over into the next screen

glossy ridge
#

no

blissful sage
#

so there's a dollar sign in the middle of it when I paste it

glossy ridge
#

I mean the shell script

#

the one you are calling from cron

blissful sage
#

that's what I'm reffering to

glossy ridge
#

it should have 3 lines

blissful sage
#
source /Users/username/.pyenv/versions/3.7.3/lib/python3.7/venv/scripts/$
/Users/username/PycharmProjects/NYCJobs/update_nyc_jobs_data.py
glossy ridge
#

you can't have the space before the #

blissful sage
#

but the $ I think is a place holder or something

glossy ridge
#

that is because of the editor you're using

blissful sage
#

ok

#

theres not space before the #

glossy ridge
#

second line should start with python

#

python /Users/username/PycharmProjects/NYCJobs/update_nyc_jobs_data.py

blissful sage
#

space after python

glossy ridge
#

yes

blissful sage
#

ok this cronjob is running every 5 minutes

#

so I'll see if it worked in like 4 minutes

glossy ridge
#

you can test running the script by hand to see if it has some unrelated error

#

to save time

blissful sage
#
source /Users/username/.pyenv/versions/3.7.3/lib/python3.7/venv/scripts/$
python /Users/username/PycharmProjects/NYCJobs/update_nyc_jobs_data.py```
#

what do you mean

#

you mean using the debugger for shell scripts?

glossy ridge
#

save this script, then exit the editor and run it from the command prompt

blissful sage
#

oh

glossy ridge
#

instead of waiting for cron

blissful sage
#

yeah i gotcha

#

ok well

#

that did something

#

now I get more errors in the code though

#

like a pageworth

glossy ridge
#

good

blissful sage
#

i dunno if I should paste it tbh

#

it's like project specific stuff like

#

FileNotFoundError: [Errno 2] File b'/Users/username/Documents/scripts/nycjobs_data.csv' does not exist: b'/Users/username/Documents/scripts/nycjobs_data.csv'

#

nycjobs_data.csv is a file that is refferenced in my script

#

but it isn't stored in scripts

#

but I guess the computer thinks it should be?

#

scripts is where I keep shell scripts

glossy ridge
#

well, when your script is running, your current directory is not the directory where the file is; and your script is looking for the file in the current directory

blissful sage
#

oh then most of the errors I got with this run are like that

glossy ridge
#

you have two options; cd to the correct directory before running the python script; or change your script so that it looks for the files in the correct directory instead of just opening them from current directory

blissful sage
#

hmm ok

#

can I add you?

glossy ridge
#

!no-dm

shy yokeBOT
#
no-dm

Can I send you a private message?

No. We do not provide one-on-one tutoring - you can hire someone locally if you really need that. We also prefer that questions are answered in a public channel as it means that everyone else present is able to learn from them. If you're working with code that you are unable to disclose for any reason, you should try to make your question more general and write a separate, small piece of code to illustrate your problem.

blissful sage
#

hmm ok

#

not sure which one I should do

#

cd or change path

#

there are some .getcwd calls in my script

#

basically my script makes a call to an api, downloads the info to a temp file, in the cwd and then compares it to another file on hand. It then keeps replaces the file it is comparing it to, if the two files are different.

#

it also parses the data, and then uploads it to a shared google drive

#

and I am trying to automate this with cron

glossy ridge
#

you still have the same two options:

  1. refactor the python script to not depend on cwd
  2. change the cwd before running the python script, by using the cd command in the shell script
blissful sage
#

cd comman in the shell script I think is simplest

glossy ridge
#

long-term I would prefer the refactor; but that's just me

blissful sage
#

yeah

#

well long term im going to change a lot of the internal stuff of this script

#

like im going to migrate this to cellary

#

and im going to use a timestamp call from the api to compare data sets

#

but for the next couple months id like to just have this running on auto pilot so I can do other stuff

#

you've been really helpful, I appreciate your time

#

I really don't understand why it's doing all this stuff though,

#

things were fine before I installed homebrew

#

like I was able to use crontab for this script with a direct call to the env path

#

and && for the py file

#

now I have to do all this extra stuff, homebrew also messed up my dependencies in my ide

glossy ridge
#

Well, I always use a shell script instead

#

for cron jobs

#

because I can setup everything easily without mashing all into a single command line

blissful sage
#

yeah

#

abstractions

#

this is the deepest ive gone into shell scripting/how the terminal works

#

ive been studying on ldp, made my first shell script a few days ago as practice

glossy ridge
#

I live in the terminal, use it for all sorts of things

blissful sage
#

and then decided that it was enough knowledge to try and solve the actual problem I needed to solve

#

yeah, the more you practice the easier it is

#

and useful

blissful sage
#

@glossy ridge you're the man, thank you for your help. it works

#

actually not quite >.<

#

when I run crontab it doesnt seem to work quite right, but when I run it from shell manually it does

blissful sage
#

so how does one change directories in a shell script
seems like when i do cd as a part of the script, bash opens up a sub shell

#

I tried creating an alias and adding that to my script

distant prawn
#

Cd is what you want

#

Each script opens a sub shell, but the commands all run in the same shell

blissful sage
#

so it should cd correctly

#

because I've been getting errors

#

oh

#

basically

#

my shell script works when I run it manually in bash

#

but when I try to crontab it

#

my dependencies don't load

#

and I get a module not found error

#

cd /Users/username/PycharmProjects/nycjobs
source /Users/username/.pyenv/versions/3.7.3/lib/python3.7/venv/scripts/common/activate
python /Users/username/PycharmProjects/NYCJobs/update_nyc_jobs_data.py```
warped nimbus
#

try doing the cd outside the script and in the crontab?

edgy minnow
#

there should be an activate in the project/env itself to run shouldnt there?

warped nimbus
#

Depends, the venv can be anywhere it's just typically in the project directory or in some designated dumping ground for venvs in the home folder

#

That activation does look odd though. Not sure what's going on with that

#

Maybe it's just a way to make it use python 3.7 via pyenv?

blissful sage
#

I tried that mark

#

didn't work

#

and yes I think that was the idea regarding activating pyenv

#

my script works when I run it in bash manually

#

but not through crontab

warped nimbus
#

Which module isn't found. One that you wrote?

blissful sage
#

so basically I am using crontab to schedule a python script

#

which has dependencies

#

and these dependencies are not loading when I schedule it

#

but are when I run the shell script manually

warped nimbus
#

The dependencies are packages you installed?

blissful sage
#

the dependencies are in my venv

#

yes I installed them

warped nimbus
#

where is your venv?

blissful sage
#

my guess is it's /Users/username/.pyenv/versions/3.7.3/lib/python3.7/venv/

warped nimbus
#

That doesn't sound right

blissful sage
#

well then I am clueless where it actually is, I installed homebrew recently and it kind of messed everything up

#

I'm also new

#

and clueless

warped nimbus
#

Do you know how you created the venv? Which command(s) you used?

blissful sage
#

I had to recreate it, because my IDE couldn't find it after homebrew

#

so I used pyenv

warped nimbus
#

Well pyenv isn't a virtual environment

blissful sage
#

yeah but like I had to create it

warped nimbus
#

Well in a sense it is but that's not it's purpose.

blissful sage
#

and pyenv runs a lot of that automatically, no?

warped nimbus
#

pyenv just manages different versions of python on your system

#

typically if you would first run a pyenv command to change the current python version to use

#

and then you'd create a venv in one of various ways

#

using the venv module in the standard library or using tools such as virtualenv, virtualenvwrapper, etc

blissful sage
#

pipenv

#

but my script runs fine in my ide

#

and in shell

warped nimbus
#

pyenv does some fancy shell stuff so I guess it trips up 🀷

blissful sage
#

alright

#

i dont know what to do

#

lol

warped nimbus
#

I am guessing your venv is fine, you just need to activate it properly

#

but you'd need to know the path to it

#

Or maybe not... just pipenv run might work since you're using pipenv

blissful sage
#

well it looks like my bash_profile is modified

#

and there's some pyenv stuff in there

warped nimbus
#

Yeah that's normal

#

That's a good point actually

#

cron jobs probably don't use your bash profile

blissful sage
#

yeah that's what someone else was saying

#

when I ran the shell script using sudo su -

#

it got a "command not found"

warped nimbus
#

Here is something from pyenv themselves

blissful sage
#

oh alright so it is a pathing issue

#

that's good news

warped nimbus
#

Well maybe

#

I honestly don't understand enough about how pyenv works under the hood

blissful sage
#

ok, well at least you're honest

#

and you;ve been helpful thus far

warped nimbus
#

And the other thing is that the way you're activating looks odd to me

blissful sage
#

yeah like

#

that export PATH=~/.pyenv/shims:~/.pyenv/bin:"$PATH"

#

is in my bash profile

robust cave
#

basically, pyenv places a small executable at the start of your PATH, so whenever you run python or pip, the executable gets executed, which passes the command along to pyenv, and pyenv will then decide based on global/local/shell/directory specific settings which python version to run

blissful sage
#

yeah

#

so then how do I ensure that the file path is consistent across profiles

#

and that sounds like an easy way to mess up my computer

#

oh hmmm, looks like I can specify which user to run the cronjob under

warped nimbus
#

Maybe you could just leverage pipenv. It does support automatic detection of pyenv after all

blissful sage
#

where'd i drop the pipenv run

warped nimbus
#

just pipenv run python your_script.py

#

you wouldn't need to activate the environment yourself since pipenv will do that

blissful sage
#

as a part of the shell script you mean

warped nimbus
#

yeah

blissful sage
#

going to give it a try one sec

warped nimbus
#

you may need to set the PYENV_ROOT env var so pipenv knows where to look for the python version, but I think since you have already created the venv it should be fine

#

(assuming you created the venv properly)

blissful sage
#

so since I am changing the shell script to run pipenv

#

then I should change the cronjob as well to what?

warped nimbus
#

I don't understand your question

blissful sage
#

nvm

warped nimbus
#

the cron job will keep executing the same shell script as before, no?

blissful sage
#

it's fine

#

yeah sorry, there's a lot of moving parts. I had added in the cd to the cronjob

warped nimbus
#

turned out not to be a cd issue

blissful sage
#

yeah

#

pipenv command not found

warped nimbus
#

How'd you install pipenv?

#

I normally install it system-wide via the package manager

blissful sage
#

I think I brew installed it

warped nimbus
#

Oh right, macOS. Not sure how brew deals with that

blissful sage
#

please kill me

#

.<

warped nimbus
#

Ok maybe you can do it without the pipenv command, just activate the environment by sourcing the activate script as before

#

only the correct one cause the one you used before looked weird

#

So for that you would need to know where pipenv made the virtual environment

blissful sage
#

i think i can use brew to find that

warped nimbus
#

You could run pipenv --venv to find out

#

just cd into your project and run that command

blissful sage
#

ok

#

found it

#

so then I just add that to my shell script on a separate line

warped nimbus
#

hold on

blissful sage
#

I didn't activate it yet

warped nimbus
#

while you're there can you confirm pipenv run python --version uses the correct version?

blissful sage
#

it uses the most up to date version, which should be the correct one

warped nimbus
#

and does pipenv run pip list show your dependencies?

blissful sage
#

uhhh

#

kind of

#

like half of them

#

for example I use google auth

#

and it's not in pip list

warped nimbus
#

is that dependency listed in your Pipfile?

blissful sage
#

you mean I should open the pipfile in my ide?

#

because if so, no google auth is not listed

warped nimbus
#

Then you should add it to your pipfile

#

along with all other dependencies you need

blissful sage
#

ok wait hold on one second

#

because

#

..

#

well this script makes a call to another script

warped nimbus
#

if you just use pipenv install dep_name they'll get added

blissful sage
#

so like

#

I don't understand why my script works then

#

could it be that it's not even using pipenv

warped nimbus
#

probably

#

Like I said I never understood which venv you were even activating

blissful sage
#

me neither

#

this got really complicated really fast

#

believe me I had a hell of a time trying to fix this mess, and I'm so glad that I could even run this script

warped nimbus
#

From my perspective I feel it went from complicated to simple

#

At least the solution

blissful sage
#

I worked on it for almost a half a year, and then homebrew just crushed my hear

warped nimbus
#

If you just properly activate venv that pipenv made, I think everything will work πŸ€”

blissful sage
#

I still am having a hard time understanding why I'm doing pipenv stuff, if my script runs fine in the ide

#

and even the shell script

#

do you think itll make a difference that I am calling another script

#

within this script

#

which has its own set of dependencies

warped nimbus
#

How are you calling it? with subprocess?

blissful sage
#

from ____ import main

warped nimbus
#

Ah, that is good. It would be better to say you are importing another script rather than calling it

blissful sage
#

ok

warped nimbus
#

Anyway, yes you would need all that other's scripts dependencies too

blissful sage
#

lmao

#

for a second there I thought I wouldn't need them

warped nimbus
#

Regarding pipenv: it's just a tool for virtual environments and dependencies. You can use another tool if you want, but at the end of the day it is highly recommend to use virtual environments.

blissful sage
#

blah now im getting errors with pipenv

#

think it's safe to clear the lock file?

warped nimbus
#

yes

blissful sage
#

it's recommending I do that or just skipping it

warped nimbus
#

you can just recreate the lock file if it's broken

#

Just make sure all your dependencies are listed in your Pipfile

#

then you can run pipenv install and it'll install them from the Pipfile

blissful sage
#

tempfile is a default library correct?

warped nimbus
#

yeah

blissful sage
#

alright I am just installing my dependencies now, thank you for your time

#

I keep getting no version found errors

#

and recommendations to clear my lock

#

however my pipfile is being updated

warped nimbus
#

yes just delete your lock file

#

You could just open the pipfile in an editor and type in all the dependencies

#

Then, delete your lock file. Finally, run pipenv install to install dependencies from the Pipfile

blissful sage
#

is the full command pipenv install

#

or should it be pipenv install pipfile?

#

oh man I got a bunch of errors

warped nimbus
#

can you share your pipfile

#

and the full command is exactly how I typed it

blissful sage
#
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
__future__ = "*"
pickle = "*"
os.path = "*"
googleapiclient.discovery = "*"
google_auth_oauthlib.flow = "*"
google.auth.transport.requests = "*"
apiclient.http = "*"
pandas = "*"
requests = "*"
os = "*"
tempfile = "*"
quickstart = "*"




[requires]
python_version = "3.7"
#

err quickstart shouldn't be in there

warped nimbus
#

Several of those are part of the standard lib

#

__future__ , pickle, os.path, os, and tempfile

#

And you need to specify dependencies as they are called on PyPI, not how they are imported in code

blissful sage
#

I don't know what you mean by your last sentence

warped nimbus
#

I can help you with their names: ```
google-api-python-client
google-auth
pandas
requests
apiclient

#

pipenv will download the dependencies from PyPI. That stands for the Python Package Index

blissful sage
#

oh gotcha

warped nimbus
#

You can see its name is not the same as how you use it when you import it googleapiclient.discovery

blissful sage
#

so in my pipfile I need to use the pypi names

warped nimbus
#

Yes

#

And I think I just gave you all of them

#

The rest were already part of the standard library

blissful sage
#

yeah

#

well

#

toml.decoder.TomlDecodeError: Key name found without value. Reached end of line. (line 9 column 25 char 127

#

and also a huge wall of text

warped nimbus
#

You must have forgotten to add the = "*"

blissful sage
#

ok that worked

#

so then id need to activate this pipenv

warped nimbus
#

yeah, use pipenv --venv to get the location

#

then the activate script should be bin/activate

#

and you just source it in your shell script

blissful sage
#

what do you mean the active script should be bin/activate

#

sorry dude

#

like I pipenv --venv /Users/username/.local/share/virtualenvs/NYCJobs-50ClFx78

warped nimbus
#
pipenv --venv
/blah/project/venv

so that means
source /blah/project/venv/bin/activate

blissful sage
#

that's my location for the venv I think

#

so it should be source /Users/username/.local/share/virtualenvs/NYCJobs-50ClFx78/bin/activate?

#

well

#

that aint it

#
Traceback (most recent call last):
  File "/Users/username/PycharmProjects/NYCJobs/update_nyc_jobs_data.py", line 1, in <module>
    import pandas as pd
ImportError: No module named pandas
#

I likely typed in your instructions incorrectly

warped nimbus
#

Can you show your shell script used for the cron job

blissful sage
#
#!/bin/bash

#cd /Users/username/PycharmProjects/nycjobs
source /Users/username/.local/share/virtualenvs/NYCJbs-50ClFx78/bin/activate

python /Users/username/PycharmProjects/NYCJobs/update_nyc_jobs_data.py 
warped nimbus
#

That looks ok

#

Can you try doing this in your terminal? ```bash
source /Users/username/.local/share/virtualenvs/NYCJbs-50ClFx78/bin/activate
pip list

blissful sage
#

well I get a no such file or directory

#

and then a pip list

warped nimbus
#

Ah, so can do you do ls /Users/username/.local/share/virtualenvs/NYCJbs-50ClFx78/?

blissful sage
#

I get bin include lib src

warped nimbus
#

can you ls the bin folder in there?

#

do you see activate anywhere?

blissful sage
#

yes

warped nimbus
#

what was the error you got when you did source activate again?

#

what directly/file did it fail to find?

blissful sage
#

/Users/username/.local/share/virtualenvs/NYCJbs-50ClFx78/bin/activate

warped nimbus
#

that doesn't make sense since you just confirmed it exists...'

blissful sage
#

:/

warped nimbus
#

is it typed correctly?

#

did you see activate in the bin folder exactly like that?

blissful sage
#

yes

#

but there is a discrepancy

#

so like

#

in the shell script

#

it's NYCjbs

#

but after the venv printed location

#

it was NYCjobs

#

let me try

warped nimbus
#

weird...

#

maybe you jus made a typo?

blissful sage
#

mayb

warped nimbus
#

it should be exactly what pipenv --venv gives

blissful sage
#

ok well

#

now we got different errors

#

specifically it isn't importing main, from the other script

#

and it looks like I was missing one of the google dependencies

warped nimbus
#

and you probably need to still cd into the project folder so it imports the other script correctly

blissful sage
#

ok so I'll cd into the correct file path

#

in the shell script

#

should I delete lock file like before, and reinstall dependencies?

warped nimbus
#

You shouldn't have to

#

if you just do pipenv install the_name it should add it just fine

blissful sage
#

alright

#

done

#

should I reactivate the projects venv as it's requesting me to,

#

probably not since it's already active

warped nimbus
#

not sure what you mean

#

where is it asking for that?

blissful sage
#

i pipenv install google-auth-oauthlib

#

in the terminal

#

installation succeeded, then theres an issue with the lock file again

warped nimbus
#

You may be talking about the notice pipenv gives that it's gonna use the current virtual environment cause it detected it

#

That's strange, I don't know why you constantly keep getting lock file issues

blissful sage
#

actually

#

I lied theres no lock issue

#
Updated Pipfile.lock (ad9223)!
Installing dependencies from Pipfile.lock (ad9223)…
  🐍   β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰β–‰ 23/23 β€” 00:00:05
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
warped nimbus
#

good

#

try the cron job again

blissful sage
#

yeah

#

well different errors kind of

#

still couldn't import the other script

#

and then one of the other dependencies isn't accurate

warped nimbus
#

Did you cd into the project?

blissful sage
#
ModuleNotFoundError: No module named 'apiclient.http'```
warped nimbus
#

And which dependency is messing up?

blissful sage
#

the one above, I just pasted

#

this is my shell script

warped nimbus
#

Try pipenv uninstall apiclient

#

I think I mistook it for a different dependency but it looks to be part of google

blissful sage
#

cd /Users/username/PycharmProjects/nycjobs
source /Users/username/.local/share/virtualenvs/NYCJobs-50ClFx78/bin/activate

python /Users/username/PycharmProjects/NYCJobs/update_nyc_jobs_data.py ```
warped nimbus
#

aren't paths case sensitive in macOS?

blissful sage
#

all paths have been copy and pasted

#

but which one are you referring to

warped nimbus
#

the one you cd to

#

nycjobs is lowercase

#

though apparently it doesn't matter on macOS

blissful sage
#

the directory is lowercase

#

the script is not

#

I got the right dependency though

#

google-api-python-client-py3

warped nimbus
#

try adding -m option to the python command

#

so python -m script.py

#

IIRC it will make it look in the current directory for other scripts

blissful sage
#

ok

#

I guess it doesn't matter if I put the full file path to the python script, in the shell script

#

so

#

python -m filepath/pythonscript.py

#

that worked

warped nimbus
#

πŸŽ‰

blissful sage
#

xD

#

thank you!

warped nimbus
#

you're welcome

blissful sage
#

I am going to continue to use pipenv

#

don't know if it's worth keeping pyenv

warped nimbus
#

I don't think macOS comes with the latest Python so you need pyenv for that

#

though maybe you can install python3 directly with brew

blissful sage
#

yeah

warped nimbus
#

I messed around with that stuff like a year ago on mac I just don't remember anymore.

blissful sage
#

but they say use pyenv to manage them

warped nimbus
#

Pyenv only useful if you plan on using more than 1 version

blissful sage
#

yeah, I think I needed to which is why I downloaded brew to begin with

#

and then I didn't load it properly

#

and practiced SQL isntead for a job opportunity that fell into my lap

#

which I didn't get

#

and then I go back to programming, and my setup is messed up, pycharm isn't running my script

#

meanwhile, I spent like over 6 months on this project, and I had no idea what any of this stuff does, no real experience with the terminal either

#

it's been like walking around with a blindfold.

#

thanks a lot for your help, I know I was annoying.

warped nimbus
#

You're welcome

#

believe me you were not annoying you were actually very patient trying different things

blissful sage
#

I feel guilty asking questions that I could google

#

but then it's like sifting through a pile of stuff looking for the right thing, when I have no frame of refference

#

so like I have to juggle that

warped nimbus
#

Well you already had my attention and they were simple questions so I don't mind

blissful sage
#

how long have you been programming?

warped nimbus
#

3.5 years

blissful sage
#

nice!

#

I am about 1 year in

#

but not huge amount of time invested

warped nimbus
#

wish you luck on your journey python

blissful sage
#

any learning resource that you'd recommend?

#

and then I'll leave you alone xD

warped nimbus
#

!resources

shy yokeBOT
#
Resources

The Resources page on our website contains a list of hand-selected goodies that we regularly recommend to both beginners and experts.

warped nimbus
#

take your pick

blissful sage
#

alright thank you, have a good evening. See you around.

warped nimbus
#

cya

blissful sage
#

well it stopped working

distant prawn
#

new dolphin is trash, can anyone recommend a replacement?

main olive
#

ranger πŸ˜„

median swan
#

I have a file-system question, if anyone knows this

#

I was on Linux, and did a "cp -R " operation to copy files into a folder on an external NTFS drive

#

subsequently, that folder was unreadable on either Linux on Windows

#

I was able to run chkdsk on windows for the drive and more or less recover all the files (although they'll all dumped into a giant lost and found pile -- I'll have to sort that out)

#

my question is: does anyone know what happened?

#

I feel like it wasn't a hardware error, but something to do with writing to NTFS on linux

main olive
#

uh, what's -R

#

my cp doesn't have that flag

#

oh, it's just -r

#

ntfs has been known to act up

#

i usually use rsync when working with ntfs

grave jolt
#

how did you disconnect the drive? perhaps it was not done writing yet.
the ntfs drivers are pretty stable these days so it unlikely but possible there was a bug

main olive
#

oh yeah

#

always do sync before removing the drive

#

or umount it, which does sync by itself

median swan
#

I "ejected" the drive from within the file explorer (nemo?)

#

does that constitute unomunting?

robust cave
#

yes, there might be an issue in that sync progress isn't checked before unmounting , but you'll have to do a little digging to find out

main olive
#

@robust cave i assume the eject does umount which calls a sync behind the scenes before actually unmounting, but I might be wrong, nemo might use their own implementation (why?)

robust cave
#

iunno, I was just suggesting the possibility, I haven't used nemo

main olive
#

welp
whips out strace

main olive
#

how do you redirect output to both stdout and file

main olive
#

command | tee filename

main olive
#

is anyone alive..

#

I'd like to know if tee appends or overwrites

#

it appends if you use -a

#

ok

robust cave
#

great to see you're finding that out yourself, you should do that more often

main olive
#

My terminal is frozen

#

I tried restarting, reloading

#

spamming buttons

main olive
#

what command does your terminal run when opening?

#

it should be in the settings

#

@main olive

#

Thank you, it seems I checked "use custom command instead"

#

while leaving it blank

#

._.

#

πŸ‘ glad you got it fixed

warped nimbus
#

Is there a standard name for the group equivalent of "nobody"

#

On Arch it's also called "nobody" but on Alpine it's "nogroup"

#

I can check tomorrow if Alpine its just an alias in Alpine for "nobody" too

#

Just lazy right now

haughty verge
#

Just pick which distro you like more

#

i.e. Alpine

warped nimbus
#

The context is that I am running tests locally for something that is normally runs in a Docker container which uses Alpine

#

Currently it's hard-coded to use "nogroup" and that fails locally cause the group doesn't exist on Arch

#

I need something that will work consistently regardless of distro ideally

#

But if not I can just add a note saying to create an alias for the group if your distro doesn't have it

#

or make it use an env var

haughty verge
#

Environment var sounds practical

#

It seems to be my team's catch-all nowadays

robust cave
#

I have no idea which distros roll a different name though

haughty verge
#

That's technically correct. The best kind.

robust cave
#

I linked 3.1 but I just checked the pdf version of 5.0 and it's still nobody:nobody

warped nimbus
#

Thanks kosa. I'll see if alpine has nobody too tomorrow

#

And could check debian too while I'm at it

robust cave
#

would be good to have a note saying that some distros do it non-standard too

warped nimbus
#

Yup

haughty verge
#

But the default of your environment var will be the right way to do it

#

I'm italicizing too much

warped nimbus
#

Yeah I was gonna add that anyway but changing the default to the more common one would be nice

haughty verge
#

If Alpine is the exception that could be worth submitting a bug report

warped nimbus
#

I don't think so. I recall Wikipedia mentioning no group as an alternative and it implied several use it

haughty verge
#

It looks like my Yocto BSP uses both:

root@apalis-imx6:~/cytovale-sw/scripts# cut -d: -f1 /etc/group | sort
...
nobody
nogroup
...
warped nimbus
#

That's a good sign

#

Thanks for looking into that

haughty verge
#

I'm pretty curious now, honestly.

oak shell
#

Ubuntu has nogroup

#

Would it not always be numeric ID 65534 at least though?

#

you could find out its primary group name withid -gn nobody anyway

main olive
#

^

#

always use id 65534:65534, because that's the only thing that never changes

#

hell, even uid 0 might not be root if a distro decides to rename it

#

always check ids, not usernames

oak shell
#

Awful idea of the day: make a Python Linux distro and rename root to bdfl

main olive
#

why not, sounds like a fun evening

robust cave
#

SnekLinux

vestal turret
#

rip in peace.

#

We will never have another bdfl

zinc bobcat
#

Can’t run as root if you name it bdfl

robust cave
#

run as bdfl

warped nimbus
#

I didn't test if I could pass ids instead

#

I'll try that

hearty scarab
#

Is anyone aware of a way to expand $_on call in zsh ?

main olive
#

@hearty scarab trying to get the last argument? IIRC zsh (and most shells in general) don't support it

#

try !$

hearty scarab
#

A lot of Shell support $_ the question is how to expand it

warped nimbus
#

What do you mean by expand?

#

Cause just doing echo $_ would be considered expanding it then echoing it

hearty scarab
#

It expand on execution, I'd like it to expand before exec

#

Just like !! does

main olive
#

it does expand on execution, just like any other variable

#

how do you expand something before executing? ... lol

hearty scarab
#

solution, use !$

formal schooner
#

$_ is parameter expansion which is done when the command is run

#

the only "pre-emptive" expansions are usually history expansion (in the case of zsh) and filename generation/expansion

main olive
#

@hearty scarab that's what I first said lol

hearty scarab
#

True

#

Thanks

young bane
#

guys, i have to check a lot of servers, what services are they using

#

and they have a lot of webapps in apache and tomcat

#

what would be the best way to do this ? (sorry for my bad english)

#

actually im checking the tomcats dirs, and using chkconfig --list to check the services

autumn walrus
#

if you have ssh access you could write a python script that uses paramiko to ssh to each server, run the command and get the information back. Alternatively saltstack has remote execution for managing a lot of servers. Sorry for plugging saltstack in both #414737889352744971 and here, but it is a fantastic tool for managing a large infrastructure from one place

hearty scarab
#

Quick ansible ad-hoc

young bane
#

i will check paramiko, thanks!

#

i cannot install anything, but i have access to chef

#

and knife

hearty scarab
#

or just list all your servers in a file and

for i in $(cat file); do
    ssh -q "$i" "my awesome command" > "$i.out"
done
young bane
#

thanks @hearty scarab

#

still this leaves apache contents and tomcat contents outside

hearty scarab
#

?

hearty scarab
#

What do you mean ?

young bane
#

i need to know what services and apps are working in the server

#

that work for services

#

but i dont know wich apps are in the tomcat or apache servers (if there is any)

hearty scarab
#

So your problem is not to gather info from several servers but to retrieve the needed info

#

If you do a ps aux | grep tomcat you will see the running config and dig from thete

deft raft
#

How would I go about bridging my wifi to my ethernet port on Manjaro?

hearty scarab
#

wanna act as a gateway ?

#

btw, I'm not sure about what handle the networking on manjaro but some interfaces conf might be able to handle it

deft raft
#

I just wanna get the wifi from my laptop to my desktop through ethernet

main olive
#

iptables MASQUERADE fuckery @deft raft

deft raft
#

I've been over all the wikis and guides

#

I'm either too stupid, my computer is stupid, or something is broke

sage solar
#

probably all three

#

ive been messing (and failed) with iptables a lot before disocvering the nm thing which doesnt work for you

deft raft
#

I just want internet on my desktop as the houseowner has yet to fix mine ._.

sage solar
#

dnied

hearty scarab
#

Did allowed ipv4 forward in sysctl?

blissful sage
#

would I be able to modify my mouse pointer so that a line appears along the X and Y axis across my screen?

main olive
#

hmmmm

#

not that i know of, but you can probably write a simple C program which overlays everything and communicates with X to get the cursor position

#

or, actually

#

hmmm

#

maybe you can just set an extra large cursor and draw the "Crosshair" in gimp or something

#

nah, that won't work, apparently 128x128 is the max cursor size

#

can always just patch Xorg i guess

blissful sage
#

hmmm

#

interesting

#

I could probably write a shell script to switch between the patched and non patched versions of xorg

#

but would it be different on windows I guess?

main olive
#

most definitely yeah

#

i don't know much about windows tbh, dunno how you'd solve it there

main olive
#

Does anyone have experince with configuring Realtek network cards on Deepin

#

My download speeds are incredibly slow

#

Can't use Pip or anything else

hearty scarab
#

Anyone using awesomewm ?

stone pier
#

I am

hearty scarab
#

Any idea how to make terminator transparency works ?

#

I did declared a class for it with opacity setting but nothing

stone pier
#

I'm away from my computer so give me a sec, I'll be right back

hearty scarab
#

πŸ‘Œ

stone pier
#

so you meant terminal right? otherwise i don't know what terminator is in this context

hearty scarab
#

yup its my terminal emulator

stone pier
#

what terminal do you use?

hearty scarab
#

terminator :/

stone pier
#

ohhhhhhhhhhhh

#

haha

hearty scarab
#

not the best but the one im used to, might move to tmux later

stone pier
#

i use gnome-terminal, and it handles transparency just fine. I've never used terminator

#

either way, i doubt the window manager is relevant here

hearty scarab
#

It just works in cinnamon

stone pier
#

really? hmm

hearty scarab
#

really πŸ˜„

stone pier
#

and with presumably the exact same configuration loaded up in awesomewm, it doesn't work?

hearty scarab
#

yep

stone pier
#

interesting

hearty scarab
#

something should be missing but th question is what

stone pier
#

how do you run awesomewm?

#

do you have a line in your .xinitrc?

hearty scarab
#

nop, started it throuh the default ubuntu environment selector

#

i dont really know what is it

#

I'd like to take time configuring my awesome before killing cinnamon

stone pier
#

i feel you, i've been using awesome for like close to a decade, and it still confuses me. Do you have a .xinitrc file though?

hearty scarab
#

doubt it

#

started a find

#

nothing in my home at least

stone pier
#

it's a hidden file, so that might hide it from the search not sure

hearty scarab
#

obviously but i also looked for those

stone pier
#

gotcha

hearty scarab
#

I guess ill bother one of my workmate tomorrow

stone pier
#

lol

#

good luck

hearty scarab
#

which screensaver do you use ?

#

xscreensaver ?

stone pier
#

i used to, now i use i3lock funny enough

hearty scarab
#

looks fancy

#

do you use any addon or whatever on it ?

stone pier
#

yea, i have it set up to take a screenshot of my current desktop when I peform the keybinding, which it then blurs, and finally sets as the lock image

#

so it just looks like my screen went blurry when i lock it

hearty scarab
stone pier
#

to be honest, i don't remember how it works anymore

#

i set it up a while ago

#

what you linked is cool, i'm doing it manually, not using that

#

i wonder if that existed when i set it up

hearty scarab
#

thi is in ubuntu repos πŸ‘

#

and just works great

#

nice

stone pier
#

nice

hearty scarab
#

main problem is transparency now πŸ˜„

#

thanks

stone pier
#

lol yea np

hearty scarab
#

compton was missing

main olive
#

I was gonna ask if you have a compositor, yeah

#

the thing actually responsible for transparency..

rose cairn
#

anyone knows what ^? means in unix?

#

more so ```

stty erase "^?"```

warped nimbus
#

It means ctrl + backspace

#

Why doesn't set -e work when the error occurs in a function, and that function is called with a command substitution?

#
set -e

foo() {
    curl -sSL ""
    echo "Should be unreachable!"
}

x="$(foo)"
printf '%s\n%s\n' "$?" "${x}"```
#
curl: (3) URL using bad/illegal format or missing URL
0
Should be unreachable!
[Finished in 0.0s]```
#

Calling it without a command substitution will correctly make it error out

#

But then I can't capture its output

#

This seems to only apply to functions I defined. If I call a program in a command substitution then it will still error out x="$(curl -sSL "")" for example

oak shell
warped nimbus
#

@oak shell thanks, but that isn't my issue. That person wanted to disable it sometimes but I want to keep it enabled always, it just doesn't work in some cases.

oak shell
#

I don't think so?

#

did you read the answer?

warped nimbus
#

Yes.

#

They use an AND operator to make the command explicitly tested and thus circumvent the -e

#

I don't want to circumvent it

#

Though the answers example does imply that it would error without the circumvention

#

The difference there is that theirs would fail due to the return whereas mine is supposed to due to just a call in the function

#

I found it

#

shopt -s inherit_errexit

#

Bashism

#

Ah nothing like a clear mind in the morning to figure out solutions πŸ™‚

#

Thanks for helping though Byte

oak shell
#

Ubuntu 16.04 comes with bash 4.3, yes

warped nimbus
#

Forgive me, I am an Arch user. How would I go about updating it to 4.4?

#

It sounds like a hassle, I may just live with repeating set -e inside functions (assuming it works)

hearty scarab
#

Anyone have an automagic xrandr hotplug system for awesome (or i3)?

main olive
#

I was going to say @warped nimbus, $(foo) spawns a subshell and executes in there, at which point set options are reset

#

placing a set -e in the function body should workaround this if inherit_errexit doesn't work

warped nimbus
#

Yeah I just didn't know bash resets it

#

I think I did echo $SHELLOPTS and they all seemed to be the same so it threw me off

#

Does it reset them all or just -e? Cause I think I read it's just -e

main olive
#

good question, not too sure

warped nimbus
#
Subshells spawned to execute command substitutions inherit the value of the -e option from the parent shell. When not in POSIX mode, Bash clears the -e option in such subshells. ```
#

There we have it

somber stirrup
#

@hearty scarab arandr is pretty good at generating scripts

#
layouts="$HOME/.screenlayout"

if type "xrandr"; then
    for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
        if [[ $m = "HDMI-0" ]]; then
            bash "$layouts/office.sh"
        elif [[ $m = "DP-1" ]]; then
            bash "$layouts/home.sh"
        fi
    done
fi

This is my janky display setup script for xmonad

warped nimbus
#

What's the difference between the following two methods of redirection:

#
(>&2 printf "%s\n" "$1")

printf "%s\n" "$1" >&2
#

I see the latter a lot more often. I just saw the former once and started using it instead but don't even know why anymore.

#

It creates a subshell, but why would that be useful in the case I showed above, where it is the only command?

hearty scarab
#

Ty @somber stirrup will try arandr

main olive
#

@warped nimbus with a simple command like that, I can't imagine why it would be useful

#

it's useful when you have multiple lines of commands and want to redirect them all

#

as the () can span multiple lines

#

{} >&2 works the same (except for spawning a subshell ofc)

#

but of course, the method you described might have some other useful side effect I haven't thought of

warped nimbus
#

πŸ€”

#

So it captures stdout

#

That's all I got out of that and idk what that even means

worn apex
#

yeah, redirects happen sequentially normally

#

>&2 2>&1 is 'redirect stdout to the original stderr, then redirect stderr to the new stdout'

#

they should have done 2>&1 >&2 for redirect stderr to the original stdout, then direct the output to the (new) stderr

#

$((>&2 echo ...) 2>&1) would have tested what they were trying to test

#

or like run a command that actually prints to stderr

livid verge
#

@stiff tiger use a program called gparted

#

it allows for graphical partitioning

stiff tiger
#

@livid verge an you give me a better way to delete my exisiting partitions and make a new one?
this is what ive done so far
https://gyazo.com/fee12a3fc6ed29c4476a3b81e9d72088
from this video
https://www.youtube.com/watch?v=BOu_NWHwnOg
can you suggest me a better way?
for my bootable USB?

Thanks for watching. To keep up with my latest content, please subscribe to my YouTube channel at https://www.youtube.com/user/freedomredux In this video, I ...

β–Ά Play video
livid verge
#

gparted

#

@stiff tiger open the gparted program; on the right side of gparted, choose your usb device

stiff tiger
livid verge
#

are you using mint?

stiff tiger
#

manjaro gnome

livid verge
#

ok

#

yep then that is it

stiff tiger
#

ok

livid verge
#

at the top right corner of gparted window, choose your usb device; Then go to the Device menu and choose Create Partition Table

#

make sure your usb device is selected and not your hard drive or you could lose data

stiff tiger
#

@livid verge ive gparted and created a new partition!!
now what should i do to make it suitable for flashing?

livid verge
#

@stiff tiger "suitable for flashing"?

#

did you create a new partition table first?

stiff tiger
#

yes i did

#

i need to mount it right?

livid verge
#

how do you plan on using this flash drive?

#

you want to copy files to it?

stiff tiger
#

trying to flash in an wind 10 iso

livid verge
#

argh

#

why 😦

#

I think you have to create a FAT partition instead, and copy the files from inside the iso to the partition

#

not sure though, long time I don't do it

stiff tiger
#

ok @livid verge thanks tho!!!

main olive
#

@stiff tiger fuck that, you can just WoeUSB to do that for you

#

no need to create partitions manually

somber stirrup
#

Just make sure to use ntfs

warped nimbus
#

Would trying to set memory.memsw.limit_in_bytes for a group give a permission error if memory swap is disabled on the machine?

#

Seems like it from what I just experienced and from some basic research, but haven't seen a definitive answer anywhere

#

Would be nice to confirm

#

More specifically seems to be tied to CONFIG_MEMCG_SWAP_ENABLED kernel config

main olive
#

do you work with/on UNIX-like stuff too? @warped nimbus

warped nimbus
#

I would say I am still a beginner relatively speaking.

#

But yeah I've been working with some unix stuff lately

main olive
#

what about UNIX-like, though? @warped nimbus

warped nimbus
#

I suppose it's more appropriate to say I am working with linux stuff, sorry for being unclear.

#

So to answer your question, no I don't

main olive
#

Linux is Unix-like, though

safe sluice
#

Why this loop is not working for me?

for i in {1..5};do for x in {1..2}; do mkdir rootDir-$i;cd rootDir-$i;mkdir a-$x;done;done

I want to create 2 folders in each 5 root dirs

oak shell
#

because cd changes your environment. it's not scoped to the loop iteration but persistent

#

wrap it in a subshell, that's the easiest way

#
for i in {1..5};do for x in {1..2}; do ( mkdir rootDir-$i;cd rootDir-$i;mkdir a-$x ) ;done;done
#

(didn't test tho)

#

@safe sluice

safe sluice
#

Thanks mate I will give it a try

safe sluice
#

@oak shell thanks buddy it worked

livid forge
#

you can also make the full path with mkdir -p

#

if i understand your use case right.

#
mkdir -p rootDir-$i/a-$x
#
$ mkdir -p rootdir/two
$ mkdir -p rootdir/three
$ ls -1 rootdir/
one
three
two
light elbow
#

I'd recommend a habit of quoting variables so: mkdir -p "rootDir-$i/a-$x"

somber stirrup
#

You can also do it without a loop

[12:31] zer0:temp | mkdir -p foo/{rootDir-1,rootDir-2,rootDir-3,rootDir-4,rootDir-5}/{a-1,a-2}
[12:31] zer0:temp | tree foo/
foo/
β”œβ”€β”€ rootDir-1
β”‚Β Β  β”œβ”€β”€ a-1
β”‚Β Β  └── a-2
β”œβ”€β”€ rootDir-2
β”‚Β Β  β”œβ”€β”€ a-1
β”‚Β Β  └── a-2
β”œβ”€β”€ rootDir-3
β”‚Β Β  β”œβ”€β”€ a-1
β”‚Β Β  └── a-2
β”œβ”€β”€ rootDir-4
β”‚Β Β  β”œβ”€β”€ a-1
β”‚Β Β  └── a-2
└── rootDir-5
    β”œβ”€β”€ a-1
    └── a-2

15 directories, 0 files
analog hornet
#

I'm running some custom data feature creation on WSL. I'm getting a "kernal has died" error pretty consistently on the run through. Individually, each function runs through and the resulting dataframe when dumped to .csv should be 1.7 gb (~1.4M rows, ~100 columns) and fits in memory. I've created this for a slightly smaller data set (~1.2m rows, what the estimates are based off of). Is this happening due to an out of memory error for the WSL subsystem?

Error dump from the console:
https://pastebin.com/X1WrHrLS

analog hornet
#

please hl me if you know what's up (or can help guide me)

balmy gate
vagrant fern
#

you can use ansi escape codes

flat leaf
#

Microsoft released Linux Kernel WSL 2.0. Who knows when it will be available? With regular cumulative update or with new Windows release?

distant prawn
#

where do i get libcrypt.so.1 for fedora?
emacs yells at me for not having it

#

fedora renamed it, of course

stiff tiger
main olive
#

@stiff tiger tried the python-pandas AUR package?

#

python2-pandas for py2

stiff tiger
#

i have python 3.7

#

@main olive

#

the problem being i dont get that error in jupyter when runthrough anaconda

#

but in google colab only i get]

#

\thats strange

copper gazelle
#

@stiff tiger have you tried from pandas.plotting import scatter_matrix in colab yet?

#

these plotting functions have been moved from pandas.tools.plotting to pandas.plotting since >2 years ago..

stiff tiger
#

@that's throwing an error too @copper gazelle

#

see my reshaped question

#

pandas.tools.plotting worked for me like a week ago only ansd now its showing like this but in colab only not in jupyter which I cant use for the moment @copper gazelle

#

ok that worked @copper gazelle

#

thank you

astral spear
#

im trying to host my bot, can anyone help me with working with digital ocean?

warped nimbus
#

Do you have a more specific question in mind?

#

DigitalOcean has great guides on doing a multitude of things

astral spear
#

is there one for discord bots?

warped nimbus
#

There could be, but I have my doubts.

#

So what do you need help with in regards to setting it up?

astral spear
#

the farthest ive gotten to is creating the droplet and launching the console

warped nimbus
#

Which distro is your droplet using?

astral spear
#

i dont know what that is

warped nimbus
#

Ubuntu, Debian, CentOS, etc