Skip to content

Instantly share code, notes, and snippets.

View giordanocardillo's full-sized avatar
😎
Always improving

Giordano Cardillo giordanocardillo

😎
Always improving
View GitHub Profile
@giordanocardillo
giordanocardillo / README.md
Last active April 25, 2024 15:16
Setting nano as default editor

How to

Automatically

cat <<EOF >>~/.bash_profile
export VISUAL="nano"
export EDITOR="nano"
EOF
@giordanocardillo
giordanocardillo / README.MD
Last active March 31, 2024 09:48
Remove Office 2016 Product Key
  1. Open a command prompt as Administrator
  2. In the command prompt, type the following:
  • Office 2016 (32-bit) on a 32-bit version of Windows

    cscript "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" /dstatus

  • Office 2016 (32-bit) on a 64-bit version of Windows

    cscript "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" /dstatus

  • Office 2016 (64-bit) on a 64-bit version of Windows

@giordanocardillo
giordanocardillo / install-pdf2htmlEX-ubuntu-14.04.sh
Last active April 27, 2022 19:21
Installing pdf2htmlEX on Ubuntu Server 14.04
#!/bin/sh
RESTORE=$(echo '\033[0m')
BOLD=$(echo '\033[1m')
GREEN=$(echo '\033[1;32m')
echo
echo ${GREEN}
echo "------------------------------"
echo " Installing prerequisites "
echo "------------------------------"
echo
@giordanocardillo
giordanocardillo / README.md
Last active March 23, 2022 22:05
Restore Table spt_values

The table sys.spt_values is in the ressources database (mssqlsystemresource). This database is only accessible when the SQL Service is started in single user mode..

To re-create the view to do the following steps:

  1. Stop all MSSSQL Service

  2. Start the SQL Service in single user mode: Open a DOS Command prompt and start the sqlservice with the -m switch

"C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Binn\sqlservr.exe" -m

@giordanocardillo
giordanocardillo / template.yaml
Created February 9, 2022 10:50
CloudFormation S3 bucket + SSL + CloudfFront distribution + OAI
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
BucketName:
Type: String
AllowedPattern: '^[A-Za-z0-9-]*$'
ConstraintDescription: 'Must be a valid S3 bucket name'
Description: 'Input the bucket name you want to create'
CloudFrontDistributionCNAME:
Type: String
Description: 'Input the CloudFront distribution CNAME'
@giordanocardillo
giordanocardillo / README.md
Last active January 12, 2022 19:36
Codepipeline - Delete EKS pod

Lambda helper function to remove a running POD

Lambda function to remove a running POD from EKS cluster and allow the matching deployment to run it again, updating it.

Thia allows microservice updating after a codepipeline run.

It uses the awscli because the get-token command is not available in boto3 library.

Requirements

@giordanocardillo
giordanocardillo / string-calculator.js
Last active February 11, 2021 06:02
String Calculator Kata in JS
const calculator = (function(){
function add(numberString){
if (numberString === ''){
return 0
}
const delimiter = getDelimiter(numberString)
const formattedInput = formatInput(numberString)
return calculateSum(getNumbers(formattedInput, delimiter))
@giordanocardillo
giordanocardillo / spinner.sh
Last active November 26, 2020 10:14
Bash Spinner
#/bin/sh
spinner=(" " "1 " "10 " "101 " " 010" " 01" " 0")
spinner_length=${#spinner[0]}
function spin() {
tput cuf "$spinner_length"
while [ 1 ]; do
for i in "${spinner[@]}"; do
tput cub "$spinner_length"
@giordanocardillo
giordanocardillo / Install vsftpd with virtual users on Ubuntu 14.04.md
Last active November 18, 2020 19:23
Install vsftpd with virtual users on Ubuntu 14.04

With a bit of playing around I've managed to come up with a semi solution (not perfect but good enough)

using 2707974 answer and information I've gained else where I've been able to get what I need.

First you need vsftp and PAM installed

apt-get install vsftpd libpam-pwdfile apache2-utils

Edit /etc/vsftpd.conf

@giordanocardillo
giordanocardillo / README.md
Last active August 12, 2020 09:47
Focus Trapper - How to trap focus inside an element

FocusTrapper

A simple method to "trap" tabbing inside an element

Usage

const trapper = new FocusTrapper(element)
trapper.trap() // To trap focus
trapper.untrap() // To release