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 / .lftp.mockup.rc
Created December 10, 2016 12:05 — forked from gaubert/.lftp.mockup.rc
~/.lftp.rc parameters detailed
########## SETTINGS
# On startup, lftp executes ~/.lftprc and ~/.lftp/rc. You can place aliases and 'set' commands
# there. Some people prefer to see full protocol debug, use 'debug' to turn the debug on.
# Certain commands and settings take a time interval parameter. It has the format Nx[Nx...], where N is time amount
# (floating point) and x is time unit: d - days, h - hours, m - minutes, s - seconds. Default unit is second. E.g.
# 5h30m or 5.5h. Also the interval can be 'infinity', 'inf', 'never', 'forever' - it means infinite interval. E.g.
# 'sleep forever' or 'set dns:cache-expire never'.
@pirafrank
pirafrank / youtube-uploader-cli.sh
Created November 14, 2016 12:33
Quick script to automate video upload from CLI to YouTube. Replace 'francesco' with your own username.
#!/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 October 22, 2016 10:00
Easy script to download, compile and install Git. Tested in Debian 7 and 8.
#!/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 January 9, 2019 13:42
Backup and deploy to Amazon S3 static resources of my website (fpira.com)
#!/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
@pirafrank
pirafrank / jekyll-and-liquid.md
Created August 31, 2016 12:50 — forked from magicznyleszek/jekyll-and-liquid.md
Jekyll & Liquid Cheatsheet

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 June 21, 2017 05:27
Pythonista script to replace custom domain urls with site.baseurl in jekyll posts.
#! 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 August 19, 2016 00:52 — forked from flohei/search.html
An example search page for Jekyll running the jekyll-lunr-js-search plugin.
---
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 January 22, 2018 15:10
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.
#!/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 July 10, 2016 20:23
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.
#!/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 November 1, 2016 13:28
install the PHP version you want on Raspbian. Tested with 5.5 and 5.6. It may work for PHP 7.x, too.
#!/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 ###