Remove Sub Folders & file names in URL of a GitHub Pages Site - html

I want to remove the endings after my domain, for example:
https://customdomain.com/src/loading-page/loading.html -> https://customcustomdomain.com/
Here is my file tree for GitHub Pages:
dist
│ CNAME
│ poster.png
│
└───assets
│ │ css/images/js files
│
└───src
│ │
│ └───loading-page
│ │ loading.html
│ └───main-page
│ │ main.html
Is there a specific file I can incorporate in this tree to rewrite the URL on the GitHub Pages to look like the root (no folders or files following the domain? Or some setting I can change in GitHub Pages itself?

Related

Flask: Efficient on-demand delivery of selected 2D slices from 3D volumes

How can I efficiently store hundreds of 3D volumes and serve selected instance slices on-demand with Flask?
I am currently solving the issue by saving each subvolume as an image collection of its slices. Here each folder is a subvolume (cropped out object) - the image names correspond to the slices of the volume from which the subvolume was cropped.
├── 1/
│ ├── 1.png
| ...
│ ├── 10.png
│ └── 11.png
├── 2/
│ ├── 0.png
| ...
│ ├── 4.png
│ └── 5.png
├── 3/
│ ├── 3.png
| ...
│ ├── 11.png
│ └── 12.png
...
|
└── 176/
├── 34.png
...
├── 43.png
└── 44.png
Instead, I would like to store each subvolume, e.g., as a single tiff file and only serve the required slices.
├── 1/
│ └── image.tif
├── 2/
│ └── image.tif
├── 3/
│ └── image.tif
...
|
└── 176/
└── image.tif
However, according to this Stackoverflow answer the only mainstream browser that supports tiff is Safari.
Is there a way where I don't have to save every single image? Especially considering that I will only need to depict the most centric slice of a subvolume in most cases and only in a few cases make the whole subvolume browsable.

finding path in HTML

My file is organized like this:
My/
├── public/
│ ├── css/
│ │ ├── sign.css
├── views/
│ ├── register.ejs
And I typed in below to access the "sign.css" file:
<link href="css/sign.css" rel="stylesheet">
Why is the href path correct?
Shouldn't it be ../public/css/sign.css
since in order to access sign.css, the step is
"go back one file to My -> go into public -> go into css -> access sing.css"?
app.use(express.static('public'))
Above code sets public directory from which to serve static assets.
Express looks up the files relative to the static directory, so the name of the static directory is not part of the URL.

Gulp minify and move files with same folder structure

I have a folder structure like this:
.
├── dist/
└── src/
├── index.php
└── projects/
├── some-project/
│ ├── main.css
│ ├── main.js
│ └── index.html
└── N'th project/ ...
I need to minify and move every project inside src/ to dist/ without breaking folder structure. Should look like this:
.
├── dist/
│ ├── index.php
│ └── projects/
│ ├── some-project/
│ │ ├── main.css(minified)
│ │ ├── main.js(minified)
│ │ └── index.html
│ └── N'th project/ (also minified) ...
└── src/
├── index.php
└── projects/
├── some-project/
│ ├── main.css
│ ├── main.js
│ └── index.html
└── N'th project/ ...
Thanks for your time.
I solved it with something like this. If any one want to use:
.pipe(gulp.dest(function(file){
let splittedUrl = file.history[0].split("\\");
let projectName = splittedUrl.slice(splittedUrl.indexOf("projects"),-1);
//console.log(projectName.join("/"));
return "dist/" + projectName.join("/");
}));
gulp.task("projectTest", () => {
return gulp.src("./src/projects/**/*.css")
// minify pipe, etc.
.pipe(gulp.dest('dist/projects'))
});
From https://gulpjs.com/docs/en/api/concepts#glob-base:
A glob base - sometimes called glob parent - is the path segment
before any special characters in a glob string. As such, the glob base
of /src/js/**.js is /src/js/. All paths that match the glob are
guaranteed to share the glob base - that path segment can't be
variable.
Vinyl instances generated by src() are constructed with the glob base
set as their base property. When written to the file system with
dest(), the base will be removed from the output path to preserve
directory structures.
That is a little confusing as written. In my code the part before the globstar ** is the base. So ./src/projects/ is the base. And the directory structure under the base is always preserved - but that wouldn't include projects (because that is part of the base and will be removed automatically in gulp.dest).
In the dest pipe, the directory structures (project1, project2, etc.) are still there but would be sent to your dest folder without the base path at the beginning. So you will need to add whatever part of that base path back into your dest folder if you want it.
So gulp.dest('dist/projects') to get the preserved folder structure put back under projects as you want.
So if what I said is true, this alternative should work as well:
gulp.task("projectTest", () => {
// return gulp.src("./src/projects/**/*.css")
return gulp.src("./src/**/*.css")
// .pipe(gulp.dest('dist/projects'))
.pipe(gulp.dest('dist'))
});
Now the directory structure under src is preserved (becasue src is the base). So you get the same result just sending all that to dist.
You can decide which form you prefer, I think the first version is a little clearer. And if there are files under src that you do not want captured by the gulp.src glob.

Modify path of gulp.dest

My goal is to find the binaries in here, and elevate them to the first subdir in exe dir.
My simplified (in reality it has more junk, more subdirs) folder structure is this:
src
├── exe
│ └── nix
│ └── binary.out
│ └── blah
│ └── mac
│ └── binary.out
│ └── blah
│ └── win
│ └── src
│ └── trigger
│ └── trigger
│ └── trigger
│ └── binary.exe
│ └── Debug
My goal is to copy just the binary files into dist/exe like this:
dist
├── exe
│ └── nix
│ └── binary.out
│ └── mac
│ └── binary.out
│ └── win
│ └── binary.exe
This is the code I use right now:
var path = require('path');
gulp.src(['src/exe/**/*.out', 'src/exe/**/*.exe'])
.pipe(gulp.dest(function(file) {
var os = file.path.match(/(?:win|mac|nix)/)[0];
return 'dist/exe/' + os + '/' + path.basename(file.path);
}));
However this is still copying the structure even after the os name. It's like it appends the **/ stuff after my returned string. Is there any way to make it not do this?
It like appends the **/ stuff after my returned string. Is there anyway to make it not do this
Yep, that's exactly what it does and it's intentional. Anything before the ** is treated as the base path, anything after is the path that is used when writing the file to the destination directory. (See this answer if you want to know more).
Normally you could use the base option in gulp.src() to change this, but this doesn't really work in your case since you would need one base path for nix/mac and another one for win.
On top of all that you're using gulp.dest() wrong. gulp.dest() specifies the destination directory. You're trying to use it to specify a destination file. That's not possible.
The easiest solution for you is to use gulp-rename:
var path = require('path');
var rename = require('gulp-rename');
gulp.src(['src/exe/**/binary.{exe,out}'])
.pipe(rename(function(file) {
file.dirname = file.dirname.split(path.sep)[0];
}))
.pipe(gulp.dest('dist/exe'));

What is the build step for Junit in Jenkins job?

I am using Jenkins CI to test a Java Project. I already wrote my tests and ran them in Eclipse and everything is fine. However, I don't know what to write in the build step in the Jenkins Job.
My repository is this: (the Junit tests are in TestDFA.java)
D:\GIT\CFLOW
│ Main.java
│ PreProcessor.java
│
├───cflow
│ │ DFA.java
│ │
│ ├───exceptions
│ │ DeadState.java
│ │ InvalidStateException.java
│ │ InvalidTransitionException.java
│ │
│ └───tests
│ TestDFA.java
│
└───libs
junit.jar
I have another Python job and all that I needed to write was "python testDFA.py" but with Java it's very hard
You should try to run your test cases with Maven or with an ant script. There should be a Jenkins plugin for that, or just call ant/maven from a command line build step.