Skip to content

Instantly share code, notes, and snippets.

View pirafrank's full-sized avatar
⚙️
building Rusty things for no apparent reason...

Francesco Pira pirafrank

⚙️
building Rusty things for no apparent reason...
View GitHub Profile
@pirafrank
pirafrank / reset_rails_app.sh
Last active April 4, 2016 08:55
reset/update script to deploy a new stable version of a rails 4.x app served by Puma
#!/bin/bash
# reset/update script to deploy a new stable version of a rails 4.x app served by Puma.
### REQUIREMENTS ###
# this script makes use of another script, 'pumascript'.you can find it in my gists.
# http://gist.github.com/pirafrank
# this script assumes RAILS_ENV is set to 'production' on your server.
@pirafrank
pirafrank / version_compare.js
Created February 25, 2016 00:40 — forked from TheDistantSea/version_compare.js
Function to compare two version strings (e.g. "1.6.1" is smaller than "1.7"). Developed in order to answer http://stackoverflow.com/a/6832721/50079.
/**
* Compares two software version numbers (e.g. "1.7.1" or "1.2b").
*
* This function was born in http://stackoverflow.com/a/6832721.
*
* @param {string} v1 The first version to be compared.
* @param {string} v2 The second version to be compared.
* @param {object} [options] Optional flags that affect comparison behavior:
* <ul>
* <li>
@pirafrank
pirafrank / libvips-installer.sh
Created February 3, 2016 22:42 — forked from h2non/libvips-installer.sh
libvips 7.42.x cross-platform simple installer script (supports OSX, Debian, Ubuntu, CentOS, Fedora, Amazon Linux)
#!/bin/sh
#
# Orinally made by Lovell Fuller for sharp
# https://github.com/lovell/sharp
#
# Usage:
# curl -s https://gist.githubusercontent.com/h2non/89bb2f87c6499d0b25f1/raw/bf3d0743107f02f5db2b93c53f7f0e07a1c33112/libvips-installer.sh | sudo bash -
#
@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
@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 / uninstall_office_2016.sh
Last active April 23, 2025 18:45
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 / 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

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 / 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'
@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])