#unix

1 messages ยท Page 38 of 1

wheat ridge
#

Ok, changing

#

Okay... Took a sec for it to throw an error this time

#

dear god

#

please save me from this hell lmfao

steel verge
#

don't worry

#

go back to the wsgi file and change it to sys.path.append('/home/pi/dev/webserver/src/webserver_project')

#

That is where your main django file is, right?

#

I don't know your folder structure

wheat ridge
#

sec

#

structure

steel verge
#

then the last line in your conf is also wrong

#

where it says WSGISCript Alias

#

The wsgi file is one level lower

wheat ridge
#

ok hol up

#

when you say "where my main django file is", are you referring to my manage.py?

steel verge
#

yeah

wheat ridge
#

k sec

#

edityed

#

k so wsgiscriptalias needs to be fixed in sites-available now yes?

steel verge
#

yes

wheat ridge
#

you're jesus btw

steel verge
#

I am really not

#

WSGIScriptAlias / /home/pi/dev/webserver/src/webserver_project/webserver_project/wsgi.py

wheat ridge
#

That's what it is

steel verge
#

ok, on the previous one it was different

wheat ridge
#

oh

steel verge
#

Same for the directory directive

wheat ridge
#

ok, anything else you've noticed or should i try it?

steel verge
#

The directory directive with wsgi.py

#

wrong path

wheat ridge
#

ahh

#

sec

#

Trailing slash on that or no?

#

prolly/?

steel verge
#

no

wheat ridge
#

k

#

See anything else?

steel verge
#

your document root

wheat ridge
#

I don't

#

What's that even supposed to be?

steel verge
#

needs a /src/webserver_project appended

wheat ridge
#

k, saving and rtetrying...

#

IT WOOOOORKS OH MY GOD

steel verge
#

good

#

one more thing

#

ON the top of your file you have <VirtualHost *:80>

wheat ridge
#

Hoooooly fuck where are the fireworks at jesus christ

#

hug me

steel verge
#

that means the server is exposed to everyone

wheat ridge
#

Oh fuck, really? Whoa

steel verge
#

Maybe a good idea to limit that to the ip of the ip

#

<VirtualHost 192.168.1.19:80>

wheat ridge
#

Well hold up, this is MEANT to be a LAN website, like I want any device on this network to access it

steel verge
#

This way only people within the network can access it

wheat ridge
#

The intention is to make it a controller for my raspberry pi

#

Oh ๐Ÿ˜ฎ

#

Wait so hold up

#

How do I access it right now outsaide of the network?

#

Like what would I need to do?

steel verge
#

it would be difficult, it is a precaution

wheat ridge
#

Oh ok.

#

I'll change that.

steel verge
#

It would need open ports, yadayada, but better safe than sorry

wheat ridge
#

Ok, so...

#

Alright, it works. I can continue with setting this up now. The critical problem was that apache2 and mod_wsgi weren't talking correctly to each other/other shit, so I can now work again with this project.

#

I'd give you a hug right now and a fifth of vodka if I could.

steel verge
#

it's alright ๐Ÿ™‚

#

glad it works

wheat ridge
#

Dude you have no idea how happy I am. I just sprinted down to my roommates, who were waiting impatiently for me to be done doing nerd shit so we could possibly get drunk, ripped my buddy's laptop out of his hand, smashed in that motherfuckin IP address, handed handed him the laptop, then screamed about how happy I was

#

I've been bitching about this problem for days to him

digital haven
#

any tmux users?

it seems as though if there's a long file that's printed out to the terminal, then i can't scroll up to view it, i can only see what's printed out to the screen. Am i missing something obvious? Or is tihs how it is

steel verge
#

@wheat ridge What you should keep in mind that this is very insecure right now

#

especially since you are using the default raspberry user

#

at some point this setup should be hardened

#

at least make sure pi has a password

wheat ridge
#

The user? It does. I think, anyway.

small sparrow
#

how do i keep processes running after I close an SSH session?

warped nimbus
#

You can create a service unit with systemd or use a tool like screen or tmux

small sparrow
#

@warped nimbus with those is it possible to look at logs that process has created when you start the SSH session again?

warped nimbus
#

Yes

fickle granite
#

also nohup

ionic swift
#

Why do we always call linux & darwin unix when they're not?

#

I find that so weird.

warped nimbus
#

Because they're "unix-like"

#

And that gets shortened to just "unix" though it's technically incorrect

#

But most people know what you really mean or don't care

#

Funnily enough, one does have to confirm when someone really does mean unix

fickle granite
#

oddly enough, words mean what the people who use them think they mean, as opposed to what the elite wish they meant

#

e.g. much as I wish that "literally" meant "the opposite of 'figuratively'", it no longer does

magic basin
#

i have a batch file that connects to a server via ssh, but when i compile it to an exe, i get a prompt saying that ssh isn't a recognised command, how do i solve this?

vague ginkgo
#

test

#

ttt

gaunt edge
#

heyy

#

can someone help me understand how to install kali linux properly on like a virtualbox

#

or where should i install it

digital haven
#

you can install on a vm and there are tutorials on how to do so

gaunt edge
#

okk thanks

main olive
#

Heey

#

Heloo

main olive
#

hi?

winged island
#

Hi

#

Anybody here?

shy yokeBOT
#

Asking good questions will yield a much higher chance of a quick response:

โ€ข Don't ask to ask your question, just go ahead and tell us your problem.
โ€ข Don't ask if anyone is knowledgeable in some area, filtering serves no purpose.
โ€ข Try to solve the problem on your own first, we're not going to write code for you.
โ€ข Show us the code you've tried and any errors or unexpected results it's giving.
โ€ข Be patient while we're helping you.

You can find a much more detailed explanation on our website.

winged island
#

Sorry, i just want have a talk with somebody)

#

I'am using debian with kde and i have such problem as tearing

#

I have read many sites for this info, but no one helped

#

I'am using linux for 4-5 years, and have this problem for all dists with kde

#

my videocard is NVIDIA GeForce GTX 1050

#

I have read that a lot of video cards by Nvidia have tearing problems on linux

livid verge
#

do you have a freesync monitor

winged island
#

Yes

livid verge
#

is it enabled

winged island
#

Yes, but it do nothing

livid verge
#

do you see the G-SYNC visual indicator in green at the top-right corner of your image?

winged island
#

where can i enable this?

livid verge
#

go to display configuration and check the box that says "allow gsync on monitor not validated"

winged island
#

nvidia x server says that i have no g-sync
is it?

livid verge
#

freesync is not gsync

winged island
#

i know, my monitor has opiton freesync, but when i turn it on, it do nothing

livid verge
#

is your monitor in the validated by nvidia list

digital haven
#

anyone use vim and Ultisnips? Just wondering if you typically get a pop-up of snippets that are available

sick storm
#

nope, is that just autocorrect for vim?

digital haven
#

@sick storm is what autocorrect?

sick storm
#

ultisnips

#

or well autocomplete

#

hm looks like it

#

what's the issue with it?

digital haven
#

@sick storm i'm not sure what's unclear about what i asked

#

do you use ultisnips? It seems no? If you don't, i'm not sure how you'd answer

#

I've just switched from ultisnips to coc instead now though, which seems to half use ultisnips somehow, but it's giving me a popup now at least

main olive
#

@winged island does the following command fix tearing?

nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
winged island
#

yes i have tried this, but no effect

main olive
#

How come i am getting different output when i run this:
for i in $(cat smth1); do (cat smth2 | grep "Content-Length") && echo $i; done
and this:
for i in $(cat smth1); do echo $i && (cat smth2 | grep "Content-Length"); done

#

why would the placement of commands separated by and matter

winged island
#

1 && 2
if 1 cant be do, then 2 not do

main olive
#

@winged island spasibo

#

appreciate it

spice relic
#

can CentOS convert MBR to GPT without losing data?

bleak gorge
#

haha lot of fun here

magic basin
#

annoying error ๐Ÿ˜ 

ruby kernel
#

I/O Error: Couldn't open file 'P79-1027.pdf.txt' in git bash
when i tried
for file in *.pdf; do pdftotext -layout "$file.txt"; done

#

i m trying to convert pdf to text

ruby kernel
#

@vestal turret any help here

main olive
#

for file in *.pdf; do pdftotext -layout $file $(echo $file | cut -f 1 -d ".").txt; done

#

@ruby kernel

ruby kernel
#

@main olive what was the issue with above command?

main olive
#

first, pdftotext takes must have 2 parameters, one input file, the other output file

#

you only provided one

#

and also given that every $file contained .pdf at the end, therefore the "$file.txt" would suffix .pdf with .txt on top, hence 'P79-1027.pdf.txt' in your error

ruby kernel
#

i am not able to copy and paste from host machine(windows) to guest machine(linux). I installed VBox_Gas and selected Bidirectional in Drag_and_Drop and Shared_Clipboard in Virtual_Box Setting.

#

Can anyone help me here?

long pilot
wraith jasper
#

hmm

#

which fans...

#

also which distro

#

@long pilot also ask this in another server... maybe linux specific server ?

lofty jetty
#

I prefer arch, but I also like kde neon

potent galleon
#

so i have pycharm installed on my windows machine and i am using virtualbox to run ubuntu in a vm. i want to make a file available to edit from either system how would i go about doing this

fickle granite
#

it's tricky

#

you can share a folder from Windows into ubuntu, but in my experience that works about 50% of the time

potent galleon
#

i have file sharing set up for the file

#

i can see it on my desktop

fickle granite
#

then ... you're done?

potent galleon
#

but pycharm wont load it

fickle granite
#

can't help ya there; I don't use pycharm

potent galleon
#

not a pycharm issue

#

afaik

#

i think it is because you need the password to open it

#

but idk how to change that

fickle granite
#

that's not the kind of shared folder I was thinking of

#

I was thinking of something simple -- you create a file in the folder in one OS, it is immediately visible in the other

#

there's an option for that in virtualbox

cosmic topaz
#

Confused at the purpose of a shebang line, and why itโ€™s necessary to include them at the top of a script you want to execute.

#

Can anybody explain?

fickle granite
#

it's to tell the operating system what interpreter to run the script with

#

if you leave it out, it just assumes it's a "shell script"

#

this is ancient crufty leftover from caveman times

main olive
#

to expand on this, it is only required if you mark the script executable and execute it by itself

#

if you execute the script via the interpreter, the shebang is not necessary

#
python myscript.py # shebang not necessary

chmod +x myscript.py
./myscript.py # shebang necessary
#

@cosmic topaz

worn apex
#

alternatively, you could create a shell script that runs the python module

#

[no-one ever seems to do that even though shebang lines aren't in POSIX and /usr/bin/env is a dirty non-portable hack]

main olive
#

that's generally something I think is missing from POSIX

#

i shouldn't have to have two files to run one file

#

(or, well, three+, if you count the interpreter)

worn apex
#

the problem is the shebang mechanism as traditionally implemented isn't good enough

#

can't handle multiple arguments, arguments with spaces, or execute the interpreter from $PATH [the env thing is a workaround for that, but introduces a dependency on env's own location]

#

it's damn lucky there aren't any common implementations that don't support any arguments at all, or the env thing would have been a non-starter

main olive
#

other than implementation, you have no issues with the shebang design?

cosmic topaz
#

@main olive

#

I still donโ€™t get the point of it

cosmic topaz
#

It just saves time pretty much?

#

You can just type in ./nameofmyscript.py?

fickle granite
#

pretty much

main olive
#

@cosmic topaz it also allows you to have scripts in your path

#

so you can just do myscript.py whereever you're located

cosmic topaz
#

@main olive oh, makes sense now. Thanks

#

You wonโ€™t always have to run the script from the cwd

ruby kernel
#

i am not able to copy and paste from host machine(windows) to guest machine(linux). I installed VBox_Gas and selected Bidirectional in Drag_and_Drop and Shared_Clipboard in Virtual_Box Setting. Can anyone help me here?

worn apex
#

"other than implementation, you have no issues " other than that mrs lincoln how was the play ๐Ÿ˜›

green iron
#

hey guys

#

can anyone help me with setting up mycroft assistant on linux

tepid crescent
#

Hey y'all. For those coding on GNU/Linux, do you prefer vim or pycharm? I've been practicing in vim but I'm not used to yanking and pasting functions that get reused a lot. Just was curious c:

fickle granite
#

I use Emacs

#

๐Ÿ™„

tepid crescent
#

Never tried it. I've only started Linux a couple years ago

#

Does it have support for macros?

fickle granite
#

yes, it has both kinds of macros

#

I wonder why my first sentence is red

#

I don't recommend it

tepid crescent
#

oh it didn't send if it's red, I think

fickle granite
#

yeah I guess not

#

if you like learning new crazy stuff, give it a try. But it's very VERY weird.

tepid crescent
#

well vim was weird to me initially but now it feels amazing and I'm still a newb with it

fickle granite
#

it's not enough better than vim to warrant switching

tepid crescent
#

I'll take your word for it especially if you aren't trying to make a case for it (;

fickle granite
#

I use it mostly out of habit now ๐Ÿ™‚

#

I kinda love it but it's insane.

tepid crescent
#

that's what I love about computer science and OS / Software in general

fickle granite
#

well give it a try by all means

tepid crescent
#

you have so many options and it doesn't have to make sense...if that makes sense

fickle granite
#

you might discover you love it too. Just don't go in thinking "oh there's this nice easy editor that will make my life simpler".

tepid crescent
#

lol! yeah it's just for the love of tinkering

fickle granite
#

oh well if you love tinkering ... emacs is like crack

tepid crescent
#

I need less crack and more of that soft stuff

#

been going through the NSA python course and it's been keeping me sharp..haven't given up yet

fickle granite
#

in the last 10 years I've made 1300 commits just to my ~/.emacs.d directory

main olive
#

So

#

where was I?

past sluice
#

you said

#

debain

#

lol

main olive
#

@past sluice Can I get the link to install debian?

past sluice
#

ya sure

main olive
#

But first, how cheap on performance is kde plasma from debian?

past sluice
#

very cheap

main olive
#

on a percentage?

past sluice
#

again i would say 100

#

you can check it out on YT

#

check the comparison

main olive
#

oh

#

before, did you say debian is very cheap from windows?

#

or kde plasma is very cheap from windows?

past sluice
#

look

#

kde plasma genome lxde they are GUI variants

#

it depends on you want you want

#

for performance use lxde of plasma

main olive
#

lxde?

#

OF plasma?

past sluice
#

no

main olive
#

??

past sluice
#

plasma is default desktop of KDE

main olive
#

daum

past sluice
#

yup

main olive
#

I'm sorry if I go afk

#

Tag me if you wanna say something important

past sluice
#

@main olive np

frigid sequoia
#

fellas, I can't kill the process :S

#

it keeps reviving

fickle granite
#

we've traced the process -- and the execs are coming from inside the house!!

main olive
#

@frigid sequoia what is starting it?

ps uwwp $(ps -p $(pgrep process_in_question) -o ppid=)
#

replace process_in_question with whatever it is you're trying to kill

main olive
#

it's a zombie

digital haven
#

can git hooks run a script?

#

it seems as though i need to use some separate library, i thought that might be a default though

warped nimbus
#

Yes

#

IIRC hooks can be in any language

#

It respects the shebang

digital haven
#

@warped nimbus ok cool - I'll try and dump something in there. What's best - so call a script from the hook that's stored in the repo, or to have the script within the hook. I've never really used hooks

#

I guess call the script rather than have it in the hook

warped nimbus
#

If you want to commit the script to the repo then it's better to call it from the hook

#

Or if you just want to generally re-use the script in multiple repos

digital haven
#

yeah, i want it to be viewable / accessible so all good, i'll try calling from the hook

#

I only see pre-commit hooks :

โ”œโ”€โ”€ [ 478]  ./applypatch-msg.sample
โ”œโ”€โ”€ [ 896]  ./commit-msg.sample
โ”œโ”€โ”€ [3.0K]  ./fsmonitor-watchman.sample
โ”œโ”€โ”€ [ 189]  ./post-update.sample
โ”œโ”€โ”€ [ 424]  ./pre-applypatch.sample
โ”œโ”€โ”€ [1.6K]  ./pre-commit.sample
โ”œโ”€โ”€ [ 416]  ./pre-merge-commit.sample
โ”œโ”€โ”€ [1.3K]  ./pre-push.sample
โ”œโ”€โ”€ [4.8K]  ./pre-rebase.sample
โ”œโ”€โ”€ [ 544]  ./pre-receive.sample
โ”œโ”€โ”€ [1.5K]  ./prepare-commit-msg.sample
โ””โ”€โ”€ [3.5K]  ./update.sample

can i do post instead? or should one stick with the defaults

warped nimbus
#

Yeah, you can

#

Those are just samples. They don't necessarily represent all supported hooks.

digital haven
#

ok cool - i just wrote a pre-commit hook and that works... I'll have a look for post. It's just for syncing project data up to the database, so it's only really a single gsutil command

warped nimbus
#

man githooks will show you all hooks

digital haven
#

ace thanks

#

oh there's no post push hook ๐Ÿ˜ฆ

grave rose
#

Would anyone know of an article that would possibly help me install python libraries using bash?

fickle granite
#

just python3 -m pip install --user name-of-library should work 90% of the time

grave rose
#

Okii

hollow skiff
#

Hey guys first time using cron

#

Does a cron job go in the same directory but different file than the script to be executed by it?

main olive
#

wat

#

just use crontab -e to set a cron job to run the script you've got specified

fickle granite
#

the "job" isn't a file

#

it's a single line in a file called (I think) /etc/crontab, but as xx says, you don't edit that file directly; instead you use a program to edit it for you

#

for Reasonsยฎ

hollow skiff
#

OK thanks lol

#

Clueless me

fathom pilot
#

@here anyone here ever do kafka?

main olive
#

Is there a way to install ubuntu alongside windows without a usb?

#

I don't have a usb and there's a curfew going on outside

#

I can't go and buy one

#

or is there a tutorial that you would recommend me on watching

main olive
#

@main olive got a rooted phone?

main olive
#

@main olive I have an iphone XI

#

is that rooted?

#

Well, what does rooted mean?

#

A windows mobile?

#

ah, no, I meant an Android phone. Rooted just means root access (if you're new to Unix, the root account is the most privileged account). With it, you could've used DriveDroid, which emulates bootable USB media

#

don't think that's possible at all with an iPhone

#

ughhh

#

@main olive maybe a VM could suffice until you can get an USB drive?

#

@main olive Can you link me to a vm installer?

#

it depends entirely on what VM software you want to use

#

I wanna try out ubuntu..?

#

virtualbox and vmware are the more popular ones

#

Yea sure

#

I'll go with virtualbox

#

just create a new VM in virtualbox and point it to the Ubuntu iso

#

performance is not as good when compared to running on real hardware, but you can still get a feel of how the system operates

#

@main olive Can you link me to vm?

#

There are plenty of them when I search

#

VM just means "virtual machine"... it's a concept, I can't exactly link to it

#

virtualbox is a software which lets you create virtual machines

#

..?

#

what are you confused about exactly..?

#

have you heard of virtual machines before?

#

Is virtual machine an installable software?

#

No

#

okay okay, leave the linux thing

#

I don't want it without a usb

#

no, virtual machine is just when you create a new "machine" that doesn't run directly on the host machine's hardware (like if you're using Windows right now), but is instead almost entirely implemented virtually. You can create virtual machines (called "guests"), which run on your host machine, and install operating systems on it, like Ubuntu or Windows

#

@main olive What ide/editor do you use?

#

vim

#

..

#

Are you on linux?

#

yes

#

I assume you are

#

aw man

#

Is vim good on windows?

#

I've never tried

#

ow

#

any other editors you use?

digital haven
#

is it possible to have code snippets for nano?

full oriole
#

is this the place for a grep question?

digital haven
#

@full oriole think it's as good as any... i've asked questions along those lines here before at least

full oriole
#

Thanks @digital haven

#

I have a file, time.txt that has the following entries:
1:12 am 09:33 pm 23:12 14
When I use grep '\(1[012]|[0-9]\):[0-5][0-9] [am|pm] time.txt nothing is returned.

digital haven
#

is that the exact command you've used

#

also - what are you expecting to be returned @full oriole

full oriole
#

Yeah. I would expect 1:12 am to be returned because in the first sub-expression in parentheses it would match 1 then the colon, then 1 then 2 then a space and the am.

#

sorry, that expression is missing a closing single quote '

digital haven
#

just 1:12 am is what you're expecting to be returned?

full oriole
#

Right.

digital haven
#

why have [am|pm] then?

#

and not just am

#

also - egrep is useful if you're using regular expressions

#

eg

-> % egrep '9|3' time.txt
09:33 pm
23:12
full oriole
#

I was going to extend the pattern to match the time 09:33 pm once I could get the first pattern to match correctly.

digital haven
#

so do you in fact just want to return anything that isn't a time?

#

in which case

-> % egrep '[am|pm]' time.txt
1:12 am
09:33 pm
#

seems that it'd be enough

full oriole
#

Ok, so when I use egrep with egrep '(1[012]|[1-9]):[0-5][0-9] [am|pm]' time.txt I get
09:33 pm 23:12 1:12 am

#

No, I'm working through the book Mastering Regular Expressions, and the section is about matching any time in the 24-hr time model.

digital haven
#

ok well i don't really understand what the expected out put is

#

maybe someone else follows

full oriole
#

Thanks @digital haven !

digital haven
#

if i just wanted to match times then from that i'd do something like egrep '^[0-9]?[0-9]:[0-9][0-9]' time.txt

full oriole
#

Right, that's actually the first attempt the book gives, but that could get non-sensical times like 99:99, so the next step is to refine the pattern to only returns real times.

digital haven
#

the files not a great test case then

full oriole
#

Totally :)

#

I'll add to it. Thanks

#

good call

main olive
#

@full oriole something like this?

$ cat times
1:12 am
14:35 am
99:28 pm
21:99
21:22 am
9:1 pm
09:33 pm
23:12
4:25
04:25
24:12
14
$ grep -P '(?:(?:^0?[1-9]|^1[0-2]):[0-5][0-9] (?:am|pm)|(?:^[0-1][0-9]|^2[0-3]):[0-5][0-9])$' times
1:12 am
09:33 pm
23:12
04:25
#

matches only valid 12h times or valid 24h times

full oriole
#

@main olive thanks! give me a minute to digest it ;)

main olive
full oriole
#

Ah nice! What's -P do? I'm not seeing that as an option for grep in the man pages.

main olive
#

you using GNU grep, right? my manpages have it

#
       -P, --perl-regexp
              Interpret PATTERNS as Perl-compatible regular expressions (PCREs).   This  option  is
              experimental  when combined with the -z (--null-data) option, and grep -P may warn of
              unimplemented features.
full oriole
#

Ah yep. I just did a flip through "Linux in a Nutshell", but you're right. I have it on my machine :-)

#

@main olive is this part Perl (?:(?... ?

main olive
#

yes, it creates a non-capturing group

full oriole
#

If not I don't understand the logic of matching ( zero or more times at the beginning.

#

Ah, got it!

main olive
#

i'm sure this could be done with grep's common flavor of regex as well, but i'm personally more comfortable with the perl version

fickle granite
#

you're lost in a twisty maze of regex flavors, all different

wheat ridge
#

Hey! I use git bash for Windows and I'd like to make a bash script that I can use in my terminal that automatically cd's into a specific directory (predefined in the script) and then does ls -a. Would this be an alias, or can I make a specific script for it, and if so, how does that work when Windows is in the mix (even though I'm not using the windows command prompt?)? Even just some search keywords would be really helpful, as I'm not sure what the terms are for this concept

main olive
#

easily implemented as an alias

wheat ridge
#

That's what I was thinking too, although I would be open to making a script specifically for it just for the hell of it too, as I've never written a .sh script

#

How do aliases work in git bash for windows? Is there even a .bashrc? I barely remember how they work in unix, tbh... lol

main olive
#

cd in a script doesn't work when running the script in a regular manner (ie sh script.sh) because it creates a new shell when the script is run and the cd only applies there - you'll have to source the script instead (source script.sh or . script.sh)

wheat ridge
#

Oh interesting, I didn't know that!

main olive
#

obviously the latter means you can't have the script in your PATH and run it anywhere, since you need to call source with a path to the file

wheat ridge
#

Then an alias implementation would be far better for this particular thing

main olive
#

so an alias is probably the easiest method

wheat ridge
#

Okay, well that's enough information for me to do this then, thanks for the tip on sourcing, I didn't know that!

main olive
#

of course, you can utilise both: have a script in a predefined location (like ~/.local/bin/script.sh) and an alias which sources it: alias dothething='source ~/.local/bin/script.sh'

wheat ridge
#

Oo that's a good idea too

#

It probably fits just into an alias though, as it's suuuper simple. It's just cd'ing to the directory my dev project is currently in, then doing an ls -a and I might have it also start up my django server (I'm building a django local network website/server to be hosted on a raspberry pi)

main olive
#

yeah, sure, makes sense

#

@wheat ridge also, yeah, git bash should have a bashrc in the regular location, $HOME/.bashrc, should work fine on windows

wheat ridge
#

wtf this git bash doesn't have tree? Ahhgh no ๐Ÿ˜ฆ

#

Oh, looks like past me has already made some aliases and forgotten about them lol

main olive
#

there's a lot of aliases in .bashrc that come by default

wheat ridge
#

No, they're definitely mine lol

#

I'm in bash_profile actually, which is where git actually recognizes aliases between sessions (.bashrc doesn't seem to work properly)

wispy idol
#

hello, so I've been learning python for around 4 months now.

#

But I'm bored of just doing python so I started learning linux command line and sql.

#

Do you guys think it's a good idea to learn multiple things at once?

#

Or should I just focus on python for now?

fickle granite
#

that is entirely up to you

#

if it's more fun than learning one thing at a time, then do it

wispy idol
#

ok tnks

lofty jetty
#

I have used GNU/Linux since i was 13. And I prefer it over any other OS

#

especially arch linux

long pilot
#

how can i launch to linux live usb with radeon mode? it always gets stuck on logo for me.

radiant pike
#

So, this is a bit separate from python exclusively, but I'm trying to build something from source on Raspbian, and I'm running into a wall:

The thing I'm building depends on a patched version of x264. I've been able to compile the patched x264 version, but I've not been able to compile the overall library.
I've tried searching, moving files, recompiling, etc., but I still haven't been able to get ./config to find the patched version of x264 it depends on.
Can anyone help with this, and is this the right place to ask?

fickle granite
#

@radiant pike try ./config --help, sometimes there's useful hints

#

often you have to do something like ./config LD_FLAGS=-lyour-library LDPATH=/where/ever/you/installed/it CXXFLAGS=-I/where/ever/you/installed/etc

radiant pike
#

What's a good way to tell where I might've installed something?

#

When I ran make on the patched x264 lib, I don't know where the actual bins went

fickle granite
#

heh

#

couple ideas

#

run make -n install and see where it says it's doing

#

other idea: list every single file on the file system, sorted by timestamp; the installation files will probably be recent, and all together

radiant pike
#

I'm pretty sure it'll say x264.h not found

#

also I'm not good enough at bash to know how to list files by dir

#

or wait no it won't make, it'll ask for config first?

fickle granite
#

well, if you ran make and it installed some stuff, run from that directory

radiant pike
#

I'm assuming too much here, should try that

#

sorry

fickle granite
#

I think this will search your whole file system -- it could be slow

#

find / -printf '%T@ ' -ls | sort -n | cut -d\ -f 2-

#

requires GNU find but that's probably what you have

radiant pike
#

It's a fresh raspbian install, so the search shouldn't have to go far

#

it's erroring at cut:
cut: the delimiter must be a single character...

#

I'm not sure lemme retype

fickle granite
#

try cut -d' '

#

you need two spaces after that \ btw

radiant pike
#

with both the two spaces after and the ' ' it stops at no such file or directory with -printf and %T@

#

So I don't have somehting installed?

fickle granite
#

you're mistyping something

#

or else you don't have GNU find, but I think you should

#
$ find --version
find (GNU findutils) 4.7.0
radiant pike
#

got it, it was a space in /printf between the slash

#

it's going

fickle granite
#

that recipe is super handy; I use it all the time

radiant pike
#

It's going into the raspbian install files and listing things from 2018

fickle granite
#

did I mention you should pipe the output into less? ๐Ÿ™‚

#

also the interesting stuff is gonna be at the end

radiant pike
#

is it going old to new?

fickle granite
#

ya

#

you could flip that around by saying sort -rn instead of sort -n

#

probably ought to, now that I think about it

radiant pike
#

so I piped it into less

#

I think less is working but I can't ctrl+c out of it

#

I'm pretty new to bash, no idea how to get out of this

#

ah ctrl z works I guess

#

Still not able to see the first entries it hits

fickle granite
#

yep, I don't know why but sometimes C-z works when C-c doesn't

#

well try again, with sort -rn

#

it should be faster

radiant pike
#

There's a lot of "no such file or directory" before it gets to the recent files
yeah, 've been doing the -rn sort for a bit

fickle granite
#

huh

radiant pike
#

Other than playing ctrl z whackamole, and trying to capture the absolute most recent files, how should I get the output from this to a reasonably readable format

fickle granite
#

I could understand permission denied, but no such file or directory seems wrong

radiant pike
#

here's an example line:

fickle granite
#

try | head instead of | less -- that'll show the first 10, then stop

radiant pike
#

find: /proc/63/exe: No such file or directory

fickle granite
#

oh that's OK

#

those files come and go quickly

radiant pike
#

I'd only get those though were I to do |head

#

right?

fickle granite
#

uh no?

#

you can hide the errors with find / -printf '%T@ ' -ls | sort -rn | cut -d\ -f 2- 2> /dev/null | head

#

you could also try limiting to /usr instead of /, on the assumption that everything got installed under there

#

fewer weird files under /usr

radiant pike
#

by doing find /usr -printf '%T@ ' -ls | sort -rn | cut -d\ -f 2- 2> /dev/null | head?

fickle granite
#

ya

#

find is pretty complex but very useful

radiant pike
#

ok that's less than a second to run in /usr

fickle granite
#

but did it find your stuff?

radiant pike
#

it found some codecs and drivers I knew were installed earlier

fickle granite
#

well anyway; that's how you scour the whole filesystem

radiant pike
#

Better than manually cd cd cd cd

#

and guesswork

fickle granite
#

so here's a third idea: you might be able to go back into the directory where you ran "make install", and run ... make uninstall.

#

Not every package lets you do that, but this one might

radiant pike
#

I linked the package earlier, right?

fickle granite
#

dunno

#

my short-term memory lasts about two minutes

radiant pike
#

For the specific package though, the actual main code has @echo TODO as it's uninstall

fickle granite
#

heh

radiant pike
#

The codec might be different though

#

the x264

#

it's based on existing stuff but patched

#

ok so I ran sudo make uninstall in the dir for the souce for that patched standard x264

#

and it removed two files

#

so, reinstall and try to point ./configure to those files?

fickle granite
#

I guess

#

I'm actually having trouble picturing what you're doing

#

you're building two things from source, one of which depends on the other?

radiant pike
#

yes

fickle granite
#

yeah, try to do that

#

those files -- what were they? Two isn't very many

radiant pike
#

the commands it ran were:

#

ah I was mistaken

#

two lines, 5 files?

#

Time for a crude screenshot

fickle granite
#

you can't copy the text from your terminal?

radiant pike
#

the terminal's on a rpi and it's running a cli-only install rn

#

Tried getting a gui up but I'd get a login screen that when I put the right usrname and pass it'd just reboot

fickle granite
#

that's an odd location -- I'd expect /usr/include instead of /include and /usr/lib instead of /lib

#

or even /usr/local/

#

the other thing you're building is probably not looking in /include, 'cuz that's weird. So I guess pass something like CXXFLAGS=-I/include to it

#

maybe CPPFLAGS instead

#

see what ./config --help tells you

#

yeah I think CXX is for C++, which I doubt you're using

radiant pike
#

Would it be better to move this to a more sane location?

#

This is c++ source

fickle granite
#

dunno tbh

#

you have to make the two packages "agree"; you can do that by fiddling one of them, or fiddling the other (or even both)

#

which is best is up to you

radiant pike
#

I'm not sure what a sane location would be for this.
Here's what the install readme guides to do

#

I had to tweak this a bit to get it to work but it's here

git clone https://bitbucket.org/memahaxx/drc-x264/
cd drc-x264
./configure --prefix=$PATCHED_X264_PREFIX --enable-static
make install
#

and then to build the thing that depends on that:

#
cd libdrc
PKG_CONFIG_PATH=$PATCHED_X264_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH ./configure
make```
fickle granite
#

well $PATCHED_X264_PREFIX is a variable; what's its value?

radiant pike
#

I've run env and it's not there

fickle granite
#

maybe it's empty and that's why the stuff wound up in weird locations

#

do echo $PATCHED_X264_PREFIX

#

variables can live in the environment or just the shell; echo will look both places but env only looks in the environment

radiant pike
#

blank/newline returned

fickle granite
#

ok well that's why it got installed someplace weird.

#

the README probably assumed you wouldn't type $PATCHED_X264_PREFIX literally

#

I'd use /usr/local as the prefix; that's kinda conventional

#

My guess is that Mr Memahaxx is not super-professional in his documentation

radiant pike
#

The website looks pretty professional :P

fickle granite
#

and yet those two sets of commands you pasted are consistent, so it really shudda worked ...

radiant pike
#

but good css does not a good readme make

#

Here's where those commands appear if you want to look

#

I had a time getting git to clone from the bitbucket

#

Kept getting errors on the url other than not found

#

like, illegal url

#

I've started re-makeing the dependency lib

#

Looks like it's finding the dependency now, thanks

#

It's missing more dependencies, but at least it's a new problem

#

SDL and GLEW

fickle granite
#

huh

#

๐Ÿ’

radiant pike
#

do you know how to get SDL and GLEW?
"If you want to build the libdrc demos, SDL and GLEW are also required."

fickle granite
#

I don't even know what they are

radiant pike
#

so it's a problem of the docs

#

so from here it's a process of digging through the files to see what other dependencies are needed?

fickle granite
#

yep

#

welcome to Open Source

#

and then struggling to build and install them

radiant pike
#

them being those packages which have dependencies back to something that once ran on an 8bit micro or something

#

or are just really hard to find the dependencies for?

fickle granite
#

dunno

radiant pike
#

nono what did you mean by

and then struggling to build and install them

#

how far do dependency trees go

fickle granite
#

heh heh heh

#

mua ha ha

radiant pike
#

yep

#

I'm trying to build a new thing and

#

uhg

#

this is how open source works?

fickle granite
#

BAAAAHAHAHAHAH HaHAHAA HA HA HHHHA AH snort HA HHA HAHAHA HA HAH HAH HAH HAHAH HAH HAH oh man HAH AH HAAAAAHAAAHHH cough cough cough hah hehhh hehhhhh geez.. cough

#

sometimes it's not this bad

#

but I think you're dealing with amateur software made by amateurs

radiant pike
#

so it's build->need another dependency ->try to build -> need another dependency -> that has no docs

fickle granite
#

it's usually not too bad, but yeah, it could go a few levels

radiant pike
#

It's software with no release version

#

I found what GLEW is supposed to be

#

GL E Wrangler library

#

and I found it's github

#

it's saying now though:

#

this is something with make?

#

oh wait I might not need to build it

fickle granite
#

beats me

#

geez, it's hosted on sourceforge? In the 21st century? Good luck ๐Ÿ˜

radiant pike
#

:<

#

is sourceforge really that bad?

#

also the code's on github

fickle granite
#

sourceforge notoriously starting inserting ads in windows executables that they hosted.

#

basically, corrupting the files that people had trusted them to host

radiant pike
#

ah that's awful

#

major breach of trust

fickle granite
#

exactly

radiant pike
#

It says opt-in but I assume it was a sneaky, sort of underhanded auto opt-in thing, right?

fickle granite
#

honestly I don't know

radiant pike
#

like, you're opted in by default

fickle granite
#

to me, it just smelled bad

radiant pike
#

same here

fickle granite
#

I never used them for hosting so it didn't much matter. And github was getting big at the time

radiant pike
#

so, how do I resolve this issue in make:

#

ah, that's a google

fickle granite
#

you've fumbled something. That glew directory somehow doesn't contain the source code

#

dunno what's in it

radiant pike
#

The readme.mid has this gacha in it:

#

There's a folder within called auto which requires you run make on it first ._.

#

running make there it's doing

#

something

#

about 10 screens of cmdline output later I have a tarminal again

#

I think they have a program which makes source

#

they've automated some part of the source writing process?

fickle granite
#

wouldn't surprise me

radiant pike
#

if they're hosting on sourceforge then anything's fair game, huh?

#

still getting "demos cannot be built because one of the dependencies (glew) could not be found"

hollow skiff
#

Hey guys. I've created a bash file but when I try to open it with sudo ./adminMenu.sh it says ./adminMenu.sh command not found

#

Why isn't it running for me?

radiant pike
#

Are you in the right directory when doing that command?

hollow skiff
#

Yeah I can cat the file and see the script is in there too

#

Sorry I think it's a permissions problem

radiant pike
#

so cat <file> works, but if you immediately run <file> it doesn't?

hollow skiff
#

Yeah I chmod 744'd it and now I'm getting a different erro rlol

#

My mistake sorry

radiant pike
#

ok, good luck with that

hollow skiff
#

I think it was a permissions problem even with sudo

radiant pike
#

Permissions to read from a directory?

#

But wouldn't cat fail then too?

hollow skiff
#

I'm not sure. The file in terminal was white and normal font

#

Usually if you can execute it it's bold and a different colour right?

#

When i changed the mode it went to a different colour

radiant pike
#

I'm honestly not well-versed in permissions in bash

#

But the different color sounds like a difference and like you're making progress for sure

#

also a different error

hollow skiff
#

Yeah definitely progress

#

The format was just wrong in my script. A misplaced ;;

#

I'm trying to create a script that backs up files

#

But I want to copy only the files that have been edited since the previous backup

#

Any idea how I could go about that? ๐Ÿ™‚

radiant pike
#

I'd say follow the template of find / -printf '%T@ ' -ls | sort -n | cut -d\ -f 2- if I knew how it worked, but I don't

#

If you change n to rn then it shows files by date modified

#

and it shows them in recently modified first

#

so, that might be a building block you could use to find all files that were modified after some set date, and then copy them

#

so something like find / -printf '%T@ ' -ls | sort -rn | cut -d\ -f 2-

#

@hollow skiff This might work, but I'm not too sure how that command works. offby1 showed me that to find the most recently modified files

hollow skiff
#

I typed that verbatim lol

#

But the %T@ is the path right?

radiant pike
#

the path you want to start from is the /

hollow skiff
#

I'm still very new so the conventions I don't know yet

radiant pike
#

same

#

to start from /usr/local you'd do

#

find /usr/local/ -printf '%T@ ' -ls | sort -n | cut -d\ -f 2-

#

I don't know what '%T@ ' does

hollow skiff
#

Okay, it's saying cut: the delimiter must be a single character

radiant pike
#

there's two spaces at cut -d\ -f

#

between \ and -f

#

I did the same thing :P

hollow skiff
#

Ahh ok. Now it's saying find: paths must precede expression: 'ls

radiant pike
#

I've not seen that?

#

You didn't replace the %T@ at all did you?

hollow skiff
#

find /var/www/html/intsite -printf '%T@ ' ls | sort -rn | cut -d\ -f 2-

#

That's what I have so far

radiant pike
#

add a slash after intsite

hollow skiff
#

Same error. Hmmmm

radiant pike
#

is the var directory a home directory?

#

or should you use ./var etcetera

#

oh it is

#

should work

#

hm

#

oh you left out the - at -ls

hollow skiff
#

Wwooow

#

I mean woo

#

Thanks !

radiant pike
#

Is it working?

#

If you know how to use the output of that for a backup script then props to you

hollow skiff
#

I don't lol. That's my next task

radiant pike
#

best I'd be able to do is pipe it into a text file lol

#

well, good luck

#

while you're here:

hollow skiff
#

Cheers ๐Ÿ˜„

radiant pike
#

You wouldn't happen to know how to install Simple Diirect media layer, would you?

#

Need it for something I'm building

#

from source

hollow skiff
#

I've never heard of it before I'm afraid

#

Google returned this though:

#

sudo apt-get install libsdl2-2.0

radiant pike
#

I just ran that lol

#

It's working too

hollow skiff
#

Great ๐Ÿ˜‰

radiant pike
#

I literally googled it at the same time

hollow skiff
#

lol

radiant pike
#

google first needs to be a mantra of mine

hollow skiff
#

Mine too

radiant pike
#

and

#

it couldn't find sdl lol

#

ripp

hollow skiff
#

Jeez

radiant pike
#

AAAAAAAAAAA IT's WORKING

#

AAA

#

make ran

#

make ran

hollow skiff
#

What's make ran lulz

radiant pike
#

make is a program

#

make turns a makefile and some source into a executable bin

#

I've been trying to build a package someone else made from source for a few hours now

hollow skiff
#

Ahh I see

#

Sorry I can't be of much use to you. I'm too inexperienced

#

Good luck though ๐Ÿ™‚

radiant pike
#

This is my first time sitting down at a linux term and building packages from source, literally just installed raspbian on an rpi today ๐Ÿ‘€
You've got way more experience than me on user perms by the way

#

I have zero clue what those are outside of sudo

#

ok so uh

#

I don't know how to run this lol

hollow skiff
#

rpi's sound like fun

#

Anyway its 6:15am and I need to sleep

#

All the best! ๐Ÿ˜„

radiant pike
#

Alright, good luck to you in your archiving adventures

#

and thanks for the help

main olive
#

Hey

#

What is a linux that you would recommend me?

#

linux is just the kernel :) there is no "a linux", it's the linux

#

think you mean a linux distro, which is an operating system distribution using the linux kernel

steel verge
#

@main olive Whichever distro you like

main olive
#

in which case, it depends entirely on your skill level

#

there's so much choice that it's a matter of taste at this point

#

but newcomers usually use Ubuntu or Mint

#

arch?

#

What is it like?

#

it is for people who already know their way around linux and are very comfortable with the terminal

#

xx

#

arch is very bare-bones, which is perfect for people who want to build their distro up to be comfortable to them

#

yes?

#

I want to install a linux distro without usb

#

Can you please check the internet about UNETBootIN for me?

#

what

#

you have the internet

#

I know but I'm really bad at these kind of stuff

#

also unetbootin is not for network boot

steel verge
#

If you cannot use a USB stick, does your computer support PXE? Could boot from that, however, it is 100x harder to set up

main olive
#

pxe?

#

How do I check that?

steel verge
#

PreExecution Boot Environment

main olive
#

eh?

steel verge
#

It allows to boot an image over the entwork

#

You neeed a dhcp server and a tftp server for that

main olive
#

What if I try unetbootin?

#

AIO boot has all of that integrated

#

again, unetbootin is for USBs

#

Some guy on youtube is telling me to install unetbootin

steel verge
#

Let's rewind for a second

#

do you want to install Linux with a USB yes or no?

main olive
#

youtube is not a reliable source of information

#

@steel verge no

steel verge
#

Okay, then how do you intend to install it?

#

You need an installation medium

main olive
#

@main olive True.. Especially if you come across some cringy indian dude

#

@steel verge Anything that doesn't require a usb?

#

unetbootin is also pretty dated at this point and i woudn't use it even to burn usbs

steel verge
#

As I said, either network, which requires an extra computer, or a DVD

main olive
#

the link I posted has the information you need @main olive

#

Oh thanks xx

steel verge
#

Actually, that makes me think of a fun project

#

using termux on Android to run a "pxe server"

main olive
#

@main olive Does the link direct me on how to install a linux distro with a usb?

#

dude

#

using termux on Android to run a "pxe server"
@steel verge I fell off my chair, please stop throwing those big stuff on me

#

lmfao

#

the link literally says it's for "network boot"

#

What is a network boot..?

#

you will not learn these things unless you research them yourself

#

google "network boot" and read up on it

#

@steel verge similar project, have you heard of DriveDroid? Emulates an USB drive and lets you boot ISOs stored on the phone

steel verge
#

During a network boot, the computer fetches an IP from a DHCP server. The DHCP server will also deliver option 66 and 67, which are the filename to download and the server to contact for that file. The file is a bootloader, which is then booted by the OS and handles the rest of the downloads required.

main olive
#
Search Results
Featured snippet from the web
Network booting, or booting from LAN as it is also called, is a process which allows a computer to start up and load an operating system or other program directly from the network without any locally attached storage device, like a floppy, CDROM, USB stick or hard drive.
#

So it loads?

#

It doesn't install?

steel verge
#

The whole thing is called PXE and supported by most MOtherboards these days

main olive
#

it loads a live environment just as it would when you use an USB

#

you can install to the hard drive using that live environment

#

wait WHAT

#

I can install?!

#

... yes.

#

wow.

#

Pretty self-explanatory

#

๐Ÿ˜

modern kestrel
#

can anyone help me with some basioc bash

hollow skiff
#

Don't ask to ask

#

Just put out the question

modern kestrel
#

okay so i have a script that im running but it only works when i do

. ./upload-helm-chart.sh && setVariablesExecuteAll atlas eng

it works

#

but ./upload-helm-chart.sh && setVariablesExecuteAll atlas eng

#

it doesn't

#

so i'm confused why

warped nimbus
#

What's the difference?

#

I don't see it

modern kestrel
#

the . at the start

#

is it because my terminal is zsh?

#

im using iterm2

#

but ./upload-helm-chart.sh setVariablesExecuteAll atlas eng

#

sorry that doesnt work

#

the source/. and the && is missing

#

but usually if i want to run a function from a script ./testScript.sh testFunction arg1 arg2

#

works fine

#

know what i mean?

warped nimbus
#

What about it doesn't work?

#

Oh you're trying to run a function within the script?

modern kestrel
#

yep

#

function setVariablesExecuteAll {
path = $1
url = $2
}

#

trying to run this

#

. ./upload-helm-chart.sh && setVariablesExecuteAll atlas eng this works

#

./upload-helm-chart.sh setVariablesExecuteAll atlas eng

#

this doesnt

#

why? no idea

warped nimbus
#

Cause I don't think it's supposed to work

#

I don't know where you got the idea that it should

#

If you want to use a function defined in a script you need to source it

modern kestrel
#

because ive used scripts before where i can call a function like that and a lot of answers online say it should work

#

okay can you explain that please

#

i dont get the distinction

warped nimbus
#

./script.sh arg1 arg2 executes a script with those args

#

source ./script.sh will instead like put the current script's commands in the current shell, if that makes sense. Not sure how to explain it well.

#

The source would make the commands defined inside the script accessible locally too i.e. outside the script and in the current shell

#

In this case ./upload-helm-chart.sh setVariablesExecuteAll atlas eng, as far as I know, the shell just interprets setVariablesExecuteAll as $1. So unless you have some code to call a function based on the value of $1, it won't do anything

#

This is how I understand it

#

Maybe zsh is different?

#

Can you link some of the answers that say it should work like that?

modern kestrel
#

oooooooh

#

yeah i will

#

okay as soon as you said it registers it as a first argument

#

it seems so dumb that people are saying that

#

so the first few answers there

#

you have to go down to find the solution which works

#

but thank you for that explanation

warped nimbus
#

Yeah most answers say to source it

#

One answer uses "$@"

#

Which would do what you want

#

So yeah if you just add that to the end of your script it will work like you originally wanted

modern kestrel
#

rightttt

#

yeah okay got you thanks Mark!

warped nimbus
#

You're welcome

main olive
#

source ./script.sh will instead like put the current script's commands in the current shell, if that makes sense. Not sure how to explain it well.
@warped nimbus it can be viewed like an import for shells

warped nimbus
#

Yes! good analogy

main olive
#

much more primitive, but the core concept is the same

modern kestrel
#

yeah it makes sense to me now xx

#

does that mean source makes it run it first then? so it will run twice effectively

main olive
#

source does execute stuff in there, but if you've defined a function, only the "defining" itself will be executed, not the body of the function itself

#

if that makes sense

modern kestrel
#

okay it makes sense

#

ill take it for what it is and not pry further at risk of confusing myself lol

tidal lark
#

Is it possible to run a Selenium chrome driver on Ubuntu just with putty? Because it can't open any page visually or else

main olive
#

that's pretty much the point of selenium, that it doesn't require a graphical interface

tidal lark
#

Okay well, because when I deployed it on my windows machine it didn't give me any errors but now on my server it does. However, good to know that it is possible. Thanks

main olive
#

what errors exactly?

#

might be able to help or point in the right direction

#

also my apologies, i've been misleading

tidal lark
#

wdym

main olive
#

selenium itself doesn't require a graphical interface, but whatever browser you're using for the backend might. for this, you have to be sure that selenium tries to use chrome headless

tidal lark
#

Oh okay

main olive
tidal lark
#

Thank you

main olive
#

๐Ÿ‘

shy yokeBOT
#

Sorry, but you may only use this command within #bot-commands.

blazing fox
#

im sry

#

@main olive i thought it was bot commands

main olive
#

np honest mistake

modern kestrel
#

. ./upload-helm-chart.sh atlas-logs-exporter && executeLint
โ€” Shell Script
1s

  • . ./upload-helm-chart.sh atlas-logs-exporter

  • path=

  • url=

  • function createHelmTemplate {

/home/jenkins/agent/workspace/infra-k8s-charts_PR-114@tmp/durable-ec88a11d/script.sh: 11: ./upload-helm-chart.sh: function: not found

script returned exit code 127

#

my build in jenkins is failing because of this idk whats up with it

main olive
#

!codeblock

shy yokeBOT
#

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:

```python
print('Hello world!')
```

Note:
โ€ข These are backticks, not quotes. Backticks can usually be found on the tilde key.
โ€ข You can also use py as the language instead of python
โ€ข The language must be on the first line next to the backticks with no space between them

This will result in the following:

print('Hello world!')
main olive
#

can you link us to the jenkins job?

modern kestrel
#

hmmm its in a vpn

#

you mean the jenkinsfile code?

main olive
#

sure

#

what script it's trying to run exactly

modern kestrel
#

def THE_ENVIRONMENT = "eng"
def PATH_FILE = "atlas-logs-exporter"

pipeline {
    agent any
    stages {
        stage('Upload chart') {
            steps {
                script {
                    if (env.BRANCH_NAME == 'master'){
                        if (THE_ENVIRONMENT == 'eng') {
                            sh ". ./upload-helm-chart.sh ${PATH_FILE} ${ENG} && executeAll" 
                        } else if (THE_ENVIRONMENT == 'ops') {
                            sh ". ./upload-helm-chart.sh ${PATH_FILE} ${OPS} && executeAll"
                        }
                    }
                    else {
                        sh ". ./upload-helm-chart.sh ${PATH_FILE} && executeLint"
                    }
                }
            }
        }
    }

#

this one

#

oh the script is something else

#

its running the helm chart script

main olive
#

are you defining functions in the script with function?

modern kestrel
#

yup like this

#

path=$1
url=$2

function createHelmTemplate {
  if [ ! -z "$path" ]; then
    out=$(helm template --namespace test --values=values.yaml --set id=test -x $path . )
  else
    out=$(helm template --namespace test --values=values.yaml --set id=test . )
  fi
  echo "${out}"
  helm lint --namespace test --values=values.yaml --set id=test . && \
  echo "${out}" | kubectl apply --validate=true --dry-run=true -f -
}

#


function executeAll {
  cd "$path"
  createHelmTemplate
  packageHelmTemplate
  loginToVault
}

function executeLint {
  cd "$path"
  createHelmTemplate
}

main olive
#

sh doesn't support that syntax

modern kestrel
#

this is the execution

main olive
#

use createHelmTemplate() { stuff } instead

modern kestrel
#

for all of them?

#

add the ()

main olive
#

add the (), and remove the function

#

and yeah, all of them

#
#!/bin/sh

function()
{
  echo "args: $@"
}

something lik ethis

modern kestrel
#

yep gotcha ill let you know what happens

#

. ./upload-helm-chart.sh atlas-logs-exporter && executeLint
โ€” Shell Script
<1s
+ . ./upload-helm-chart.sh atlas-logs-exporter

+ path=

+ url=

+ executeLint

+ cd 

+ createHelmTemplate

+ [ ! -z  ]

+ helm template --namespace test --values=values.yaml --set id=test .

Error: open values.yaml: no such file or directory

+ out=

script returned exit code 1

#

Now that comes up

main olive
#

well, it can't find values.yaml for whatever reason

#

can you add a pwd right before that last command and see where it's trying to run from?

#

and whether it's the same directory where values.yaml actually is

modern kestrel
#

okay

main olive
#

also i just realised

#

it does cd with no argument

#

looks like $path is blank

#

cd with no argument changes directory to the user's home dir

#

which on jenkins is some arbitrary location and probably not where you actually want to go

#

this is probably why it can't find values.yaml

modern kestrel
#

okay yeah spoke w colleague

#

why might that be?

#

sh ". ./upload-helm-chart.sh ${PATH_FILE} ${ENG} && executeAll"

#

this is what jenkins runs

#

and we specify path as $1

#

url also isnt set

#
+ path=
+ url=
+ executeLint
+ cd 
+ createHelmTemplate
+ [ ! -z  ]
+ helm template --namespace test --values=values.yaml --set id=test .
Error: open values.yaml: no such file or directory
+ out=
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[Bitbucket] Notifying pull request build result
[Bitbucket] Build result notified
ERROR: script returned exit code 1
Finished: FAILURE```
#

grrrr

main olive
#

i'm not sure the jenkinsfile does variable substitution like that

modern kestrel
#

setVariables() {
path=$1
url=$2
}

#

hoping this fixed it...

#

okay didnt do shit

main olive
#

oh, no, jenkinsfile does do that

#

strange

#

dunno, i'm stumped

#

haven't really worked with jenkins too much

modern kestrel
#

okay ive narrowed down the issue

#

                    // Change environment and path file below
                    def THE_ENVIRONMENT = "eng"
                    def PATH_FILE = "atlas-logs-exporter"
                    if (env.BRANCH_NAME == 'master'){
                        if (THE_ENVIRONMENT == 'eng') {
                            sh ". ./upload-helm-chart.sh ${PATH_FILE} ${ENG} && executeAll" 
                        } else if (THE_ENVIRONMENT == 'ops') {
                            sh ". ./upload-helm-chart.sh ${PATH_FILE} ${OPS} && executeAll"
                        }
                    }
#

the issue is the defined variables arent being passed through

#

no idea why

main olive
#

@modern kestrel did you ever figure it out?

#

a workaround i was going to suggest was using environment instead of defining them with def

modern kestrel
#

i have a senior engineer looking at it and he's stumped too haha hes diagnosing it but bash isnt his forte

#

i was going to try that

main olive
#

tbh i don't think this is a bash-specific issue

#

it seems (to me at least) to be related to jenkins

modern kestrel
#

apparently path is a keyword

#

or something

#

idk still looking lol

#

think is his speciality is jenkins and he said the jenkins file looks fine

#

thing*

main olive
#

what distinguishes Unix from other file systems?

#

@main olive Unix is not a file system

#

what other systems do you have in mind?

#

idk i just wanna know what unix even is

#

it's an operating system. Nowadays, it's more used as a philosophy that other operating systems (like Linux and MacOS) follow

#

which is why BSD, MacOS, Linux, etc have a lot of similarities

#

o ok

#

I'm rubbish at this sort of thing so that's helpful

#

yea

#

nowadays, when people say Unix, they don't actually mean "the Unix operating system", they probably mean something like Linux or similar

modern kestrel
#

@main olive is was because the first argument was called path

#

in the script

#

changed that and it fixed

main olive
#

coolio, good to know

#

and very obvious now that i think about it

#

$PATH has a special meaning

modern kestrel
#

What's the difference between source and .

#

I'm not quite getting it

#

Some people say theres no diffrence but there definitely appears to be

main olive
#

what differencese are you experiencing?

modern kestrel
#

build passes with .

#

not with source

magic basin
#

can you compile python code with the make command

livid verge
#

yes... all make command does is run a bunch of commands from the Makefile

#

so all you have to do is write your Makefile with the commands you want to run

#

usually we use wheel and setup.py instead, though

magic basin
#

Hi

#

How can i print a textfile in the console, but with timestamps of when each line of the file was written

main olive
#

that information isn't stored on a per-line basis

#

you have the creation date and the last-modified date

#

you need to make it so whatever creates that textfile also prepends timestamps

magic basin
#

here is my command
date +%A%_d" "%B", "%Y" @ " && echo $(date +"%r" | sed -e 's/\([0-9][0-9]:[0-9][0-9]\):[0-9][0-9]/\1/')

#

how can i get both the outputs onto the same line

#

that's my issue

rich oriole
#

@magic basin a=date +%A%_d" "%B", "%Y" @ " && echo -n $a && echo $(date +"%r" | sed -e 's/([0-9][0-9]:[0
-9][0-9]):[0-9][0-9]/\1/')

magic basin
#

@rich oriole ?

rich oriole
#

I solved your issue, code above

magic basin
#

yeah i tried, it didn't work?

rich oriole
#

see, it works

magic basin
#

that's not the same as what you sent

rich oriole
#

sry I see that accent characters where parsed by discord

#

how to escape them here?

magic basin
#

pastebin?

rich oriole
#

How you can answer in that way if I ask how to do it here..

magic basin
#

i don't think you can send it here

rich oriole
#

test`test

magic basin
#

because discord is weird

rich oriole
#

ok I need to use two backticks