Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Francesco Pira pirafrank

🎯
Focusing
View GitHub Profile
@pirafrank
pirafrank / uninstall_office_2016.sh
Last active May 7, 2023 00:18
Uninstall Office 2016 from OS X completely
View uninstall_office_2016.sh
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo -e "
ROOT PRIVILEDGES NEEDED!
You have to run this script as root.
Aborting...
"
exit 1
else
@pirafrank
pirafrank / Dockerfile
Created April 4, 2023 13:05
vim from jonathonf's PPA in a Docker container
View Dockerfile
FROM ubuntu:focal
ENV DEBIAN_FRONTEND=noninteractive
# explicitly set lang and workdir
ENV LANG="en_US.UTF-8" LC_ALL="C" LANGUAGE="en_US.UTF-8"
USER root
RUN apt-get remove -y vim-runtime gvim vim-tiny \
@pirafrank
pirafrank / open-with-default-application.py
Created August 20, 2015 21:12
Open given file with the default application. Works on Linux, OS X and Windows. On Linux requires xdg-open (usually built-in).
View open-with-default-application.py
import sys
import subprocess
import os
import platform
def open_with_default(path):
current_platform = platform.system()
if current_platform == "Linux":
subprocess.call(["xdg-open", path])
@pirafrank
pirafrank / vim_install.sh
Last active March 18, 2023 12:02
Install vim from source (+python3 +ruby and more) on Ubuntu 20.04 Focal Fossa (GUI options enabled)
View vim_install.sh
#!/bin/bash
# Remove old vim installs
sudo apt-get remove vim vim-runtime gvim vim-tiny \
vim-common vim-gui-common vim-nox gvim
# install vim-gtk deps
sudo apt-get build-dep vim-gtk
# install some more deps
@pirafrank
pirafrank / cloudflareDoH.mobileconfig
Last active August 16, 2022 04:01
iOS, iPadOS and tvOS 14 support MDM profile to set encrypted DNS requests (DNS-over-HTTPS and DNS-over-TLS) on cellular and Wi-Fi connection. To install, open this page from your device and click ‘Raw’ on the one of your choice in the GitHub page. Then continue installation in Settings app. Browse https://1.1.1.1/help after installing to check it
View cloudflareDoH.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>DNSSettings</key>
<dict>
<key>DNSProtocol</key>
@pirafrank
pirafrank / download_entire_website.sh
Last active April 7, 2022 02:52
Quick script that use wget to download an entire website
View download_entire_website.sh
#!/bin/bash
if [[ $# != 2 ]]; then
echo "Error: wrong number of arguments"
echo ""
echo "Usage: ./download-entire-website.sh <domain> <url>"
echo "Example ./download-entire-website.sh websitetodownload.com www.websitetodownload.com/page/"
echo ""
exit -1
fi
@pirafrank
pirafrank / get-lockscreen-wallpapers.ps1
Created January 18, 2022 14:04
Copy Windows 10 lockscreen background images to a subdir of YOURUSERNAME\Pictures. Subdir content will be replaced on each run.
View get-lockscreen-wallpapers.ps1
Copy-Item -Force -Recurse $env:USERPROFILE\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets $env:USERPROFILE\Pictures\LockScreen_Wallpapers
Dir $env:USERPROFILE\Pictures\LockScreen_Wallpapers | rename-item -newname { [io.path]::ChangeExtension($_.name, "jpg") }
explorer $env:USERPROFILE\Pictures\LockScreen_Wallpapers
@pirafrank
pirafrank / aws_lambda_callback_redirect.js
Created January 13, 2022 19:57
callback function to make an HTTP redirect with AWS Lambda
View aws_lambda_callback_redirect.js
callback(null, {
statusCode: 307,
headers: {
Location: 'https://github.com/pirafrank',
}
})
@pirafrank
pirafrank / tasks.json
Created December 18, 2021 02:10
VS Code tasks config for Jekyll
View tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Serve",
"type": "shell",
"command": "bundle exec jekyll s",
"problemMatcher": []
@pirafrank
pirafrank / run_other_teams.ps1
Created November 19, 2021 17:04
Powershell script to open another instance of Microsoft Teams desktop application. This script runs the app as another user, you need to create another local Windows user before running the script. Check the link the comments to find out how. Tested on Windows 10 and Microsoft Teams v1.4.00.29469 (64-bit, last updated on 11/19/2021)
View run_other_teams.ps1
# Read me:
#
# You need to do some setup before running this script.
# Check the link below.
#
# Run this script as admin in powershell.
# By the way if you run it in a standard powershell it will
# prompt to open a new shell as admin.
#