Skip to content

Instantly share code, notes, and snippets.

Francesco Pira pirafrank

Block or report user

Report or block pirafrank

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pirafrank
pirafrank / youtube-uploader-cli.sh
Created Nov 14, 2016
Quick script to automate video upload from CLI to YouTube. Replace 'francesco' with your own username.
View youtube-uploader-cli.sh
#!/bin/bash
# Quick script to automate video upload from CLI to YouTube.
# More info and requirements at https://github.com/tokland/youtube-upload
# BEFORE starting: replace 'francesco' with your own username to make it work!
if [[ $# != 3 ]]; then
echo "Error: wrong number of arguments. It should be 3, you put $#."
echo "Usage: ./youtube-uploader-cli.sh [video title] [video path] [public | unlisted | private]"
exit -1
@pirafrank
pirafrank / git_install.sh
Created Oct 22, 2016
Easy script to download, compile and install Git. Tested in Debian 7 and 8.
View git_install.sh
#!/bin/bash
# user vars
GIT_VERSION="2.9.1"
# script vars
WORKDIR="/tmp/git_temp"
CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# the actual script
@pirafrank
pirafrank / fpira.com_static_S3_backup_and_deploy.sh
Last active Jan 9, 2019
Backup and deploy to Amazon S3 static resources of my website (fpira.com)
View fpira.com_static_S3_backup_and_deploy.sh
#!/bin/bash
# crontab entry
# 0 0 * * * /bin/bash /home/francesco/fpiracom_static_backup.sh > /dev/null 2>&1
#
# variables
#
ENV_PATH="/home/francesco/Code/awscli_lisa" # path to your virtualenv with awscli module
View jekyll-and-liquid.md

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@pirafrank
pirafrank / jekyllfy.py
Last active Jun 21, 2017
Pythonista script to replace custom domain urls with site.baseurl in jekyll posts.
View jekyllfy.py
#! python2
#
# Pythonista script to replace custom domain urls with site.baseurl in jekyll posts.
# Usage: from a text editor app, share text to this script. It will return 'jekyllfied'
# text in another share popup. See it in action:
#
# @Author
# Francesco Pira (dev at fpira dot com)
#
@pirafrank
pirafrank / search.html
Created Aug 19, 2016 — forked from flohei/search.html
An example search page for Jekyll running the jekyll-lunr-js-search plugin.
View search.html
---
layout: default
permalink: /search/
---
<!--
http://10consulting.com/2013/03/06/jekyll-and-lunr-js-static-websites-with-powerful-full-text-search-using-javascript/
-->
<div class="home">
@pirafrank
pirafrank / gen_index.py
Last active Jan 22, 2018
generate index.html with links to files in the same folder. Use case: access files in a folder (e.g. dir with PDFs files) from browser and avoid turning directory listing on in your webserver.
View gen_index.py
#!/usr/bin/env python2
#################################################################
#
# index generator
# generate index.html with links to files in the same folder
#
# use case: access files in a folder (e.g. dir with PDFs files)
# from browser and avoid turning directory listing on in your
# webserver.
@pirafrank
pirafrank / jekyllfy_image_urls.sh
Created Jul 10, 2016
Script to 'jekyllfy' url images. Replaces your website url with {{site.baseurl}}. Useful when you want to preview your images in editor (iA Writer?) before committing markdown files to repo. sed command is compatible with OS X version of sed.
View jekyllfy_image_urls.sh
#!/bin/bash
if [[ $# != 1 ]]; then
echo "Error: you need to pass the path where markdown file are!"
echo "Usage: ./jekyllfy_image_urls.sh [path]"
exit 1
fi
# changing urls... (this edit in place creating NO backup files!)
find "$1" -name "*.md" -exec sed -i '' 's#http://your.website.com#{{site.baseurl}}#g' {} \;
@pirafrank
pirafrank / install_latest_php_raspberrypi.sh
Last active Nov 1, 2016
install the PHP version you want on Raspbian. Tested with 5.5 and 5.6. It may work for PHP 7.x, too.
View install_latest_php_raspberrypi.sh
#!/bin/bash
# credits: http://stackoverflow.com/questions/31280912/how-to-install-php-5-6-on-raspbian-wheezy
### VARIABLES ###
# type here the specific php 5.x version you want to install
PHP_VERSION="5.6.20"
### SCRIPT ###
@pirafrank
pirafrank / reset_rails_app.sh
Last active Apr 4, 2016
reset/update script to deploy a new stable version of a rails 4.x app served by Puma
View reset_rails_app.sh
#!/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.
You can’t perform that action at this time.