Skip to content

Instantly share code, notes, and snippets.

@materro
materro / PerlReferences.md
Created November 18, 2022 12:46 — forked from afair/gist:2402068
Perl References for Kittens

Perl References

Simple Perl variables are called scalars. Examples of scalar values are

   $number      = 123;
   $string      = "String";
   $file_handle = open "<filename";
   $null_value  = undef;
 $instance = MyClass-&gt;new;
@materro
materro / Python 3.11 Install from source.md
Last active July 5, 2024 01:55
Install Python 3.11 from source in local directory on Ubuntu Precise

Install Python 3.11 in local directory on Ubuntu Precise

I needed to install the latest version of Python on an old version of Ubuntu. I succeeded 😊 Below I've written out the instructions on how I realized it.

Dependencies

Run every command as root 🔥

Install required dependencies

apt-get install libffi-dev libgdbm-dev libreadline6-dev liblzma-dev
@materro
materro / Google Python Style Guide.md
Created December 15, 2022 14:18
Google Python Style Guide
@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

@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 / 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 / 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 / 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 / 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 / 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