Skip to content

Instantly share code, notes, and snippets.

View pirafrank's full-sized avatar
🎯
Focusing

Francesco Pira pirafrank

🎯
Focusing
View GitHub Profile
@pirafrank
pirafrank / PyObjc Python modules cleaner script
Created August 13, 2015 23:09
Script to clean up from pyobjc-framework Python modules
#!/bin/bash
# Cleaner script for pyobjc-framework python modules
#
# made by Francesco Pira
# fpira.com
# Given "as-is", WITHOUT ANY WARRANTY
#
# Usage:
# chmod +x ./this-script.sh
@pirafrank
pirafrank / get_platform_details.py
Created August 20, 2015 20:59
Get platform details for current OS (print or use as a library). Works with Linux, OS X and Windows.
import sys
import platform as pl
def get_os_release():
if pl.system() == "Darwin":
var = pl.mac_ver()[0] # mac release
elif pl.system() == "Linux":
var = pl.linux_distribution() # which linux distro
elif pl.system() == "Windows":
@pirafrank
pirafrank / Open URL in default browser
Created August 20, 2015 21:02
Open an URL in the default browser. Python snippet.
#!/usr/bin/python
import webbrowser
webpage = 'http://www.google.com'
webbrowser.open_new_tab(webpage)
@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).
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 / ls aliases with coloured output
Last active December 7, 2015 10:14
ls colored output and long list ll alias
# Linux
alias ll='ls -Fhla --color=auto'
alias ls='ls -Fh --color=auto'
# OS X
alias ll='ls -Fhla'
alias ls='ls -Fh'

Keybase proof

I hereby claim:

  • I am pirafrank on github.
  • I am pirafrank (https://keybase.io/pirafrank) on keybase.
  • I have a public key whose fingerprint is 8CE5 6166 AD46 3442 9E3A CF7C 03F3 1E01 C9DC 0E67

To claim this, I am signing this object:

@pirafrank
pirafrank / uninstall_office_2011.sh
Last active November 29, 2016 15:58
Uninstall Office 2011 from OS X completely
#!/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 / uninstall_office_2016.sh
Last active March 21, 2024 14:12
Uninstall Office 2016 from OS X completely
#!/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 / who_is_logged_in.sh
Last active January 9, 2019 13:52
List logged users and how many sessions they have opened.
#!/bin/bash
if [[ $# > 1 ]]; then
echo "Error: wrong number of arguments"
exit -1
else
if [[ $1 == "" ]]; then
while read -r line
do
USER=$(echo $line | awk '{print $2}')
@pirafrank
pirafrank / post_to_GitHub.py
Created January 6, 2016 18:48 — forked from MalphasWats/post_to_GitHub.py
Post to GitHub Pages from Editorial
#coding: utf-8
import keychain
import console
import editor
import time
import re
import requests
import json