Skip to content

Instantly share code, notes, and snippets.

View juanonsoftware's full-sized avatar

Juan on Software juanonsoftware

  • Rabbit Software
  • Vietnam
View GitHub Profile
@juanonsoftware
juanonsoftware / ATMAMAS MT5 BOT.txt
Created December 14, 2023 02:02
ATMAMAS MT5 BOT
Autotrading bot
@juanonsoftware
juanonsoftware / Git-Submodule
Last active November 22, 2023 02:22
Git Submodule practices
To add other repos as submodules in an existing git repo
1. Create a public repo for submodule https://github.com/juanonsoftware/PocGitAsPublicSubmodule, with some content.
2. Checkout the main public repo https://github.com/juanonsoftware/PocGitWorkflows
3. Run a command to add the child-repo as a submodule
git submodule add -f https://github.com/juanonsoftware/PocGitAsPublicSubmodule.git PublicSubmodule
@juanonsoftware
juanonsoftware / deploy docker containers and self-hosted runners
Last active November 20, 2023 05:32
Configure Self-hosted Runners & Deploy from Docker Hub
Trigger a build from Github Actions, then deploy an application running in Docker on our "Laptop".
Add a self-hosted runners and execute scripts to deploy docker containers
1. Go to repo settings to add new hosted runner
2. Config the runner (Windows)
3. Create a new workflow yml file & job to use the configured runner
@juanonsoftware
juanonsoftware / Working with GIT
Last active November 17, 2023 09:00
Poc GIT workflows
1. Create a git repo https://github.com/juanonsoftware/PocGitWorkflows
2. In Windows, create a folder D:\Dev\PocGitWorkflows
3. Open the Terminal and do the following on that folder:
- git init -> to init an empty git repo
- create a txt file called Readme.txt
- git add -A -> to add all changes from tracked / untracked files
- git commit -m "First commit in the repo" -> commit for the first time
- git remote add origin https://github.com/juanonsoftware/PocGitWorkflows.git -> to add a remote
-> git push -u origin master -> to push the local branch to remote repo
3. Now refresh https://github.com/juanonsoftware/PocGitWorkflows to see the new file available on github
@juanonsoftware
juanonsoftware / Use winget to install software
Last active November 17, 2023 09:00
Use winget to install new application on Windows 11
Details of the package manager -> https://learn.microsoft.com/en-us/windows/package-manager/winget/
1. Search for packages
- winget search git -> to search for packages containing "git"
2. From the output, I can see TortoiseGit. Its id is TortoiseGit.TortoiseGit
3. Run install command to install this app
- winget install TortoiseGit.TortoiseGit -> winget will download the app and display a confirmation to install
4. Now it's ready to use, right click on a folder / show more to see git menus
@juanonsoftware
juanonsoftware / CD with Github Actions
Last active November 17, 2023 08:59
Poc Github Actions deployments
Deploy a product from Github Actions
1. Go to repository settings
2. Add Environments and set the variables
@juanonsoftware
juanonsoftware / Setup-MultiRoles-Web+Database.p1
Last active August 2, 2023 04:37
Scripts to install packages for a multi roles server (Webserver with IIS & .NET and Database server with SQL Server 2014)
# 1. Setup IIS
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer
Install-WindowsFeature -Name "Web-CertProvider"
Install-WindowsFeature -Name Web-Asp-Net45
# 2. Setup Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# 3. Setup Net 6 & IIS extensions
# 3.1. NET6
@juanonsoftware
juanonsoftware / System Design.md
Created November 9, 2022 09:55 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@juanonsoftware
juanonsoftware / sql-get-all-locks.sql
Last active January 26, 2022 17:33
A script to list all current locks in SQL server
-- With SQL
select handle.text as sql, * from
(
select DB_NAME(dbid) as dbname, *
from master.dbo.sysprocesses
where blocked <> 0
union
@juanonsoftware
juanonsoftware / Kill-sql-locks
Created April 12, 2018 09:43
Kill blocking processes on a database
--- Kill blocked processes on a database
DECLARE @databasename nvarchar(50)
SET @databasename = N'Datbase_Name'
-- SET @databasename = DB_NAME()
DECLARE @Sql varchar(max)
SET @Sql = ''
SELECT @Sql = @Sql + 'Kill ' + Convert(varchar, SPId) + ';'
FROM master.dbo.sysprocesses