Linux directory folder that begins with a symbols - linux

I am working on a website and noticed that as I was making up folder names that any folder name that begins with a # is not recognized from the web browser. For example: example.com/#example/index.html will not work. Whereas example.com/%23example/index.html works. In the same example using !#$%*& will work file without encoding. Curious why and how to make it work if I wanted it to. I read this article: Which characters make a URL invalid?. Thanks

Invalid characters might have a special meaning for the browser. For example # is used to create links on the same page. Take a look here.

Related

Is there a Linux command line utility for getting random data to work with from the web?

I am a Linux newbie and I often find myself working with a bunch of random data.
For example: I would like to work on a sample text file to try out some regular expressions or read some data into gnuplot from some sample data in a csv file or something.
I normally do this by copying and pasting passages from the internet but I was wondering if there exists some combination of commands that would allow me to do this without having to leave the terminal. I was thinking about using something like the curl command but I dont exactly know how it works...
To my knowledge there are websites that host content. I would simply like to access them and store them in my computer.
In conclusion and as a concrete example, how would i copy and paste a random passage off the internet from a website and store it in a file in my system using only the command line? Maybe you can point me in the right direction. Thanks.
You could redirect the output of a curl command into a file e.g.
curl https://run.mocky.io/v3/5f03b1ef-783f-439d-b8c5-bc5ad906cb14 > data-output
Note that I've mocked data in Mocky which is a nice website for quickly mocking an API.
I normally use "Project Gutenberg" which has 60,000+ books freely downloadable online.
So, if I want the full text of "Peter Pan and Wendy" by J.M. Barrie, I'd do:
curl "http://www.gutenberg.org/files/16/16-0.txt" > PeterPan.txt
If you look at the page for that book, you can see how to get it as HTML, plain text, ePUB or UTF-8.

How to download file that has space in its name?

In my virtual directory, I have many mp3 files, there are space or Chinese characters. How do I allow visitors to download them?
For example:
There's no problem when downloading www.myWebsite.com/virtualDirectory/songNameSimple.mp3
But if the song name has space in it, it's replaced by %20, thus return 404 error.
I'm curious about solution in both iis and lamp, although maybe the solution is the same.
Thanks
The server is handling this automatically, it was working for me at the beginning due to something else.

Octopress preview with local mathjax?

I often write posts with limited or no connectivity, which is one reason octopress is so appealing: it makes it really natural to write and preview posts offline. The problem is that I cannot figure out how to make MathJax play ball. I have it set up and working properly using the CDN, which is how the static pages get uploaded to the server. But what I want is to be able to use a local mathjax to preview the posts offline. This I do not know how to achieve.
To be sure, I can change the source/_includes/custom/head.html point it to ./mathjax/MathJax.js, but that only works if after rake generate I do cp /path/to/mathjax public/. But then I have to do this after every site (re-)generation, which is... cumbersome, to put it mildly. I've tried symbolic links, relative and absolute paths, but to no avail. Is there a better alternative?
Thank you in advance.
If all you need is the MathJax.js, you can put that in source/javascripts/. Doing so will add that file to the Octopress site which in turn means it'll be added to your site every time it's regenerated. source is the base of the Jekyll site Octopress has, so put everything in there except plugins and sass files.

Could I have any issue using the # (at sign) in a *n*x directory?

I'm developing a website, and want to create a directory after the user username, what is going to be the email address (so I don’t have to generate new ɪᴅs, etc)
I've made some tests and it seems to work fine. Also, I didn’t find any documentation against using the "#" in a directory, but could I find some problem in the future with this approach?
I mean, might some browser not be able to upload images from this directory, or some other problem?
if you plan to run perl scripts (and possibly other languages) against those files you will need to remember to escape the # sign. It's not a huge problem, but I personally would not do it.
More importantly if the path is visible to the browser you would be disclosing the user's email address to the whole world.
I would suggest using something like an MD5 hash of the user's email instead. It is (relatively) unique, and you can recalculate it very easily if you need to. Gravatar uses this approach for instance. See: http://en.gravatar.com/site/implement/hash/
no.. there should be no problems.. browsers are trying to read the file and they don't care that much about the title only file content... (header matters)
So.. there should be no problem...
Historically some remote filesystems have used the # to "escape" from normal path processing to do "interesting" stuff.
Some version control systems use # to denote a certain version of a path (e.g. Subversion, ClearCase).
Some other tools use # to denote "user#remote_host" stuff - AFAIK rsync is one of them which might bite you - you should check if that tool is used somewhere on your site for backup or syncing or something like that.
So - I would not use that character within filenames.

TYPO3: indexed_search and title tag

Is there a way to get a title tag in the search results of indexed_search?
Instead of
Text
there should be
Text
Not a real solution but best I could do:
I think this won't be possible without changing the extension's PHP code. If you do so, copy the extension folder from the systext folder to your typo3conf/ext folder, otherwise you will get in trouble when updating Typo3.
indexed_search seems to have only hardcoded -Tags. You can check this by looking first at the actual HTML output (your search results). Then compare this with the HTML template used. If you have shell access to your server, a grep command might help to locate the correct template. Then try to find the marker. I suppose in your case it's ###TITLE###. Then you have to figure out how the marker is filled. Again a grep command for '###TITLE###' in the folder's extension might help you. Then you will see if the tag is hardcoded or not and how you can change it.
Often the faster solution is to use the template object browser and to try to find a piece of TypoScript below plugin.indexed_search which could be responsible what you want to change.
Unfortunately in your case both didn't help. For some strange reason, '###TITLE###' isn't contained anywhere in the the indexed_search extension.
A very ugly workaround would be to use javascript or jquery to insert the attribute.

Resources