Skip to content

Instantly share code, notes, and snippets.

@materro
materro / Download-large-protected-GDrive-PDF.md
Created October 18, 2024 10:27
Download large protected PDF from GDrive

1. Load patched jsPDF

Copy source from custom laucheukhim jsPDF repository and just paste it to the Dev Console.

2. Run command

const { jsPDF } = window.jspdf;

3. Paste function

@materro
materro / User-Agent Switcher for Chrome - Updated agents.json
Created November 30, 2023 11:35
Designed for „User-Agent Switcher for Chrome” extension © Ujesh Krishnan https://ujesh.com/user-agent-switcher-chrome-extension/
{"UserAgents":[{"append_to_default_ua":false,"badge":"","getUserAgentString":{},"group":"Chrome","is_managed":false,"is_preset":true,"key":"c_1","show_in_list":false,"title":"Default","ua_string":"","vendor":""},{"append_to_default_ua":false,"badge":"CAM","getUserAgentString":{},"group":"Chrome","is_managed":false,"is_preset":false,"key":"c_15","show_in_list":false,"title":"Chrome - Android Mobile","ua_string":"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Mobile Safari/537.36","vendor":"Google"},{"append_to_default_ua":false,"badge":"CAM High","getUserAgentString":{},"group":"Chrome","is_managed":false,"is_preset":false,"key":"c_16","show_in_list":false,"title":"Chrome - Android Mobile(high-end)","ua_string":"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Mobile Safari/537.36","vendor":"Google"},{"append_to_default_ua":false,"badge":"CAT","getUserAgentString":{},"group":"Chrome","is_managed":fal
@materro
materro / Reset-Microsoft-Account-Strong-Authentication-Methods.ps1
Created November 3, 2023 15:19
Reset strong authentication methods using powershell module MSOnline
Import-Module MSOnline
$securePassword = ConvertTo-SecureString -String $adminPassword -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $adminUpn, $securePassword
Connect-MsolService -Credential $cred
Set-MsolUser -UserPrincipalName $userUpn -StrongAuthenticationMethods @()
@materro
materro / G-as-Git-Command-Shortcut.ps1
Created October 31, 2023 21:02
Simply type `g status` instead of `git status` in Windows Powershell
function handleGit {
param (
[Parameter(
Mandatory=$true,
ValueFromRemainingArguments=$true)]
[string[]]$args
)
git $args
}
Set-Alias g handleGit
@materro
materro / Activate-Office-VPN-KMS.ps1
Last active October 16, 2023 10:53 — forked from ALiangLiang/vpn.ps1
Connect to VPN and activate Office using KMS
param([switch]$elevated)
# 💡 Enter your VPN and KMS server addresses:
$VPN_ADDRESS = 'vpn.address.com'
$KMS_ADDRESS = 'kms.address.com'
$OFFICE_DIR = 'C:\Program files\Microsoft Office\Office16\'
# 👏 Based on:
# https://gist.github.com/ALiangLiang/b66bc6eaeab420a5ff0c2b934c15451e
# https://superuser.com/questions/108207/how-to-run-a-powershell-script-as-administrator
@materro
materro / MS-SQL-Server-Backup.ps1
Created June 2, 2023 11:46
MS SQL Server backup script in Powershell
# Configure the MS SQL Server
$backupRootFolder = "C:\Backup"
$mainDbName = "DATABASE-NAME"
$serverName = "SERVER-NAME"
$daysOfBackup = 7
$queryTimeout = 120
$dayOfFullBackup = 'Friday'
# Main script
$dayOfWeek = (Get-Date).DayOfWeek
@materro
materro / PostgreSQL-x64-ODBC-Linked-Server-MS-SQL.md
Created May 8, 2023 13:55
Link PostgreSQL 8.1 to MS SQL Server 2019 using ODBC x64

This instruction provide steps to install and configure 64-bit ODBC driver for old version of PostgreSQL, setup a linked server connection in Microsoft SQL Server Management Studio, and run a sample SQL query. It includes downloading and installing the ODBC driver, configuring a new connection, setting advanced options, setting up the provider, creating a linked server connection, and running a SQL query to retrieve data from PostgreSQL.

1. Install ODBC

Download and install psqlodbc_09_05_0400-x64.zip from PostgreSQL ODBC drivers.

2. Configure ODBC

2.1 Add new connection

  1. Open ODBC Data Source Administrator (64-bit) %windir%\system32\odbcad32.exe
@materro
materro / Consolas Nerd Font.md
Created March 23, 2023 10:05
Generate Consolas Nerd Font

Create Consolas Nerd Font using Font Pather

  1. Download Font Patcher and extract it. You will need font-patcher script.
  2. Copy Consolas font from C:\Windows\Fonts.

    You will get (probably) 4 files: consola.ttf, consolab.ttf, consolai.ttf, consolaz.ttf.

  3. Install required dependencies (Ubuntu):
apt-get install python3-fontforge
  1. If You will get ValueError: not enough values to unpack (expected 3, got 2) edit font-patcher to fix it.
@materro
materro / generate_uuid_v6.sql
Last active March 15, 2023 14:12 — forked from fabiolimace/UUIDv6.sql
Function for generating time-ordered UUIDs (UUIDv6) on PostgreSQL 8+
/**
* Returns a time-ordered UUID (UUIDv6).
*
* Tags: uuid guid uuid-generator guid-generator generator time order rfc4122 rfc-4122 postgres postgres8
*/
CREATE OR REPLACE FUNCTION generate_uuid_v6() RETURNS VARCHAR(36) AS
$$
DECLARE
v_time TIMESTAMP WITH TIME ZONE;
@materro
materro / Git on Focal.md
Last active December 27, 2022 11:52
Install newer version of Git on Ubuntu Focal

Step by step guide for installing newer version of Git on Ubuntu Focal 20.04

1. Check current version

$ git --version
git version 2.25.1

2. Add git-core repository to package manager