iTerm2 + tmux integration: reuse previous session's directory - integration

I recently got to know that I can integrate my iTerm2 and tmux. When I was just using tmux, it was possible to reuse the previous session's directory when it comes to making new splits tabs or windows. And after I integrated tmux with iTerm2, it is no longer possible.
I tried to configure the Working Directory setting from iTerm2 Preferences > Profiles > General, and it was not working.
Is there any method to reuse working directory for new session by the already existing session?

Related

Publish Intranet page is using another user's local publish path for the file being changed

Object reference not set to an instance of an object.
When I publish an Intranet page update, I am getting an error that shows a user's local publish path for one of the files instead of using the web path. It isn't even MY local publish path..
When I publish to my local publish location, the file changed doesn't even publish/update locally.
When I run the project, it seems to work the first time (meaning no error), but when I perform that same task a subsequent time, this is when I get the Object reference error.
How can I fix the project/solution in order to hit the file/code I've changed?
We are using C#, ASP.NET core, Visual Studio 2019, on Windows 10.
I've tried cleaning and rebuilding, deleting upon build, restarting Visual Studio, restarting my system, get latest, undo checkout and start over.
Was replacing just the one aspx file I made code changes to.
Must replace the entire project of files after Publish, not just the select files you (think) you've worked on. Changes are made to files behind and beyond the targeted file(s).
Publish locally, backup Prod files, copy local files to Prod server, Voila!

Console command for opening files inside already opened project in PhpStorm

I've faced the problem. I use PhpStorm to edit files from FTP server using WinSCP client. In WinSCP client I've set command for using external editor. So, when I try to open php-file from remote FTP server WinSCP downloads this file in temporary file and open it using command provided by me - "C:\Program Files\JetBrains\PhpStorm 2020.1.1\bin\phpstorm64.exe" "!.!"
Earlier, when I used PhpStorm 2019 or 2018, it opened file in already opened window/project. But when I've upgraded to PhpStorm 2020, it started to open file from FTP in separate windows. It's so annoying and some functionality doesn't work in such case (auto suggestions and others).
I know that I can use built-in remote files browser within PhpStorm to view and edit remote files, but I accustomed to use separate FTP client for such purposes.
Does somebody know how to fix this problem? What console command should I use so as to open separate file in already opened window/project?
It's a LightEdit mode: https://blog.jetbrains.com/idea/2020/04/lightedit-mode/
Since 2020.2 you can use the -p (--project) option instead to force opening files in already opened project windows. For example idea -p myfile.txt. IDEA-237118
You can also permanently disable that mode by following these steps:
Invoke Help | Find Action... (or via Search Anywhere: use Double Shift and switch to Actions tab)
Search for Registry... action and select it
Once in the Registry dialog locate light.edit.file.open.enabled entry (just start typing, speed search will narrow it down) and set it to false (uncheck the box).
Not sure if IDE restart is needed (probably not).

How to create a Chrome profile programmatically?

Development, testing, staging environments are controlled via different proxy servers in my setup. I want to script creation of multiple Chrome profiles (sometimes called "user" or "person") and connect to a different proxy server for each of them. Finally I want to share this script with colleagues so that they have access to the exactly same setup.
The latter can be done via scripted installation of extensions such as Falcon Proxy or Proxy Helper to the Chrome profile. I would like to know how to script creation of the different profiles.
A profile is a folder inside ~/.config/google-chrome (Linux, ~/Library/Application Support/Google/Chrome (Mac OS X) and %USERPROFILE%\AppData\Local\Google\Chrome\User Data (Windows). But how to create and initialize one? Where do I register the new profile?
Creating a user
The following example applies to Windows, but the basic procedure should be the same.
First, change to the UserData folder in your Chrome installation:
cd "%APPDATA%\..\Local\Google\Chrome\User Data"
This method will copy the current user as a template for the new user. If the new user should be blank, you need to delete (CTRL + SHIFT + DEL the current browser data).
Now create a new user:
mkdir NewUser && copy Default NewUser
Change your directory to the chrome installation:
cd "C:\Program Files (x86)\Google\Chrome\Application"
Factory-Reset all user parameters:
chrome.exe --user-data-dir="..\User Data\NewUser" -first-run
where --user-data-dir is the path (full or relative) to the previously created NewUser directory.
Running as NewUser
To run chrome again using this profile, simply run chrome without the -first-run flag.
From this documentation, I finally found a way to create a user/person, rather than a separate profile. The difference is especially important in Mac OS X since different profiles can be opened concurrently using the same Chrome process.
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --profile-directory="StagingEnv" --first-run
The only unfortunate fact is that this new person doesn't inherit the name from the profile directory. Instead, it is always called Person X where X is an increment number.
I need to go to the Local State file to change it.
grep -o '"StagingEnv":{[^}]*}' ~/Library/Application\ Support/Google/Chrome/Local\ State
"StagingEnv":{"active_time":1437709453.172762,"avatar_icon":"chrome://theme/IDR_PROFILE_AVATAR_6","background_apps":false,"is_ephemeral":false,"is_omitted_from_profile_list":false,"is_using_default_avatar":true,"is_using_default_name":true,"managed_user_id":"","name":"<b>Person 3</b>","user_name":""}
This file is overridden when Chrome quits, so I need to kill Chrome, change the file and run Chrome again.
I think the easiest way to create multiple chrome profile is
On your computer, open Chrome.
At the top right, click Profile.
Click Manage people.
Click Add person.
Choose a name and a photo/picture.
Select Create a short cut on the desktop.
Click Save. A new window will open and ask you to turn on sync which is
optional.
By this, each chrome profile will be created and you can check on C:\Users\youname\AppData\Local\Google\Chrome\User Data.

Can Jenkins store artifacts outside the job directory?

I currently have Jenkins set up with a number of jobs, but it's proving difficult to back up because the artifacts are stored within the job directory. I'd like to back up the job configurations and artifacts separately. I'm sure I remember reading somewhere that Jenkins now has an option to store them outside the job, but I can't find this.
Is there any configuration option that does this while still making the artifacts visible from within the job on the Jenkins interface? (ie rather than merely an add-in that copies the artifacts elsewhere)
Go to your jenkins configuration page, e.g.
http://mybuildserver.acme.com/configure
At the top of the configuration page there is a "home directory" setting. Click the "advanced..." button below it.
Now set the "Workspace Root Directory" to e:\jenkins-workspaces\${ITEM_FULL_NAME}, and "Build Record Root Directory" to e:\jenkins-builds\${ITEM_FULL_NAME} or something similar.
Warning: I run Jenkins 2.7.2 and noticed that certain features don't work properly after configuring Jenkins like that. I saw problems with folders and problems with the multi-branch project plugin. Check the status of those issues if your rely on these features.
As you can see here, there are many plugins to deploy artifacts anywhere you want/need, on FTP, CIFS, Confluence, Artifactory.... especially the ArtifactsDeployer that will allow you to make a copy of the artifacts in the Jenkins Home.
Thank you Sam, for your post, which directed me into the right direction to solve my problem.
Have been searching for a way on how can I make a symlink to the Job-Archive of a build for multibranch projects. Up to now, we used to manually search for the correct folder basename in the filesystem and added that one to the Jenkinsfile.
Now, I can simply use
jobOutputFolder = currentBuild.rawBuild.artifactsDir.path
and use that in my script.
If security is a concern, I could implement that as a shared library additionally.
Try the Use Custom Workspace build option. From the Jenkins popup help:
For each job on Jenkins, Jenkins allocates a unique "workspace
directory." This is the directory where the code is checked out and
builds happen. Normally you should let Jenkins allocate and clean up
workspace directories, but in several situations this is problematic,
and in such case, this option lets you specify the workspace location
manually.
This option is also available under advanced project properties of multi-configuration project builds.
A groovy script under "Prepare an environment for the run" will always run on the master, and this groovy script can create a symlink to where you really want artifacts archiving to archive_to which SHOULD include the job name and build number:
if (! Files.createSymbolicLink(Paths.get(currentBuild.artifactsDir.path),
Paths.get(archive_to.getCanonicalPath()))) {
throw new RuntimeException("Can't create symlink to archive dir")
}
Of course (sadly) when old builds are purged by Jenkins the old artifacts are left because jenkins will not follow a symlink when purging, even if jenkins owns the symlink and the target (shame).
I workaround for that may be to point a symlink back from the new archive dir, then, when jenkins purges it's archive dir, the new symlink will dangle and a cron job can then later delete the new job archive dir
Copy Artifact Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin) adds a build step for retrieving files from another project's workspace to current and work from there.

run jenkins as user "hudson"

we've updated hudson to jenkins and have a few dependencies upon the "hudson" user we used to have.
Now that we have jenkins running (works fine) we'd like it to run as the user "hudson" in order to keep our other processes intact without having to rewrite them.
We found instructions on how to do this BEFORE installing jenkins, but we're already past that point. Jenkins is installed and up and running. Is there a way to let jenkins run as the user "hudson"?
We are running CENTOS
Jenkins usually runs with it's own user, so there are two main issues to handle:
Make sure user 'hudson' has full access to the files of user 'jenkins' (or whatever user it was set to run as).
Start the Jenkins-daemon (or other initiator) with the 'hudson' user.
(another approach is to change the user-ID so it is actually the same user but with two names)
Good luck!
If you've installed Jenkins from RPM, there should be an /etc/sysconfig/jenkins file with a JENKINS_USER setting that defaults to 'jenkins' that you can change to 'hudson'.
I second Gonen's comment above about making sure you change the ownership of the 'jenkins' owned files to 'hudson'. Don't forget about the /var/log/jenkins logs.
Also don't forget to restart the Jenkins service after updating the files.