Skip to content

Instantly share code, notes, and snippets.

View enricocaputo's full-sized avatar

Enrico Caputo enricocaputo

View GitHub Profile
@enricocaputo
enricocaputo / pdf-split.sh
Created December 31, 2018 14:58 — forked from alexarje/pdf-split.sh
Small shell script (for Ubuntu) that splits up one multi-page PDF to individual PDF files
#!/bin/sh
cd $NAUTILUS_SCRIPT_CURRENT_URI
pdftk $@ burst output $@-%d.pdf
@enricocaputo
enricocaputo / getZodiacSign.js
Created December 17, 2018 12:50 — forked from kladov/getZodiacSign.js
Zodiac sign (javascript)
/**
* Return zodiac sugn by month and day
*
* @param day
* @param month
* @return {string} name of zodiac sign
*/
function getZodiacSign(day, month) {
var zodiacSigns = {
@enricocaputo
enricocaputo / README.md
Created December 13, 2018 20:36 — forked from roachhd/README.md
Feed.xml RSS for Jekyll blog on GitHub pages.

Jekyll RSS Feed Templates.

A few Liquid templates to use for rendering RSS feeds for your Jekyll blog. Featuring four kinds of feeds:

  • feed.xml — Renders the 10 most recent posts.
  • feed.category.xml — Only renders posts for a specific category. This example renders posts for a "miscellaneous" category.
  • feed.links.xml — Only contains posts that link to external websites noted by a link variable in the YAML Front Matter. Not a common Jekyll convention, but a good way to generating a linked list.
  • feed.articles.xml — Only showing articles that don't link to external sites; The opposite of feed.links.xml.
@enricocaputo
enricocaputo / Jekyll-Breadcrumb-Microdata.html
Last active November 13, 2018 11:54
A breadcrumb trail with structured data for Jekyll websites
<div class="myBreadcrumbTrail">
<nav class="breadcrumbs" aria-label="you are here!" role="navigation">
{% assign crumbs = page.url | remove:'/index.html' | split: '/' %}
<ol class="breadcrumb list-unstyled" itemscope itemtype="http://schema.org/BreadcrumbList">
<li class="breadcrumb-item " itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemprop="item" href="/">
<span itemprop="name">Home</span>
</a>
<meta itemprop="position" content="1" />
</li>
@enricocaputo
enricocaputo / example.html
Created April 29, 2018 09:32 — forked from andrewlimaza/example.html
Print certain div / elements using window.print()
<script>
function printDiv(divName){
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
@enricocaputo
enricocaputo / AtomFeedXmlToCarrot2Xml.xsl
Created March 24, 2018 07:02 — forked from semanticdreamer/AtomFeedXmlToCarrot2Xml.xsl
XSLT to transform an Atom Feed to the carrot2 XML
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom"
exclude-result-prefixes="atom">
<xsl:output indent="yes" omit-xml-declaration="no"
media-type="application/xml" encoding="UTF-8" />
<xsl:template match="/atom:feed">
@enricocaputo
enricocaputo / sitemap.xml
Created November 7, 2017 13:12 — forked from StartZeroGnu/sitemap.xml
Jekyll (sitemap.xml) Template to exclude paginate folders (local build)
<!-- Forked from: https://github.com/StartZeroGnu/jekyll-sitemap/blob/master/lib/sitemap.xml -->
<!-- Add condition to exclude paginate folders -->
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% capture site_url %}{% if site.url %}{{ site.url | append: site.baseurl }}{% else %}{{ site.github.url }}{% endif %}{% endcapture %}
{% for post in site.posts %}{% unless post.sitemap == false %}
<url>
<loc>{{ post.url | prepend: site_url | normalize_url }}</loc>
@enricocaputo
enricocaputo / whois_query.php
Created April 27, 2017 05:40
PHP: Whois query using PHP
<?php
/**
* PHP: Whois query using PHP
* http://www.catswhocode.com/blog/10-super-useful-php-snippets-you-probably-havent-seen
*/
function whois_query($domain) {
// fix the domain name:
$domain = strtolower(trim($domain));
$domain = preg_replace('/^http:\/\//i', '', $domain);