git config --global credential.helper 'cache --timeout=3600'
this prevents having to re-enter credentials during every interaction when using an HTTPS clone
Nik the plumber
Not a blog about plumbing, or Super Mario, but in fact a series of posts about technology, IT and a few other things.
Search This Blog
Friday, 21 February 2020
Git credential helper
Cache git credentials in memory for 1 hour
Git reset
Overwrite local uncommitted changes from origin
...or on a single line:
OPTIONAL: save current branch state before reset:
git fetch origin
git reset --hard origin/master
...or on a single line:
sudo git fetch origin && sudo git reset --hard origin/master
OPTIONAL: save current branch state before reset:
git commit -a -m "Safe copy"
git branch aSafeCopy
VSCode debug configuration for Python Flask /.vscode/launch.json
The first section "Python: Flask API" runs the Flask devServer
The second section "" runs a simple Python app (in this case, the consumer of the service)
The second section "" runs a simple Python app (in this case, the consumer of the service)
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask API",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "api/devServer.py",
"FLASK_ENV": "development",
"FLASK_DEBUG": "0"
},
"args": [
"run",
"--no-debugger",
"--no-reload",
"--port", "8080",
"--host", "0.0.0.0"
],
"jinja": true,
"cwd": "C:\\Work\\api"
},
{
"name": "Python: main.py",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}\\myApp\\main.py",
"cwd":"${workspaceFolder}\\monitor\\"
}
]
}
Tuesday, 10 December 2019
Cmder for SSH to server
Task parameters
/icon %CMDER_ROOT%\icons\cmder_red.ico
Commands
cmd /c "%ConEmuDir%\..\git-for-windows\usr\bin\ssh yourLogin@192.168.88.105" -new_console:d:%USERPROFILE% "-new_console:t:ubuntu-server1"
(this is a single command)
/icon %CMDER_ROOT%\icons\cmder_red.ico
Commands
cmd /c "%ConEmuDir%\..\git-for-windows\usr\bin\ssh yourLogin@192.168.88.105" -new_console:d:%USERPROFILE% "-new_console:t:ubuntu-server1"
(this is a single command)
Git squash
Start with git status to check you don't have anything to commit.
git reset --soft OLDEST_COMMIT_TO_INCLUDE_IN_SQUASH
git commit -m 'Squashed lots of commits'
git push --force origin master
This will squash all commits between OLDEST_COMMIT_TO_INCLUDE_IN_SQUASH and the LATEST commit and replace them with a single commit with the comment Squashed lots of commits This is re-writing history so avoid this if anyone else might has cloned or pulled your repo.
This will squash all commits between OLDEST_COMMIT_TO_INCLUDE_IN_SQUASH and the LATEST commit and replace them with a single commit with the comment Squashed lots of commits This is re-writing history so avoid this if anyone else might has cloned or pulled your repo.
Wednesday, 18 September 2019
Fing for Windows
Find a device IP on my LAN by mac (DHCP table works too)
(.\fing.exe -n 192.168.1.0/24 -r 1) | Select-String -Pattern '\| (.*?)2C:54'
2C:54 is the start of the known mac address
(.\fing.exe -n 192.168.1.0/24 -r 1) | Select-String -Pattern '\| (.*?)2C:54'
2C:54 is the start of the known mac address
Monday, 16 September 2019
Install Azure Powershell module
Investigate if PowerShell is installed
Install Azure module (all operating systems)
For Windows, NuGet update may be required, and execution policy may be required
Update module
Use Module
Get-Module | ? {$_.Name -match "PowerShell"}
Install Azure module (all operating systems)
Install-Module Az -AllowClobber
For Windows, NuGet update may be required, and execution policy may be required
Set-ExecutionPolicy RemoteSigned
Update module
Update-Module -Name Az
Use Module
Import-Module Az
Connect-AzAccount
Subscribe to:
Posts (Atom)