Skip to content

Instantly share code, notes, and snippets.

View Ragnarokkr's full-sized avatar

Marco Trulla Ragnarokkr

View GitHub Profile
@Ragnarokkr
Ragnarokkr / README.md
Created November 22, 2023 17:52
Mount remote FTP directory host locally into WSL Linux filesystem

Install CurlFtpFS

Before proceeding with the steps below, you’ll need to install the CurlFtpFS software on your system. It can be easily installed using your system’s package manager by executing the appropriate command below.

To install CurlFtpFS on Ubuntu, Debian, and Linux Mint:

$ sudo apt install curlftpfs

To install CurlFtpFS on Arch Linux and Manjaro:

@Ragnarokkr
Ragnarokkr / Facebook-Mobilizer.user.js
Last active May 7, 2019 07:43
Facebook Mobilizer User Script
// ==UserScript==
// @name Facebook Mobilizer
// @namespace https://marcotrulla.it/
// @description Add a link to the mobile version of any post in timeline
// @author Marco Trulla
// @match *://www.facebook.com/*
// @version 0.0.3
// @grant none
// ==/UserScript==
@Ragnarokkr
Ragnarokkr / nginx-site-manager.py
Created July 11, 2018 16:18
Simple apache-like website manager for nginx web server.
#! /usr/bin/env python3
"""nginx-site-manager.py
Simple apache-like website manager for nginx web server.
@author Marco Trulla <marco.trulla@gmail.com>
@version 0.1
@license MIT
"""
@Ragnarokkr
Ragnarokkr / vimeo-get-video-data.php
Last active August 29, 2015 14:27
HOWTO: Server-side access to Vimeo API with personal credentials by using official Vimeo's PHP library.
// require the library
require '/path/to/vimeo.php/autoload.php';
use Vimeo\Vimeo;
function getVimeoVideoData( $videoId = '' ) {
// set the authentication credentials
$clientId = 'client_id'; // Client ID from application's dashboard
$clientSecret = 'client_secret'; // Client secret key from application's dashboard
$token = 'token'; // Personal token generated from application's dashboard
@Ragnarokkr
Ragnarokkr / yt-vimeo-regex.md
Last active August 29, 2015 14:25
Youtube/Vimeo URL matching patterns.

This pattern aims to match (testing only) all Youtube's and Vimeo's URL variants.

^(?:https?:)?(?:(?:\/\/(?:(?:www\.)?(?:youtube\.com)|youtu\.be)\/.*?(?:watch\?v=|embed\/)?)?(?:[\w-]{11}(?![\w-]))|(?:\/\/vimeo\.com\/)?[\d]{9}(?![\w])).*$

This pattern matches Youtube only URLs:

^((https?:)?(?:(?:\/\/((?:www\.)?youtube\.com|youtu\.be)\/.*?(?:watch\?v=|embed\/)?)))?([\w-]{11})

  • group 2: stores the protocol
  • group 3: stores the domain
@Ragnarokkr
Ragnarokkr / fbFeedStoryFilter.css
Created January 7, 2014 22:50
CSS rule to filter the Facebook feed story for a specific user.
div .fbFeedTicker .fbFeedTickerStory:not([data-actor="put-here-the-user-id"]) { display: none; }
@Ragnarokkr
Ragnarokkr / vbox-query-uuid.sh
Created June 2, 2013 15:54
Simple function to search for a valid VirtualBox VM and return its UUID
#!/usr/bin/env sh
# Searches for a currently available VirtualBox VM and returns its UUID.
#
# Code by Marco Trulla a.k.a. Ragnarøkkr
# http://marcotrulla.it/
# http://github.com/Ragnarokkr
#
# Params:
# $1 => the regex pattern to search for in currently available virtual machines
@Ragnarokkr
Ragnarokkr / bash_prompt.sh
Last active December 16, 2015 11:58 — forked from insin/bash_prompt.sh
Adapting to Italian version of Git v1.8+ - Improve the formatting and displayed infomations.
#!/usr/bin/env bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
#
# * the active python virtualenv
# * the branch/status of the current git repository, or
# * the branch of the current svn repository
# * the currently running/stopped jobs
@Ragnarokkr
Ragnarokkr / TwitterFollowAll.js
Created April 8, 2013 23:20
Automatically follows all the users listed into the Follower or Following page. NOTE: To follow all the users, first scroll down until no more users are loaded.
(function($){
var $users = $('li[data-item-type=user]');
$users.each( function(){
var $this = $(this),
$button = $this.find('button'),
$status = $button.find('span.follow-text'),
isFollowable = $status.is(':not(:hidden)');
@Ragnarokkr
Ragnarokkr / isSafePath.js
Last active December 15, 2015 03:09
Verifying a valid object property could be overly painful when we have to do with 'object.foo.bar.baz.one.two.three'. The goal of these solutions is to give a powerful hand in checking those kind of very-depth-objects. They allow to check for a valid "object path" of any depth. Short-circuiting and caching are provided to speed the check up. Fur…
/*
* Checks object paths of any depth, with short-circuiting and caching.
* Prototype version.
*
* @author Marco Trulla <marco@marcotrulla.it> http://marcotrulla.it
* @version 0.1
* @license MIT http://opensource.org/licenses/MIT
* @return boolean
* @example
*