#tools-and-devops
1 messages · Page 42 of 1
In that case, some can be separate containers like I just mentioned, and others will probably need a custom image that you write.
ok
Like you'd just pick an OS base image and install everything else onto it yourself
I see
in my case, I have a python app that uses mongodb, so if I want to use a python base image, how do I get mongodb on there?
can I use both base images?
No, only one base image
A database doesn't need to be in the same container as your app really
Just run mongo as a separate container
And communicate with it over the local network
Docker Compose is helpful for managing multiple containers
ohhhhhh
that's why all of the base images are different
cuz yo have 1 container for python app
uses python base image
1 container for db, uses db base image
ohhhhh
it's distributed a bit
so how do you like
wrap all of the different containers in 1 app
besides creating a new docker id
You don't and you shouldn't generally
You can use Docker Compose to help manage that
It can make it easy to start all the containers together
but they're still separate containers
but like what if you have this app that has a db container, and you have another app that also has a db container, how do you tell them apart
I don't want to name the containers like app1-db and app2-db
By naming them differently, that's how
ok
so with my gitignore
I got it from github's gitignore templates
does python have a dockerignore template as well
I don't know, maybe
You could just use the same template you used for gitignore perhaps
The way I like to do it is ignore everything and then manually make exceptions for the files needed.
I read about that here and I liked the approach https://youknowfordevs.com/2018/12/07/getting-control-of-your-dockerignore-files.html
Every now and then I’ll notice a file inside a Docker container that really shouldn’t be there. Thankfully it’s never been a .env file or an SSH key, but even so, any unused file or directory takes up space in the image and makes that image slower to build and pass around. Bes...
what should be ignored
should the .git folder be ignored?
how do you use docker and github?
Yes, the .git folder should be ignored.
Like I said, I ignore everything with * then add exceptions for what I want to keep.
what should I keep?
Like, the code needed to run your program
Things like that
If it's not needed to run the app, then you don't really need it in the image.
Maybe include the license if you want
ok, so in my case, that's the run.py and the package
wait if I exclude my package
how about the pycache inside the package?
No, that's not needed
so what are the differences in use between the github repository the docker repository
Docker repositories are for publishing Docker images
I think GitHub recently added support for Docker repos too actually
But it's separate from the code repo of course
Because Docker Hub is for Docker images, not for source code
so what happens when you docker push then?
It pushes the image to a Docker repo
but doesn't the image contain the source code?
so *.pyc should ignore pycache files right?
The image does contain the source code yes
Yes pyc files can be ignored. I suggest you ignore stuff and just try to run the program to see if it works if you have doubts.
I mean will *.pyc ignore pycache files
Oh I don't know
oh
In any case it would only ignore files in the root
You need **/*.pyc to ignore all of them
Beyond Go’s filepath.Match rules, Docker also supports a special wildcard string
**that matches any number of directories (including zero). For example,**/*.gowill exclude all files that end with .go that are found in all directories, including the root of the build context.
I suggest you read this https://docs.docker.com/engine/reference/builder/#dockerignore-file
It gives the definition right after it names it
that matches any number of directories (including zero)
I guess I didn't understand what that really meant
so for docker cp, you can only copy files to containers, but I need the file there before I run the container
Ah yeah
You'll have to override the command used
So with docker run, you'd make it execute bash or something rather than letting it use the cmd you defined in the dockerfile
And once you copy the file over you could run the python command manually
can I copy the file in the dockerfile?
But then it would be saved in the image
like run docker cp as a command in the dockerfile
No
For one, it's a command that has to run from the host, not from within the container. And second, even if it worked, it'd cause the config file to be saved in the image, which you wanted to avoid.
Then stop using a config file and use env vars
At least for the sensitive information
how do I use those with docker?
-e option for docker run
oh docker run, I was doing docker container run
Never heard of that. Is it an alias?
My guess is it can load environment variables from a .env file
is there a way for that to work with yml
Theres a library that can load them called dotenv
I don't think you need that though
so then how do i use them in python then
You just need to then read them in your program with secret = os.environ["SUPER_SECRET_THING"]
Short for environment
oh lol
so with all of those dfferent options in docker run, is there a way to automatically add the options
You could create a shell script
like when you do docker run myapp it like, already knows to do --env-file and stuff
Or use docker-compose
If you're planning to add mongo anyway you'll want to use docker compose
Basically an easy way to run multiple containers
It uses a yaml file in which you specify all the options for the containers
Not super useful I guess but you may prefer using yaml over a shell script 🤷♂️
It may support some stuff that docker run doesn't but I don't think so. As far as I could tell it's pretty analogous to docker run
docker-compose up would start all containers defined in the yaml
so the compose file is just a yml version of docker run
I guess
It has some extra stuff to support multiple containers
Like specifying dependencies
E.g. website depends on database container running
right ok
that makes sense
so the docker-compose file goes in the root directory of a repo?
docker-compose by default looks in the current directory for the file, so generally it makes sense to put it in the root of the repo
However, it is possible to specify a different path to the file
It's just not convenient
ok yeah that makes sense
so what is required in a docker compose file
how is it made up
I know you have the version as the first key
but what else
Don't the docs have some examples?
You define "services" which are basically your containers
yeah the examples are quite confusing to me
Try following this https://docs.docker.com/compose/gettingstarted/
here's what I was able to gleen:
version: "3.7"
services:
image_name?:
env-file: ".env"
oh woah, I was totally looking in the wrong place huh
is there a reason why the working directory is usr/src/app
on the official python image
I dunno, maybe it's a convention
alright
ok so rn my docker run command looks like this: docker run --rm --detach --name offthedialbot --env-file .env offthedialbot:latest
so should my docker compose look like this?
version: "3.7"
services:
offthedialbot:
build: .
image: offthedialbot:latest
env-file: .env
You need to specify the name of the image
oh is that not the same as the name of the service?
No, don't think so
Service name can be whatever you want
You'd also want to specify build
I think the minimum would be either specifying an image or a way to build it
is it better to do build or image?
Do both
wait how does that work
oh wait I found it
like this?
wait @tawny temple so there's this: https://docs.docker.com/compose/env-file/
so does docker-compose automatically look for this?
or do you have to specify?
It does automatically look for it
so I don't even need to specify the env file thing in my docker compose yml?
Correct
alright that's sick
version: "3.7"
services:
offthedialbot:
build: .
image: offthedialbot:latest
so is this all I need?
Try it and see if it works
It builds if the image doesn't exist yet
Otherwise you can build it with docker-compose build
wait docker-compose up doesn't automatically build the image?
It does if they don't exist yet
oh hmm
so if I were to go onto a new machine
I would do git clone my repo
then create the .env
then docker-compose up
right?
Yes
so what's the purpose of docker hub in all of this?
To download prebuilt images
so that isn't nessecary for me
wait the name of the image is offthedialbot_offthedialbot_1
why is it that?
actually, if I don't need to ever push my image to docker hub
Specify container_name if you want to change it
then is it fine if I have config.yml in my image?
Yes
:O
Though it's good practice to not include credentials in it anyway
but I like my ymls lmao
yeah
@tawny temple is there a way to specify that I want to do docker-compose up --build but inside of docker-compose.yml
nah its fine
actually wait
so remember when you helped me set up that whole CI thing
I need to change that now right?
oh, well anyways, the workflow file look like this:
name: Continuous Integration
on:
push:
branches:
- master
jobs:
build:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
envs: GITHUB_SHA
script: cd ~/offthedialbot && source .venv/bin/activate && git fetch && git checkout $GITHUB_SHA && pip install -r requirements.txt && systemctl --user restart offthedialbot
so I'll probably need to change the script part right?
You want it to use the image instead of git?
well the image won't be on docker hub
so I would git clone it
then build and run the image
I don't really see the point of using Docker if you're going to do that
well I don't need to install python, since it's in the image
I also don't need to worry about venvs
I suppose
and requirements.txt is also taken care of
oh and the systemctl script gets super simple
Though since you're not building image in Ci you can't take advantage of the CI being able to notify you if a build fails and cancel the deployment
wait no I am tho
I git clone, build image, run image
actually way
if I run the image detached
will it stop if I log out
No I don't believe it would
It may still be useful for automatically starting the container
or restarting it if it fails
But that's not something I'm experienced with
I don't know. You'll have to research it yourself or get help from someone else.
ok
@tawny temple So I fixed up the CI, and it actually deploys, so I need to install the database now.
But just copying the mongodb install directions don't work
it says systemctl not found
Why don't you use a docker image for it
ohh
it still doesn't work
I added it as a service in my docker-compose but it still has an error
pymongo.errors.ServerSelectionTimeoutError: mongodb:27017: [Errno -2] Name or service not known
this is my docker-compose-yml:
version: "3.7"
services:
offthedialbot:
build: .
image: offthedialbot:latest
mongo:
image: mongo
Does that mean your connection is failing?
idk
Which host are you connecting to?
Yes
well that's what it is
I don't know what the default port for it is but the host should be mongo since that is what you named your service
ohhhh
also that's the default port yeah
so when I do docker images I get a bunch of images that look like this:
<none> <none> 0793232e344a 44 minutes ago 1.04GB
<none> <none> 4f905f46b7b2 2 hours ago 1.36GB
<none> <none> 36623f60d28a 2 hours ago 1.04GB
how do I remove these?
docker rmi <id>
you can script it
something like docker images | awk '{print $3}' | xargs docker rmi
untested, warning
I know with other things theres like a prune command or smth
oh sick
I did it!!
I created a fresh VM and did the commands
all I had to do was clone the repo, create the config, and do docker-compose up --build
and boom, everything
woaahhhh
docker is cool
You can squash them with the previous commit and pretend that nothing happened
@warm pollen Nice. Thanks.
What's best Pycharm keymap that works both on Linux Mint and Windows 10?
I used VS keymap (since i was a bit familiar with it), but it had plenty of conflicts with system hotkeys
default keymap
Intellij IDEA Classic?
I used VS keymap, but it had some conflicts on Linux Mint, so I'm looking for a replacement.
default keymap
atom keymap is awesome, i use it all the time
I am using pycharm...whenever I try to add all the files in my directory, I get a popup that says "Confirm Force Add Directory"...The following directory may contain ignored files. Do you want to force add it? " I just always hit cancel, but is this expected? Is it just making sure that the files in my .gitignore that I really want to ignore them?
sooo i have to take all my separate scripts
and put them all on git
and potentially merge a few repos
im curious what the best practices are
do you usually keep separate branches for similar scripts that may potentially work together
or what's the best practices for using branches? Am I just to be as creative as I want.
one project typically uses branches for development on different features
that is very common
I have to reinstall my computer and so I'm going to back up all my scripts first
I messed up my PATH file
that's what PRs are
PR?
a pull request - a request to merge a branch into another one
ah
.issue 813 bot
here's an example of a currently open PR
Don't mind the text
The pr is linked to a branch that's x commits in front of the tracked branch (commonly master)
It's kept separate while in development, then after it's finished (and reviewed) it's merged with the tracked branch; moving the commits there in some form
oh so you guys are like debating wether or not to merge
it allows people to review the changes, you to keep track of them etc.
I see
im reading this thing on how to merge
it just seems like the next logical step though doesn't it?
having difficulties pushing something to aremote repo
CAn you elaborate on the difficulties?
tried to do git push origin master
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
It means your local branch is out of sync with the remote
The remote has changes which you lack locally, and you also have some local changes which the remote doesn't have.
Did you try pulling?
Yes
You may need to set up the branch to track a remote if you haven't done so yet
Git will let you know if you need to do that
Now try to push
nope
Same issue?
yep
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
so i guess git pull again?
What happened when you pulled earlier?
it's actually a bit different
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Can you see which commits you're missing if you compare the remote log to the local one?
uhh
well I'm not sure what I'm supposed to look for
like my remote one just has an initial commit with a readme
And locally?
my local one just said ```initial commit, completed xyz_script
Did you amend a commit or something?
No it absolutely matters
You need to make changes on top of the history of the remote, otherwise you break the history.
yikes
You could do a force push, but that is generally not something you should be doing, especially on the master branch and if you're collaborating with others.
so
You could either reset your local branch to be even with the remote and just re-create the commit. If you would like to save your changes before resetting you could do that to by stashing it first.
I'm trying to figure out where I went wrong.
Well how did you create the commit?
I started locally then tried to do a remote push
i don't use git often
basically i just did git ini
init
touch gitignore
then added my files etc to the .txt
then git add .
then git commit
wrote my title
and so on
Did the remote already exist before you did git init?
No I mean
Did you already have a repo with a commit on GitHub before you started working on it locally?
I mean the specific one you are working on
then no
OK so go on about creating the remote
maybe the way I created the remote repo and tried to link it
I'm not certain all the steps I took to be honest
I'll try to be specific
When you create the repo on GitHub it may do an initial commit by adding a readme or a license
You could disable that by unticking two boxes
But if you left them ticked, then that's probably where the remote commit came from
that's what I said earlier though, yes that's what happened
i said it's probably cuz I have a readme
OK, sorry. You mean this?
like my remote one just has an initial commit with a readme
It wasn't clear whether you made that commit.
I assumed you made it
i did
Did you push it?
when i created the online repo
yes
like once i created the repo and copied the url
then i did
git remote add origin <urlgoeshere>
So GitHub did not automatically create a commit for you when you create the repo on their website?
Yeah it's what I have pictured above
they might make an initial commit with a README, but that'd be optional if so
it's just an initial commit
If that's what happened, then I can make sense of the situation and how local and remote are out of sync
So you pushed one commit yourself and now are trying to push a new commit? If yes, how did you create the second commit?
i didn't push anything to the remote repo
that's why im getting this out of sync issue
But you said you did earlier when I asked you
So, the situation is: there is a total of one commit each on the remote (GitHub), and one commit locally. They are two different commits. You never successfully pushed from local to remote. Therefore, the remote commit was very likely created when the repo was created. I've been trying to confirm but you've been saying that you created it rather than GitHub.
So, I am confused.
therefore, the remote commit was very likely created when the repo was created.
i manually went into github created a repository
when you do so, you are given the optino to add a readme
that's when the remote repo created the inital commit on github
Ok, got it. That's what I was trying to confirm earlier.
The reason things went wrong is that you never pulled from the remote before you started working locally. If you cloned the repo rather than using git init, you would have had that commit locally and avoided problems. This is cause git clone pulls changes from the remote but git init creates an empty repo locally.
i started working locally and then tried to push to remote
If you used git init you'd have to do git remote add origin ... and then git pull and only then could you start your work
i store things locally then when im ready i push to the remote repo usually, i rarely push to remote though
trying to do that more
My point is that you needed to add the remote and pull as soon as you did git init.
i mean i didn't change the code
If the remote repo was empty, then you could have done it whenever you want.
But you did, you created a commit.
but because there's a readme?
The one you're trying to push now
i mean i didn't change the code
But you did, you created a commit.
im confused here
Huh?
what do you mean
What are you even trying to push if you never made any changes?
Then you did change code
You made changes to the repo
you're trying to add something that did not exist before
that is a change
i didn't change code though, you keep saying this. my code is finished.
i added an online repo
But the remote doesn't have code
It's only local
As far as the remote is concerned, it's getting something new. Hence changes.
yes but when you're explaining this
Let's put it this way, you made changes to the repository, not to the code.
you're not being specific
thank you
that's specific
alright so im still stuck though
Just do a force push unless you really care about saving that readme on the remote
idc about that tbh
What do you mean? As in, you're not sure if you want to keep the readme. Or that you don't know how to force push?
force push, im googling it now
git push -f
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
looks like i gotta set the upstream?
i don't want to screw this up, as you can see debugging git pushes is a bit difficult for me
Branch 'master' set up to track remote branch 'master' from 'origin'.```
what did you jsut do here
Set the upstream for the branch
that worked btw, but im curious for my own knowledge
So when you pull and push it will automatically use origin/master if you leave it unpsecified
i see
so what should i have done, what caused this error. Simply by opting to add a readme file when i created the online repo?
ive never had to clone a remote repo just to push
either way the point is to have a blank remote repo
the concept of having to pull from the remote before I started working normally seems backwards to me
you have to make code first, then share it. That's how I kind of look at it.
so I don't understand why by default people would pull from something that's already remote/shared
even if it's blank
i mean i guess to work on something already in progress >.<
That's how the git history works, it's built on top of older history.
If you try to push with a different history, git won't be able to reconcile it
Like, in your situaiton, git was thinking "the remote says xyz is the first commit, but this person trying to push is saying abc is the first commit"
It would not think "I have xyz and this person is pushing abc, so I'll add abc after xyz"
do you need to do git fetch before you git checkout
because I know git pull automatically fetches
does git checkout automatically fetch as well
is there a way to specify that you want git checkout to fetch?
It does not automatically fetch
And as far as I know there's no way to specify to fetch
You could create a git alias for it though
I see thank you Mark
on a separate note: im curious though, i suppose I need to use a branch in my situation. I want to group several scripts together that work with a specific software, but my scripts might not necesarily integrate into one piece of software.
if that makes sense
basically my scripts won't expand on the functionality of each other
they're just different solutions for different problems, stemming from the same software that I'm trying to build around
I don't think having separate repos make sense
like is it common practice to have several .py files on separate branches?
they don't necesarily have anything to do with the "master" branch
You can do it however you want if it's just for personal use
But as far as best practice is concerned, to me having orphaned branches seems like an abuse of the branch feature.
hmm
I'm concerned that when people will lok at the repo I'll give off the impression that I don't know what the best practices are
and like for example
if I was building a scraper for several websites, with the intent of gathering specific data based around a category of things
IMO branches should be used for development, not just for storage.
that seems to be the common practice
In your case I'd just create subdirectories for the different groups of scripts
subdirectories?
Folders
Not necessarily your IDE, I mean the file structure of the project
Like in the root directory of the repository there could be several folders each containing different groups of scripts
But really if they're so unrelated then they should be in separate repositories
idk how to make subfolders in the root of the repo
let me google
well these scripts are really to provide extra functionality to an old antiquated COBOL emulator
Which OS are you using?
mac
unix
i saw this post, but it's for the web browser
So if your repo is cloned to ~/my-repo then :
cd ~/my-repo
mkdir some_dir_name
mkdir another_dir
and so on
i mean i already pushed my script to a remote repo
can't now insert a folder at the root
it says online the git repo should be stored under .git folder in my project
i see no such folder
cd ~/my-repo
mkdir some_dir_name
mv my_script.py some_dir_name/
git add .
git commit -m "Moved script inside a directory"
git push
I don't know what you're reading but no, you don't need to mess with the .git folder.
im assuming by ~/my-repo you mean the directory in which my project is stored
locally
Yes
alright thanks, i have to give it some thought
what the best structure would be for this
Does somebody know how i can fix this?
is there a quick way to streamline pushing multiple projects to git
Git is command line, so you can just write a batch file which pushes each.
I actually meant github tbh, but I'd need to push all to fit first I guess
That's a great idea
do you think it will cause an issue if some of them may already be pushed to github'
I have to reinstall my computer and I want to push everything to github
If there are no changes to push then it will just do nothing
i was thinking about pushing different scripts to different repos using a batch file
or something like that
im still trying to figure out how i would go about deciding how to group my scripts together
was looking at this
I have noticed some python code I am looking at, when calling class methods they do
App().run()
instead of
a.run() ```
On the first option, How does that work?
It skips the "middleman" variable and directly uses the return value, which is an instance of a class, to call the run function
Oh this should have been asked in a help channel rather than here in tools
in readthedocs, how can I additionally install a package via pip? I'd prefer to not have to vendor/submodule the package
I'm just looking for a quick pip install [package]
I don't know where to put this in the config yaml file though
Try this ```yaml
python:
version: 3.7
install:
- method: pip
path: pkg_name
that didn't work, it tried installing the package as if it was local (Hint: It looks like a path. File './package' does not exist.)
I was worried it might
That's a shame
It supports a requirements file
Multiple of them
I know it may not be particularly convenient to have to create a file, but that should work.
:// yeah I'm using that for now but I'd rather not because I'm using poetry
it's still not working as expected, since it's not installing my package itself
You probably need to do what I showed above to install your own package
Except use . as the path (assuming it's in the current directory)
You're welcome
I imagine poetry supports extra packages so maybe you can use that to install that other dependency and git rid of the requirements file
@neat falcon
yeah I currently have the other dependency in the dev dependencies section. I don't want to mess with RTD anymore for now, but I'll keep your suggestion in mind
To those who have or clone a lot of repositories on github on to your computer, how do you guys organize those repos, do you keep them all in the same folder? or do you have many folders that organize those repos in some way?
I keep them all in the same folder, I have ~40 repos or so
Anyone here familiar with enjarify?
I have a folder with subdirectories for different languages
If there's a group of related repos I may consider making another subdirectory
so what I do docker logs even when there's an error sometimes it doesn't show up in the log until more text is printed to the log
buffered output?
also can I specify -f inside of a docker-compose
oh and also I found the way to make it restart on crash restart: always
🦀 I never need to touch systemctl again 🦀
Buffered means it waits until a buffer of a certain size is filled up before flushing the buffer (i.e. outputs the contents of the buffer and empties the buffer)
I doubt -f can be set inside the compose file
That'd be weird
I don't want to pass in so many arguments every time I do docker-compose up tho
like rn I have to pass --build -d and now -f
It's in the docs
The docker logs --follow command will continue streaming the new output from the container’s STDOUT and STDERR.
have you pushed things to git/github using a bash script?
I'm trying to read up more on it
Sometimes pip takes a few minutes to resolve connections to pypi. It just gets stuck on Starting new HTTPS connection (1): pypi.org:443
If I restart the OS, it is all fixed.
I still have internet, and it does manage to install things eventually
But waiting like 3 minutes for it to even start doing anything is not acceptable
Not sure if this is an issue with pip or with my arch vm
you may want to try dig and openssl ing on pypi.org:443
dig was fine so I suppose that means DNS may not be an issue
openssl hangs though
Assuming I used it right ```
openssl s_client --connect pypi.org:443
I came across something about disabling ipv6 so I did that and I'll see if the issue still crops up again in the future
well i don't know what's going
my projects virtual env is all off
and now for some reason there's no git
fatal: not a git repository (or any of the parent directories): .git
even though my script was already pushed to github
i don't even know how this happened, and what to do, where to start
never mind
venv is still off, but i just wasnt in the right directory
what is wrong ?
@heavy knot something seems wrong with your spaces? Are you using some weird keyboard or copy paste from some web page?
!dark
Mutable Default Arguments
Default arguments in python are evaluated once when the function is
defined, not each time the function is called. This means that if
you have a mutable default argument and mutate it, you will have
mutated that object for all future calls to the function as well.
For example, the following append_one function appends 1 to a list
and returns it. foo is set to an empty list by default.
>>> def append_one(foo=[]):
... foo.append(1)
... return foo
...
See what happens when we call it a few times:
>>> append_one()
[1]
>>> append_one()
[1, 1]
>>> append_one()
[1, 1, 1]
Each call appends an additional 1 to our list foo. It does not
receive a new empty list on each call, it is the same list everytime.
To avoid this problem, you have to create a new object every time the
function is called:
>>> def append_one(foo=None):
... if foo is None:
... foo = []
... foo.append(1)
... return foo
...
>>> append_one()
[1]
>>> append_one()
[1]
Note:
• This behavior can be used intentionally to maintain state between
calls of a function (eg. when writing a caching function).
• This behavior is not unique to mutable objects, all default
arguments are evaulated only once when the function is defined.
any dark mode for idle
idle takes your terminal color scheme
Any Visual Studio Code users here?
✌️
I'm trying to install jupyterthemes using conda and it's just been spinning for 30 mins and says "Solving environment"
Is there a way to install powerlevel10k for windows?
I have ubuntu (shell) and zsh installed
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
I did that in my shell
https://www.youtube.com/watch?v=su0h5StEZ6A
I'm watching this tutorial ^
And as the tutorial told me to type p10k configure, the shell tells zsh: command not found: p10k
BUT!
I have this directory here
I don't know where the configuration is and how do I run my config setup in the shell
Can I get any help?
Haven't seen what the tutorial said but here are the instructions from the official docs
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
If you're using oh my zsh then follow https://github.com/romkatv/powerlevel10k#oh-my-zsh
@heavy knot I also use vscode when I'm doing pentesting and I've been handed a project
yay!
Can you give me your plugins and settings please
I'm running low on them
My editor is almost with basic configurations
I use the default plugins or whatever, I only install language support for whatever project I'm working with
it's the main reason I use VSCode for it, installing language support is pretty easy and it can do pretty cross-referencing
oh!
Is vim very comfortable in linux?
I'm comfortable with vim
it has a very steep learning curve
hm!
I used it on-off for a few years before I finally decided to invest in properly learning its functionality
oh!
what's the terminal you use?
(Pretty sure you use zsh with p10k don't you)
zsh is the shell (which I do use), urxvt is the terminal
urxvt?
Is it limited to linux?
pretty sure it is, yes
very minimal terminal emulator with no bloat (no menus etc)
hm
Thanks for answering! 😄
I'll go watch some tutorials
Wait!
yeah?
before that, would you recommend me a python project for beginner?
I made a discord bot
depends on how much of a beginner you are
Can I dm you the invite link?
You can see what my skills are, if you look at the bot I made
you can leave after you see the bot
try looking around in #303934982764625920 to see what others have made and maybe draw some inspiration from that
ehhh I'm currently a bit too busy for that, sorry
oh okay
sorry
np!
@heavy knot vim is good to learn - I differentiate between vim keys and vim though. So, I use vim keys with anything that I use, but I don't use vim. I use vim for bits and pieces, but mainly I use vscode.
If you want to learn vim keys then vimtutor is the best place to start, I'm not sure how to start that on windows you'd have to have a search for it
I'm good with VSCode, thanks for the advise @topaz aspen! 😄
vscode has a vim mode, that i use
you will have to go through vimtutor a couple of times first tho, before using it much
Hi guys, I'm new to coding and right now starting with python. Is there any IDEs that I can use for free in my own computer? Or something to start practicing my skills on?
lots of IDEs. Pycharm, VS Code immediately come to mind
probably others
I can't recommend any because I don't use them, but they're popular
@thorny shell Thanks, I'll see to them.
💐
Is it possible to integrate cookiecutter and Pycharm's project templates?
I can create project with cc and open it in pycharm. But i would like to do it in one place.
is it best practice to add the gitignore file to a remote repo?
.gitignore should be version controlled, yes
anyone get these kinda errors in vscode with vim mode
What's the best software or managing tasks, deadlines, etc? For software dev above all else, but ideally it'd be suitable for all tasks - development oriented or not.
The best depends on a lot of factors. Jira is probably the most common thats used inside companies though
Is it free? What sort of factors should I take into consideration?
wow
there are one billion choices.
and I'm not in love with any of them
if you're at a really small scale, I'd start with whatever you're already using -- maybe google calendar or the apple or microsoft equivalents.
they're certainly not ideal, but they have the advantages of being free, and you already know how to use them
If you're on a small scale, trello or github issues+projects is what I'd reccomend
I love trello, but I use it the way other people use pinterest -- to keep track of stuff I want to buy
(it's pretty clearly designed to be used for agile programming, so who knows, maybe it's good at that too 🙂
I'd be slightly wary of github, though, since if you start using it, you'll be locked in
I don't think they let you export a lot of your stuff
hope I'm wrong
You can export issues as CSV. I don't know about the project boards though
trello lets you export as JSON; I assume that's essentially lossless
well, issues as CSV lets you import them directly into gitlab (and probably bitucket). Gitlab issues is what I use to track stuff for the very small (3 people) team that I'm on - I really don't see any good solutions though
and don't get me started on bug trackers -- I've never seen a good one
actually the one in github could easily be the best there is
(I've barely used it)
@heavy knot jira or trello, they have different uses but can be used for similar things
jira is more like issue tracker and is team oriented
and trello is more like TODO tool that can be customized and manipulated to serve as issue tracker or WIP tracker
anyone have advice for homebrew
I just did upgrade && update
and it messed up some dependencies on for my project
looks like it upgraded it pyenv, and now my project is looking for the old file path...
tired of this BS, keeps messing with my projects.
it messed up my shims
so i go into ```cd /Users/adkjaskjda/.pyenv/shims/
and there exists pyvenv and pyvenv-3.7
just in the shims directory
and a scrapy
I guess I have to check my bash profile because it may be pointing to something that doesn't exist anymore
If you only need a small kanban, this is great for vs code: https://github.com/coddx-hq/coddx-alpha
@heavy knot
fits into one simple markdown file
hi all
can someone take a look at this issue? https://www.reddit.com/r/Heroku/comments/frurof/warning_when_deploying_heroku_app/
If this is print of my "response.text", how can I get the value from "title" which is "Dried apples"?
I've tried for key,value in reponse.text.items():
print(key) but that doesn't work, reponse.text[0] prints "["
This is not the right channel. You should ask in one of the available help channels.
for i in range(len(response.text)):
for key,value in json.loads(response.text)[i].items():
if(key=="title"):
print(value)
answer if anyone needs
I was wondering if anyone knew hot to solve "SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81"
I've downloaded version 81, made it my default browser and uninstalled 80 to then see the message cannot find chrome. So i re installed version 80 and 81 is still my default and it wont go at all. Is there a way to force it to use verson 80?
I was wondering if anyone knew hot to solve "SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81"
I've downloaded version 81, made it my default browser and uninstalled 80 to then see the message cannot find chrome. So i re installed version 80 and 81 is still my default and it wont go at all. Is there a way to force it to use verson 80?
Guys I am using a app in my android but they mb blocked my so i need to connect to vpn to get the access of that app but i want to record a requests session of that app by charles. Is any possible way to record requests session from an android which uses vpn to get access of that app?
vscode often overwrites a tab, i want to open a file in a new tab
is there something obvious im' missing there?
ok cool - thanks
any way to dismiss this warning in pycharm?
https://i.imgur.com/VAGkBKp.png
pycharm is an absolute pain for me
Hey can anyone help me with de-compilation?
I love pycharm. It tells me what to do to fix issues in my code 🙂
Does anyone know where I can host a script for free?
repl.it for a short time
it won't act as a web service, though, if that's what you're hoping for
Hello everyone... Does anyone know what's the name of this theme.... And see those emoji's?... What extension is that?
One Dark Pro or Atom One Dark probably, the emojis are just your system font
Thanks... Can i change it?.. Imean the font of my system... It doesn't show emoji's...
Yes, you can change your system fonts
Thanks
Hey guys I need help with python
I need to add an interpreter in my settings
I try to choose my interpreter but then this pops out
And also what is SDK?
Probably i asked a question in a wrong way so we can contact via google hangouts
Ok now it works
I had to download it again
I can't get my virtual envs to behave normally in pycharm. Running pip -V and python -m pip -V produce different version numbers with my venv activated. I can't upgrade pip from the GUI because it uses pip. I can't upgrade pip with python -m pip because it's pointing to a different version. I can't install what I need with python -m pip ... because the packages end up in my system python folder, despite the venv being activated. What in the actual fuck is happening here
can you check type -a pip and type -a python as a start?
not sure what you mean, sorry. running those commands as written just results in an error
windows
ok, then I don't know anyway, sorry 
ok, thanks for trying
I think it's an issue with how pycharm sets up the venv because I just deleted it and made one from the command line which is not nearly as convenient but seems to have worked, and now works within pycharm as well
You can also do where <executable> to know if you’re executing the system interpreter of the venv
How do you configure VSCode?
I need that too, or a guide through how to tabulate the lines selected or auto tabulation
Jython works by compiling Python source into Java byte code and executing it in the JVM in the same manner as Java. ... I think Jython is better suited for integration with existing Java libraries.
so jython is faster
then why people don't use jython
?
@junior bronze Because it hasn't kept up with the CPython versions, and people want the new features they often bring
u mean they not compatible
if so why don't they just copy the python code and paste in cpython
yes, that's why people use cpython - to use the latest python features 🤣
Sorry no one have a pyton program for android to get te color of one pixel
On the screen?
process share same code ? what does it mean unable to understand
You have to tell us more
A virtual environment for a single project, it switches Python interpreters and modifies the path
So you can have different packages installed under different projects
The fact that you said a package you installed wasn't available in vscode means you're possibly in one
Can you compare the output of a few lines of Python in regular powershell and VScode powershell?
import sys
print(sys.executable)```
just run python.exe and paste that in
inside powershell yes
sure
in vs code:
C:\Users\Helio\AppData\Local\Programs\Python\Python37\python.exe
and the regular powershell is the same
C:\Users\Helio\AppData\Local\Programs\Python\Python37\python.exe
hmm, ok, so maybe you're not in a venv
What was the package you installed that you couldn't use?
let me paste the environment path on both:
k
vs code powershell:
Name : Path
Value : C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\sqlite3;C:\xampp\php;C:\Program
Files\PuTTY\;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\xampp\pgsql\12\bin;C:\xampp\pgsql\12\lib;C:\Users\Helio\AppData\Local\Programs\Python\Python37\S
cripts\;C:\Users\Helio\AppData\Local\Programs\Python\Python37\;C:\Users\Helio\AppData\Local\Microsoft\WindowsApps;C:\Users\Helio\AppData\Local\Programs\Microsoft VS Code\bin;C:\PHP7;C:\Program
Files\Git\cmd;C:\Users\Helio\AppData\Roaming\Composer\vendor\bin;C:\Users\Helio\AppData\Roaming\npm
regular powershell:
Name : Path
Value : C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\
System32\OpenSSH\;C:\sqlite3;C:\xampp\php;C:\Program Files\PuTTY\;C:\ProgramData\ComposerSetup\bin;C:\Program
Files\nodejs\;C:\Program Files\Git\cmd;C:\xampp\pgsql\12\bin;C:\xampp\pgsql\12\lib;C:\ProgramData\chocolatey\bi
n;C:\Users\Helio\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\Helio\AppData\Local\Programs\Python\P
ython37\;C:\Users\Helio\AppData\Local\Microsoft\WindowsApps;C:\Users\Helio\AppData\Local\Programs\Microsoft VS
Code\bin;C:\PHP7;C:\Program
Files\Git\cmd;C:\Users\Helio\AppData\Roaming\Composer\vendor\bin;C:\Users\Helio\AppData\Roaming\npm;C:\Program
Files (x86)\GitHub CLI\
so I installed chocolatey and github cli
but none of the are available in the visual code powershell
That doesn't appear to be Python related. I think this might be solved by forcing all open programs to refresh their environment variables by logging out of Windows and back in
you shouldn't have to reboot
right
I thought I didn't that and it didn't work
let me see
when you say windows, you visual studio, right?
No, I mean actually sign out of Windows
let me try then...
@coarse rapids just came to tell you that logging out Windows did solve the environment variable issue from the vs code integrated terminal
just like you suspected! 🙂
thanks a lot once again for you help. Really appreciated 🙂
how to go live on discord?
i am on mac
i am clicking on go live
but it starts and ends itself
i have enabled streamer mode
and developer mode
It is disabled on this server
what are advantages of sublime text over notepad++
The plugin ecosystem seems much more mature for sublime
I use notepad++ for simple viewing and edits but can't say that the few plugins I got were very conventient to get
Has anybody used any SMS phone messaging modules or APIs? From what I understand you can buy phone lines from sites such as Twilio per month but is there any way to text and receive data through your own personal phone?
i did use twilio, i also did use an android phone to automaticaly send and receive sms messages
for android it's just a matter of creating an app that does it using the android api, and to give yourself an api to do it, so you can send a request to your phone using http or whatever, and let it send the message
I was told to discus this here.
Hey everybody,
I'm curious, I'm new to Branching and Pull requests and such on Git.
What is your standard for how many branches you use? Now that I understand this, I'd make a branch for my Header, Footer, BlogPage, and everal things that will be having several updates moving forward. But I'm curious about how you manage your branches etc. Thank yo.
@pure pulsar Ok thank you
@flint badge i don't think you have parts of your page in different branch, basically you create a branch when you want to work on something, and you merge it into master when it's ready, branchs can be short lived, a few commits and then merged/destroyed
they are mainly useful for two things, collaboration with other purpose, collaboration, and release management, as you can work on something without disturbing the main version, it allows people to work each on something at the same time, and if something is not merged, you can still release the main version, as the in progress code is not into it
not sure if this is the correct channel but here goes
we've a uni assignment and it has to do with machine learning
in short we annotated faces and lips in video segments, got the csv from the tool, and now I just finished a script to turn the csv to xml
our data is in the form of x, y, width, height, and we want to either extract these regions from each frame or apply a mask (i.e. blackout) everything outside the regions in the frame
we're planning on using ffmpeg for frame extraction
any suggestions would be greatly appreciated
Suggestions for...what?
how to go about extracting the areas or applying the masks
our data is ~1100 clips 0:01-0:006 seconds long, with 24fps
you can imagine it can't be done manually
pycharm is not looking for the right interpreter.
or it might be still loading...
nope
did you try changing it to the correct one?
if you drop down the run configuration (on the top right where it says 'mythixgame') and click 'Edit Configurations' you should be able to set the right interpreter for 'mythixgame'
Problem with "from nglview.contrib.movie import MovieMaker"
import nglview
from nglview.contrib.movie import MovieMaker
movie_6M71 = MovieMaker(view_6M71, output='view_6M71.gif', in_memory=True)
movie_6M71.make()
Anyone can help me with that?
@dawn depot hi! As this isn't necessarily related to tools, I recommend grabbing a help channel from "Python help: Available". More people will see it there
Any ideas which plugin would be causing SVG previews in Sublime Text?
I want to edit the XML, not see the image
I suspect it may be one of the latex plugins I installed
I have no idea how to see the code for the SVG
Oh never mind
I opened the png, not the SVG
:\
:V
I'm trying to find a tool to scan a hard drive and create a database consisting of: file name, file type, date create, date edited, date access, and other meta data.
is there something that exists to do this?
I mean I have found things but I'm looking for something python and opensource
@brazen venture The journal of the file system is essentially already such a database
would be kind of redundant
Well I have millions of files that are from a system that was compromised and I'm trying to build a visual timeline using file info. It is not as easy a task as I thought it would be on the outset.
Download the SANS SIFT Kit: a free VMware Appliance pre-configured with all the necessary tools to perform a detailed digital forensic examination.
That does what you want
You can also try to just use log2timeline: https://github.com/log2timeline/plaso
Make sure to mount any evidence ro
Cool! THanks I will try them out
I want to run a python script as a cronjob using google app engine. I get how to do that, but how can I log data to a file ON google cloud? how do I see files ON google cloud?
where are they stored?
e.g. if I want to log the time the cronjob is run to a CSV file
no idea!
well, OK I do have an idea
your cron job's stdout probably goes to a file on the host where cron is running
and that's automatically in the cloud.
But, how you can see that file; that I don't know.
never having used google's cloud stuff
ok, having trouble with pandas. any ideas
@zinc cloud what are you trying to do?
ah
you need to run this to install modules in a jupyter cell @zinc cloud
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install pandas
that works, to install, which is what it was showing was ok, but then it fails the import step
conda keep install an older version of python
I use the command conda create --name threeEightWX python=3.8
and it still install 3.7.6
how do I get it to actually work properly??
@tawny temple Sorry for the ping but I'm not very well-versed with git and don't want to mess it up further; did the rebase and diff gets me this which looks correct
(bot) D:\pycon\bot>git diff origin/help-dormant-feedback help-dormant-feedback
diff --git a/config-default.yml b/config-default.yml
index 70c31ebb..89600397 100644
--- a/config-default.yml
+++ b/config-default.yml
@@ -112,7 +112,7 @@ guild:
categories:
help_available: 691405807388196926
- help_in_use: 356013061213126657
+ help_in_use: 696958401460043776
help_dormant: 691405908919451718
but I can't push it becaues the remote is forward by that change, should that be forced?
Thanks, forcing is scary so didn't want to do it before making sure
anyone here using VSCode?
im trying to save a "from x import y" halfway down my python file, but VSCode keeps on moving the import to the top of the file. I need it to run AFTER a configuration that I have set up. What settings can I change on VScode for it to not automatically format my file?
dunno, but I'd consider succumbing, and writing your code so that your import order doesn't matter
import-time side effects are evil
I'm struggling to get VsCode to recognize my python virtual environment in my project
Where is it located? In your project folder?
no, it's in a subfolder. the structure looks like this:
ProjectFolder
- native
- .venv
- program.py
- ...
And then I have.... wait.... wtf
somehow changing it to ".\.venv\Scripts\python.exe" fixed it?
after restarting the editor
ugh
so ridiculous
it will lose it again soon like last time
I suppose it only looks in the root of the project
And it makes more sense for it to be there anyway IMO
Well, it would if python were the only language I was using
But I'm writing a firefox extension
In any case, you can always manually specify a path
You can set python.pythonPath in the workspace settings
It won't recognize it unless it's at the root unless you create a workspace and then make the python folder (native in my case) to be the first entry in the workspace
I knew that already, but I had that and it STILL wasn't recognizing it after recognizing it before
When it recognises it, it saves its path to python.pythonPath in the workspace settings
If it no longer recognises it I would presume either it's been moved or your workspace settings were deleted
No, they were still there, Code was just being inexplicably finicky
Sorry, I haven't experience that. I don't know what could be wrong then.
kinda annoyed by it since now I can't track down why it screwed up in the first place
Is there a reason why CTRL+Q doesn't work when using Dataclasses in pycharm?
it suggests named arguments correctly
but when I do CTRL + Q in the brackets of MyClass() I don't get any suggestions what arguments are available
why do you ping me?
just go to this site and download the mac installer:
https://code.visualstudio.com/#alt-downloads
in the Makefile generated by Sphinx, what does the $(0) variable do? as in
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
wait... that's O
what the hell sphinx
what is a good ide for postgresql?
similar to mysql workbench or something (free preferrably)
not as good as mysql workbench but i've used pgadmin before and it was fine
there are also a few cross-platform ides that work with many diffferent databases like DBeaver and Squirrel SQL
anyone else having issues logging into aws rn?
Hi all - I am trying to learn how to use venvs for python, but I'm having problems with vs-code recognising my venv
I'm using a windows environment.
(venv) F:\Programming\Python\April-2020> cmd /C "set "DEBUGPY_LAUNCHER_PORT=1228" && C:\Users\12345\AppData\Local\Programs\Python\Python38\python.exe c:\Users\12345\.vscode\extensions\ms-python.python-202Users\12345\AppData\Local\Programs\Python\Python38\python.exe c:\Users\12345\.vscode\extn\April-2020\MyApp.py "ensions\ms-python.python-2020.3.71659\pythonFiles\lib\python\debugpy\no_wheels\debugpy\launcher f:\Programming\Python\April-2020\MyApp.py "
Traceback (most recent call last):
File "f:\Programming\Python\April-2020\MyApp.py", line 3, in <module>
from flask import Flask, render_template
ModuleNotFoundError: No module named 'flask'
(venv) F:\Programming\Python\April-2020>```
I have attempted to change the interpreter that vs-code is using, but it doesn't find the interpreter in my venv
@candid maple pgadmin
have you ever heard of AWS
amazon web services
or GCP, google cloud platform
they are good places to start
Is it good?
it's AWS
Oh ok
AWS / OceanDigital are great
K