I'm trying to turn a django site into a static site using https://github.com/mgrp/django-distill . I am outputting the static files into
/e/ENVS/STATIC/static1
on my win10 local system. As I make changes I want to overwrite all the non hidden files including the .git directory, the commit and push the changes to my github repo for deployment. Unfortunately the distill project overwrites the entire directory , deleting the .git/ files. I've tried to protect the git files with
$ chmod -R 707 .git/
using git-bash, but the output looks like:
drwxr-xr-x 1 me 197121 0 Oct 21 14:35 ./
drwxr-xr-x 1 me 197121 0 Oct 20 17:11 ../
drwxr-xr-x 1 me 197121 0 Oct 21 14:35 .git/
drwxr-xr-x 1 me 197121 0 Oct 21 14:36 .idea/
-rw-r--r-- 1 me 197121 9963 Oct 21 15:02 agreement.html
-rw-r--r-- 1 me 197121 17 Oct 21 15:02 contact.html
-rw-r--r-- 1 me 197121 14027 Oct 21 15:02 documents.html
-rw-r--r-- 1 me 197121 17048 Oct 21 15:02 form.html
-rw-r--r-- 1 me 197121 11060 Oct 21 15:02 index.html
-rw-r--r-- 1 me 197121 4921 Oct 21 15:02 slideshow.html
drwxr-xr-x 1 me 197121 0 Oct 21 15:02 static/
How do I turn on and off write permissions for the .git/ directory?
You can move the .git/ folder out of the way elsewhere.
Whenever you need to work on that repo, set the environment variables:
GIT_DIR=/path/to/saved/.git
GIT_WORK_TREE=/where/your/.git/was
And you will benefit from working Git commands when typing git status, even if your deployment process overrides everything.
Related
/volume1 was once my only volume, and it's has been joined by /volume2 in preparation for retiring /volume1.
Having relocated all my content I can see lots of files I cannot explain. Unusually they are all prefixed with #, e.g.
/volume1$ ls -als
total 430144
0 drwxr-xr-x 1 root root 344 May 2 16:19 .
4 drwxr-xr-x 24 root root 4096 May 2 16:18 ..
0 drwxr-xr-x 1 root root 156 Jun 29 15:57 #appstore
0 drwx------ 1 root root 0 Apr 11 04:03 #autoupdate
0 drwxr-xr-x 1 root root 14 May 2 16:19 #clamav
332 -rw------- 1 root root 339245 Jan 23 13:50 #cnid_dbd.core.gz
0 drwxr-xr-x 1 admin users 76 Aug 19 2020 #database
0 drwx--x--x 1 root root 174 Jun 29 15:57 #docker
0 drwxrwxrwx+ 1 root root 24 Jan 23 15:27 #eaDir
420400 -rw------- 1 root root 430485906 Jan 4 05:06 #G1.core.gz
0 drwxrwxrwx 1 root root 12 Jan 21 13:47 #img_bkp_cache
0 drwxr-xr-x 1 root root 14 Dec 29 18:45 #maillog
0 drwxr-xr-x 1 root root 60 Dec 29 18:39 #MailScanner
0 drwxrwxr-x 1 root root 106 Oct 7 2018 #optware
7336 -rw------- 1 root root 7510134 Jan 24 01:33 #Plex.core.gz
0 drwxr-xr-x 1 postfix root 166 Oct 12 2020 #postfix
2072 -rw------- 1 root root 2118881 Jan 17 03:47 #rsync.core.gz
0 drwxr-xr-x 1 root root 88 May 2 16:19 #S2S
0 drwxr-xr-x 1 root root 0 Jan 23 13:50 #sharesnap
0 drwxrwxrwt 1 root root 48 Jun 29 15:57 #tmp
I have two questions
what does the # prefix signify, and
how can I move/remove them, given that something's going to miss these files.
From experimentation it seems the answers are:
Nothing - they're a convention used by the Synology packaging system, it appears.
With one exception I didn't need to consider the consequences of removing the file system on which these stood. The #appstore directory clearly holds the installed Synology packages, and after pulling /volume1 they showed in the Package Center as "needing repair". Once they were repaired, the same # prefixed directories appeared in the new volume - and the configuration was retained - so it appears these directories hold only the immutable software components.
The exception: I use ipkg mostly for fetchmail. I took a listing of the installed packages as well as the fetchmailrc, and then reinstalled the same packages once "Easy Bootstrap Installer" was ready for use (repair didn't work on this, but uninstall and reinstall worked fine).
I am trying run docker inside WSL (am running Ubuntu in WSL). Also am new to docker. The doc says:
To get the best out of the file system performance when bind-mounting files:
Store source code and other data that is bind-mounted into Linux containers (i.e., with docker run -v <host-path>:<container-path>) in the Linux filesystem, rather than the Windows filesystem.
Linux containers only receive file change events (“inotify events”) if the original files are stored in the Linux filesystem.
Performance is much higher when files are bind-mounted from the Linux filesystem, rather than remoted from the Windows host. Therefore avoid docker run -v /mnt/c/users:/users (where /mnt/c is mounted from Windows).
Instead, from a Linux shell use a command like docker run -v ~/my-project:/sources <my-image> where ~ is expanded by the Linux shell to $HOME.
I also came across following:
Run sudo docker run -v "$HOME:/host" --name "[name_work]" -it docker.repo/[name]. With, [$HOME:/host], you can access your home directory in /host dir in docker image. This allows you to access your files on the local machine inside the docker. So you can edit your source code in your local machine using your favourite editor and run them directly inside the docker. Make sure that you have done this correct. Otherwise, you may need to copy files from the local machine to docker, for each edit (a painful job).
I am not able to understand the format of parameter passed to -v option and what it does. I am thinking that it will allow to access Ubuntu directories inside docker. So $HOME:/host will map Ubuntu's home directory to /host inside.
Q1. But what is /host?
Q2. Can I do what is stated by above two quotes together? I mean what they are saying is compatible? I guess yes. What all its saying is I should not mount from windows director like /mnt/<driveletter>/.... If I am mounting linux directory like $USER/... then it will give better performance, right?
I tried out running it to understand it:
~$ docker run -v "$HOME:/host" --name "mydokr" -it docker.repo.in/dokrimg
root#f814974a1cfb:/home# ls
root#f814974a1cfb:/home# ll
total 8
drwxr-xr-x 2 root root 4096 Apr 15 11:09 ./
drwxr-xr-x 1 root root 4096 Sep 22 07:16 ../
root#f814974a1cfb:/home# pwd
/home
root#f814974a1cfb:/home# cd ..
root#f814974a1cfb:/# ll
total 64
drwxr-xr-x 1 root root 4096 Sep 22 07:16 ./
drwxr-xr-x 1 root root 4096 Sep 22 07:16 ../
-rwxr-xr-x 1 root root 0 Sep 22 07:16 .dockerenv*
lrwxrwxrwx 1 root root 7 Jul 3 01:56 bin -> usr/bin/
drwxr-xr-x 2 root root 4096 Apr 15 11:09 boot/
drwxr-xr-x 5 root root 360 Sep 22 07:16 dev/
drwxr-xr-x 1 root root 4096 Sep 22 07:16 etc/
drwxr-xr-x 2 root root 4096 Apr 15 11:09 home/
drwxr-xr-x 5 1000 1001 4096 Sep 22 04:52 host/
lrwxrwxrwx 1 root root 7 Jul 3 01:56 lib -> usr/lib/
lrwxrwxrwx 1 root root 9 Jul 3 01:56 lib32 -> usr/lib32/
lrwxrwxrwx 1 root root 9 Jul 3 01:56 lib64 -> usr/lib64/
lrwxrwxrwx 1 root root 10 Jul 3 01:56 libx32 -> usr/libx32/
drwxr-xr-x 2 root root 4096 Jul 3 01:57 media/
drwxr-xr-x 2 root root 4096 Jul 3 01:57 mnt/
drwxr-xr-x 2 root root 4096 Jul 3 01:57 opt/
dr-xr-xr-x 182 root root 0 Sep 22 07:16 proc/
drwx------ 1 root root 4096 Aug 24 03:54 root/
drwxr-xr-x 1 root root 4096 Aug 11 10:24 run/
lrwxrwxrwx 1 root root 8 Jul 3 01:56 sbin -> usr/sbin/
drwxr-xr-x 2 root root 4096 Jul 3 01:57 srv/
dr-xr-xr-x 11 root root 0 Sep 22 03:32 sys/
-rw-r--r-- 1 root root 1610 Aug 24 03:56 test_logPath.log
drwxrwxrwt 1 root root 4096 Aug 24 03:57 tmp/
drwxr-xr-x 1 root root 4096 Aug 11 10:24 usr/
drwxr-xr-x 1 root root 4096 Jul 3 02:00 var/
root#f814974a1cfb:/home# cd ../host
root#f814974a1cfb:/host# ll
total 36
drwxr-xr-x 5 1000 1001 4096 Sep 22 04:52 ./
drwxr-xr-x 1 root root 4096 Sep 22 07:16 ../
-rw-r--r-- 1 1000 1001 220 Sep 22 03:38 .bash_logout
-rw-r--r-- 1 1000 1001 3771 Sep 22 03:38 .bashrc
drwxr-xr-x 3 1000 1001 4096 Sep 22 04:56 .docker/
drwxr-xr-x 2 1000 1001 4096 Sep 22 03:38 .landscape/
-rw-r--r-- 1 1000 1001 0 Sep 22 03:38 .motd_shown
-rw-r--r-- 1 1000 1001 921 Sep 22 04:52 .profile
-rw-r--r-- 1 1000 1001 0 Sep 22 03:44 .sudo_as_admin_successful
drwxr-xr-x 5 1000 1001 4096 Sep 22 04:52 .vscode-server/
-rw-r--r-- 1 1000 1001 183 Sep 22 04:52 .wget-hsts
So I am not getting whats happening here. I know docker has its own file system.
Q3. Is is that, what am finding at /home and /host is indeed container's own file system?
Q4. Also, what happened to -v $HOME:/host here?
Q5. How can I do as stated by 2nd quote:
This allows you to access your files on the local machine inside the docker. So you can edit your source code in your local machine using your favourite editor and run them directly inside the docker.
Q6. How do I connect vscode to this container? From WSL-Ubuntu, I could just run code . to launch vscode. But the same does not seem to work here:
root#f814974a1cfb:/home# code .
bash: code: command not found
This link says:
A devcontainer.json file can be used to tell VS Code how to configure the development container, including the Dockerfile to use, ports to open, and extensions to install in the container. When VS Code finds a devcontainer.json in the workspace, it automatically builds (if necessary) the image, starts the container, and connects to it.
But I guess this says starting up creating new container form vscode. But not connecting to already existing container. I am not able to find my dockercontainer.json. I downloaded this container image using docker pull.
I'm a Python programmer that is trying to make a system of sorts that creates save data for a game I'm making, and I want it to be in different places in something like Ubuntu than I do macOS. As I don't have a macOS, and it's impossible to just up and get an ISO to get a macOS VM, I can't look through the files and folders and see what it has (or doesn't) that Linux does or doesn't.
I've tried looking all over to the point of attempting to get a hold of an ISO to build a VM in VirtualBox, but haven't been successful at all.
What files or folders does macOS have that Linux does, or vice versa?
To complete the (excellent) answer from #Michael, here is the listing of the home and root directory after a fresh install on the latest stable release of MacOS System (10.14.2)
MacBook-Pro:~ max$ ls -al /
total 37
drwxr-xr-x 26 root wheel 832 Jan 6 19:00 .
drwxr-xr-x 26 root wheel 832 Jan 6 19:00 ..
-rw-rw-r-- 1 root admin 8196 Jan 13 07:11 .DS_Store
drwx------ 5 root admin 160 Jan 6 11:47 .Spotlight-V100
d-wx-wx-wt 2 root wheel 64 Jan 14 06:39 .Trashes
---------- 1 root admin 0 Aug 18 06:53 .file
drwx------ 11 root admin 352 Jan 14 06:39 .fseventsd
drwxr-xr-x 2 root wheel 64 Aug 18 06:53 .vol
drwxrwxr-x+ 39 root admin 1248 Nov 30 12:49 Applications
drwxr-xr-x+ 60 root wheel 1920 Nov 30 12:50 Library
drwxr-xr-x 2 root wheel 64 Aug 18 06:53 Network
drwxr-xr-x# 5 root wheel 160 Nov 30 12:46 System
drwxr-xr-x 5 root admin 160 Jan 6 18:59 Users
drwxr-xr-x+ 4 root wheel 128 Jan 14 06:39 Volumes
drwxr-xr-x# 37 root wheel 1184 Nov 30 12:55 bin
drwxrwxr-t 2 root admin 64 Aug 18 06:53 cores
dr-xr-xr-x 3 root wheel 4301 Jan 14 06:39 dev
lrwxr-xr-x# 1 root wheel 11 Jan 6 18:49 etc -> private/etc
dr-xr-xr-x 2 root wheel 1 Jan 14 06:40 home
-rw-r--r-- 1 root wheel 313 Aug 18 10:03 installer.failurerequests
dr-xr-xr-x 2 root wheel 1 Jan 14 06:40 net
drwxr-xr-x 6 root wheel 192 Nov 30 12:50 private
drwxr-xr-x# 64 root wheel 2048 Jan 6 18:49 sbin
lrwxr-xr-x# 1 root wheel 11 Jan 6 18:49 tmp -> private/tmp
drwxr-xr-x# 9 root wheel 288 Nov 30 12:38 usr
lrwxr-xr-x# 1 root wheel 11 Jan 6 18:49 var -> private/var
And the home dir:
MacBook-Pro:~ max$ ls -al ~
total 16
drwxr-xr-x+ 15 max staff 480 Jan 14 06:43 .
drwxr-xr-x 5 root admin 160 Jan 6 18:59 ..
-r-------- 1 max staff 7 Jan 6 18:59 .CFUserTextEncoding
drwx------ 2 max staff 64 Jan 14 06:40 .Trash
-rw------- 1 max staff 0 Jan 13 07:11 .bash_history
drwx------ 10 max staff 320 Jan 14 06:40 .bash_sessions
-rw------- 1 max staff 908 Jan 14 06:43 .viminfo
drwx------+ 3 max staff 96 Jan 6 18:59 Desktop
drwx------+ 3 max staff 96 Jan 6 18:59 Documents
drwx------+ 3 max staff 96 Jan 6 18:59 Downloads
drwx------# 51 max staff 1632 Jan 13 07:11 Library
drwx------+ 3 max staff 96 Jan 6 18:59 Movies
drwx------+ 3 max staff 96 Jan 6 18:59 Music
drwx------+ 3 max staff 96 Jan 6 18:59 Pictures
drwxr-xr-x+ 4 max staff 128 Jan 6 18:59 Public
Application settings on macOS are ususally saved somewhere in ~/Library: Common places are ~/Library/Preferences/com.example.mycoolgame.plist for preferences (should be in plist format and "com.example.mycoolgame" should be a valid bundle ID that you own (you should own the domain)). The advantage/disadvantage of this path is that power users know about this directory and can edit the files there as they wish.
Then you have ~/Library/Caches for cached data. All cached data should be put somewhere under this directory. (Never use it for content that cannot be regenerated or redownloaded though.)
~/Library/ApplicationSupport/YourApplicationName/...: here you can basically do anything you like. It would be good if "YourApplicationName" would be globally unique in this case.. So better make it long. Users usually don't see the filesystem contents of anything below "~/Library", so there is no need for short names.
Of course, you can also put your savegames in ~/Documents/MyCoolGame/savegames and tell the user that you save the games there.
A gotcha (maybe): I'm not sure if system APIs expand "~" properly. I think probably not: Calling fopen with a path that starts with "~" would most likely not do the right thing. The users directory is located at something like "/Users/max", so "~" expands to "/Users/max" in the command line if the username is "max".
I can't answer your original question "What directories does Linux have that macOS doesn't?" because I don't have a Linux box at hand at the moment, and I don't think that it would be helpful for your use case.
For global data, there is also the "/Library" hierarchy.. But normal users don't have access to this place, so your game would need to ask for admin rights, which will make everything much more complicated, and this will feel user-unfriendly to macOS users. The macOS way is to have a self-contained application bundle and put all user-specific or temporary data into the appropriate place within the users home folder.
New to this and I believe I made duplicates or versions of the .bash_profile. I'd like to know how to make one the priority or delete those that are not active. I think its interfering with my SQL communication.
-rw------- 1 noahjones staff 2342 Sep 3 18:33 .bash_history
-rw-r--r-- 1 noahjones staff 157 Sep 3 18:31 .bash_profile
-rw------- 1 noahjones staff 201 Sep 3 18:29 .bash_profile.save
-rw-r--r-- 1 noahjones staff 74 Sep 3 16:33 .bash_profile_
drwx------ 48 noahjones staff 1536 Sep 3 18:34 .bash_sessions
-rw-r--r-- 1 noahjones staff 118 Sep 3 15:38 .bashrc
drwxr-xr-x 3 noahjones staff 96 Sep 3 16:01 .bundle
drwxr-xr-x 4 noahjones staff 128 Sep 3 15:40 .gem
-rw-r--r-- 1 noahjones staff 74 Sep 3 18:33 _bash.profile
Only the .bashrc and /.bash_profile are relevant. The file .bash_history is created automatically to store the history of your commands; the .bash_profile.save, .bash_profile_ and _bash.profile must be your backup files -- they are virtually ignored. The .bundle and .gem are not related to bash.
You probably have .bashrc and/or .bash_profile misconfigured. The difference between .bash_profile and .bashrc is that the former is only executed once, when you log in, while the latter is run every time you open a new /bin/bash shell. Depending on what you need to do with SQL you may want to delete one or the other.
I'm trying to install Torch7 on my mac, however the installation halts at this point:
Not updating your shell profile.
You might want to
add the following lines to your shell profile:
export PATH=/Users/khsiddiqui/torch/install/bin:$PATH
export LD_LIBRARY_PATH=/Users/khsiddiqui/torch/install/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/Users/khsiddiqui/torch/install/lib:$DYLD_LIBRARY_PATH
Not sure what it means. Further above I received the following output
echo "Error: could not find ipython in PATH. Do you have it installed?"
fi
However iPython is installed as I can confirm:
No update necessary, 'ipython' is up-to-date.
ipython-3.0.0-3.egg was installed on: Thu Apr 9 18:12:32 2015
kamransiquisMBP:torch khsiddiqui$ env | grep PATH
PATH=/Users/khsiddiqui/Library/Enthought/Canopy_64bit/User/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/opt/X11/bin:
/usr/texbin
Attempting to locate the .bashrc file
%edit .bashrc
WARNING: Argument given (.bashrc) can't be found as a variable or as a filename.
kamransiquisMBP:torch khsiddiqui$ ls -ld ~/.*
drwxr-xr-x+ 43 khsiddiqui staff 1462 12 Apr 01:15 /Users/khsiddiqui/.
drwxr-xr-x 6 root admin 204 19 Oct 17:34 /Users/khsiddiqui/..
-r-------- 1 khsiddiqui staff 7 19 Oct 17:34 /Users/khsiddiqui/.CFUserTextEncoding
-rw-r--r--# 1 khsiddiqui staff 16388 26 Mar 23:59 /Users/khsiddiqui/.DS_Store
drwxr-xr-x 3 khsiddiqui staff 102 8 Sep 2014 /Users/khsiddiqui/.R
-rw-r--r-- 1 khsiddiqui staff 728832 2 Apr 17:21 /Users/khsiddiqui/.RData
-rw-r--r-- 1 khsiddiqui staff 1101 20 Oct 02:58 /Users/khsiddiqui/.Rapp.history
-rw-r--r-- 1 khsiddiqui staff 6314 2 Apr 17:21 /Users/khsiddiqui/.Rhistory
drwx------ 22 khsiddiqui staff 748 12 Apr 01:25 /Users/khsiddiqui/.Trash
-rw------- 1 khsiddiqui staff 1860 9 Apr 22:15 /Users/khsiddiqui/.bash_history
drwxr-xr-x 4 khsiddiqui staff 136 9 Apr 17:57 /Users/khsiddiqui/.cache
drwx------ 18 khsiddiqui staff 612 12 Apr 20:09 /Users/khsiddiqui/.canopy
drwxr-xr-x 3 khsiddiqui staff 102 12 Apr 01:15 /Users/khsiddiqui/.conda
drwxr-xr-x 2 khsiddiqui staff 68 12 Apr 01:11 /Users/khsiddiqui/.continuum
drwx------ 3 khsiddiqui staff 102 30 Jul 2010 /Users/khsiddiqui/.cups
drwx------ 10 khsiddiqui staff 340 2 Apr 17:26 /Users/khsiddiqui/.dropbox
-rw-r--r-- 1 khsiddiqui staff 2525 12 Apr 16:56 /Users/khsiddiqui/.enstaller4rc
drwxr-xr-x 9 khsiddiqui staff 306 9 Apr 22:25 /Users/khsiddiqui/.ipython
drwxr-xr-x 4 khsiddiqui staff 136 12 Apr 16:57 /Users/khsiddiqui/.matplotlib
-rw-r--r-- 1 khsiddiqui staff 340 12 Apr 01:12 /Users/khsiddiqui/.profile
-rw-r--r-- 1 khsiddiqui staff 251 28 Mar 13:45 /Users/khsiddiqui/.profile-anaconda.bak
drwxr-xr-x 15 khsiddiqui staff 510 2 Apr 17:21 /Users/khsiddiqui/.rstudio-desktop
drwxr-xr-x 6 khsiddiqui staff 204 20 Oct 19:21 /Users/khsiddiqui/.subversion
-rw------- 1 khsiddiqui staff 625 9 Apr 21:33 /Users/khsiddiqui/.viminfo
i had a similar problem and solved it, maybe it could help others.
Here was the end of the second installation script, and the command "th" wasn't working:
Not updating your shell profile.
You might want to
add the following lines to your shell profile:
. /Users/myusername/torch/install/bin/torch-activate
This article explains how your shell profile is organized: https://serverfault.com/questions/110065/what-profile-is-my-current-shell-using
I realized in my user folder /Users/myusername/ i had a ".bash_profile" file, i pasted the line ". /Users/myusername/torch/install/bin/torch-activate" inside but didn't work (command "th" no recognized in terminal).
So in the same /Users/myusername/ folder i created a ".profile" file and pasted the line ". /Users/myusername/torch/install/bin/torch-activate" inside.
Then the command "th" works fine ;)
First, IPython may be installed but not seen by the install process.
If you enter which ipython at a shell prompt it will tell you where it is installed. Then echo $PATH will display your PATH variable which should contain the directory that contains IPython. If it isn't then you will have to edit the PATH statement in your .bashrc file to add it.
Second, .bashrc is a file that is run by the shell when it starts up and should be in your home directory so enter cd at a shell prompt and you will be there. Then use a text editor such as Text Edit to edit it. In your case you don't have a .bashrc file, instead some things are being set in a file called .profile. You should probably check the contents of that.
Finally, I wouldn't run any of these commands from within IPython. Only run them (and the Torch install process) from the shell.
Further, I notice you have a file with the name "anaconda" in it. Have you installed 'Anaconda'?