Skip to content

Instantly share code, notes, and snippets.

@antoniocampos
antoniocampos / HowTo.md
Created October 9, 2024 21:05
PowerShell Change Network to Private

Open PowerShell as administrator and execute

Get-NetConnectionProfile

Copy the Name and replace in the following line

Set-NetConnectionProfile -Name "Your Network Name" -NetworkCategory Private
@antoniocampos
antoniocampos / ClearSquidCache.sh
Created July 18, 2024 10:51
Clear and Recreate Squid Cache
#!/bin/bash
echo " "
echo "https://gist.github.com/antoniocampos"
echo " "
echo " "
/etc/init.d/squid stop
rm -rf /var/spool/squid
mkdir /var/spool/squid/
chown proxy:proxy /var/spool/squid/
squid -z
@antoniocampos
antoniocampos / RecoverWinKey.sh
Last active July 18, 2024 10:48
Linux Get Windows Key Saved in UEFI
#!/bin/bash
echo " "
echo "https://gist.github.com/antoniocampos"
echo " "
echo " "
echo "You key bellow: "
echo " "
strings /sys/firmware/acpi/tables/MSDM
echo " "
dmidecode | grep -A8 'System Information' | grep -i UUID | awk '{print $2}'
@antoniocampos
antoniocampos / Gerar.cmd
Last active June 28, 2023 20:49
Generate UBL-ApplicationResponse-2.1 c# class
xsd maindoc\UBL-ApplicationResponse-2.1.xsd common\UBL-CommonAggregateComponents-2.1.xsd common\UBL-CommonBasicComponents-2.1.xsd common\UBL-CommonExtensionComponents-2.1.xsd common\UBL-QualifiedDataTypes-2.1.xsd common\UBL-UnqualifiedDataTypes-2.1.xsd common\CCTS_CCT_SchemaModule-2.1.xsd /classes /namespace:UBL_ACAMPOS /nologo /order
@antoniocampos
antoniocampos / AddToYour.ovpn
Last active January 27, 2023 12:11
Solve problems accessing a windows domain or apply group policies on a client using OpenVpn
; add this lines to your .ovpn
; replace x.x.x.x with your local dns servers (the server that "know" the domain)
dhcp-option DNS x.x.x.x
dhcp-option DNS x.x.x.x
; replace antoniocampos.net by your local domain
dhcp-option DOMAIN antoniocampos.net
dhcp-option ADAPTER_DOMAIN_SUFFIX antoniocampos.net
; more important!!
block-outside-dns
@antoniocampos
antoniocampos / Install.sh
Last active January 27, 2023 12:11
Debian 10 install and configure Microsoft SQL Server 2019 and tools
apt install curl apt-transport-https gnupg
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/debian/10/prod.list | tee /etc/apt/sources.list.d/msprod.list
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | tee /etc/apt/sources.list.d/msprod.list
apt-get update
apt-get install -y mssql-server mssql-tools unixodbc-dev
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
source ~/.bashrc
/opt/mssql/bin/mssql-conf setup
# follow the steps!
@antoniocampos
antoniocampos / readme.md
Last active January 27, 2023 12:11
Python validar SAF-T_PT 1.04_01
  • Se ainda não tens... instala o python https://www.python.org/downloads/

  • depois fazes download do ficheiro validar.py

  • e também do saftpt1.04_01.xsd

  • mete ambos numa pasta

  • para ser mais simples arrasta o ficheiro do saft para cima do validar.py

  • o processo de validação vai iniciar, caso haja algum erro aparece o motivo do erro e o valor com erro!

@antoniocampos
antoniocampos / install.net
Created March 12, 2020 15:38
Debian Install .net core 3.1
apt install gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/10/prod.list
mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
chown root:root /etc/apt/sources.list.d/microsoft-prod.list
apt-get update
apt-get install apt-transport-https
apt-get update
@antoniocampos
antoniocampos / debian10+apache2+mariadb+php
Created March 12, 2020 14:56
Debian 10 Install Apache2 + Mariadb + PHP
# install apache
apt-get install apache2
# install MariaDB
apt install mariadb-server
# configure MariaDb root Password
mysql_secure_installation
# install php and configure apache
apt install php libapache2-mod-php php-gd php-mysql php-pear libgd-tools
@antoniocampos
antoniocampos / MyService.service
Last active March 29, 2024 16:44
.net Core Systemd Service Example (Linux autostart you .net app)
[Unit]
Description=MyService Description
[Service]
WorkingDirectory=/path/to/app/
ExecStart=/usr/bin/dotnet /path/to/app/App.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT