Skip to content

Instantly share code, notes, and snippets.

View dmarcelino's full-sized avatar

Dário dmarcelino

  • AppsCot
  • Lisbon, Portugal
View GitHub Profile
@dmarcelino
dmarcelino / flatten_folders.sh
Last active November 1, 2020 14:34
Reduce the number of folders taken by a music collection to please some car head units
#!/usr/bin/env bash
#
# Some car head units have restrictions on the number of folders they can access,
# this scripts aims to reduce the number of folders taken by a music collection.
# Assumes the music collection is set up as Artist / Album
# This also ensures the folders and files don't exceed the maximum file size.
# My own head unit restrictions: 255 folders, folder/filename size: 63 chars
export MAX_FILE_SIZE=63
export APPLY_CHANGES=false
@dmarcelino
dmarcelino / .bashrc
Last active September 30, 2020 07:37 — forked from marioBonales/.bashrc
Custom .bashrc for ubuntu with git and kubernetes support
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@dmarcelino
dmarcelino / clip
Created December 1, 2019 17:19 — forked from elwinar/clip
Shortcut to pipe from and to clipboard using xclip
#!/bin/bash
# Linux version
# Use this script to pipe in/out of the clipboard
#
# Usage: someapp | clip # Pipe someapp's output into clipboard
# clip | someapp # Pipe clipboard's content into someapp
#
if command -v xclip 1>/dev/null; then
if [[ -p /dev/stdin ]] ; then
@dmarcelino
dmarcelino / bs4_display.js
Last active March 9, 2018 21:57
Simple util library to show/hide HTML elements using the new BS4 classes d-none/d-*-none and d-block/d-*-block.
(function(window){
'use strict';
// wrapper
function bs4Display() {
var _bs4Display = {};
_bs4Display.DUMMY_PREFIX = 'dummy'
// private methods
let child = require("child_process")
let source_map = require("source-map")
let SourceMapConsumer = source_map.SourceMapConsumer
let path = require("path")
var crypto = require('crypto');
module.exports = function(source, sourceMap) {
this.cacheable()
this.async()
var self = this
@dmarcelino
dmarcelino / fix-wordpress-permissions.sh
Created January 13, 2018 17:53 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@dmarcelino
dmarcelino / compact_timezone_list.html
Last active February 10, 2017 17:49
Python script to generate compact list of timezones (HTML and json)
<select>
<option utc_offset="-11:00" dst="0" value="Etc/GMT+11">UTC-11:00 Pago Pago, Niue</option>
<option utc_offset="-10:00" dst="0" value="Etc/GMT+10">UTC-10:00 HST, Rarotonga, Tahiti, Honolulu</option>
<option utc_offset="-10:00" dst="1" value="America/Adak">UTC-10:00 Adak</option>
<option utc_offset="-09:30" dst="0" value="Pacific/Marquesas">UTC-09:30 Marquesas</option>
<option utc_offset="-09:00" dst="1" value="America/Anchorage">UTC-09:00 Anchorage, Juneau, Metlakatla, Nome, Sitka, Yakutat</option>
<option utc_offset="-09:00" dst="0" value="Etc/GMT+9">UTC-09:00 Gambier</option>
<option utc_offset="-08:00" dst="0" value="Etc/GMT+8">UTC-08:00 Pitcairn</option>
<option utc_offset="-08:00" dst="1" value="PST8PDT">UTC-08:00 PST8PDT, Dawson, Vancouver, Whitehorse, Tijuana, Los Angeles</option>
<option utc_offset="-07:00" dst="1" value="MST7MDT">UTC-07:00 MST7MDT, Cambridge Bay, Edmonton, Inuvik, Yellowknife, Chihuahua, Mazatlan, Ojinaga, Boise, Denver</option>
Sometimes after a hard reboot (power cut), if your synology cannot be logged in with DSM and it shows "System is getting ready. Please log in later" , please do these steps :
#Admin login via ssh
> synobootseq --set-boot-done
> synobootseq --is-ready
#optional
> /usr/syno/etc/rc.d/S97apache-sys.sh start
> /usr/syno/etc/rc.d/S95sshd.sh start
@dmarcelino
dmarcelino / True Trello Printer
Created September 22, 2016 08:29 — forked from mathiasrw/True Trello Printer
Ever wanted to print your Trello board? Export as JSON and paste it into the code.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>True Trello Printer</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<style>
body{margin:15%;}
.panel-body{
@dmarcelino
dmarcelino / search_backends.py
Created August 6, 2016 21:39 — forked from gregplaysguitar/folding_whoosh_backend.py
Django-haystack Whoosh backend with character folding
# -*- coding: utf-8 -*-
"""
Whoosh backend for haystack that implements character folding, as per
http://packages.python.org/Whoosh/stemming.html#character-folding .
Tested with Haystack 2.4.0 and Whooch 2.7.0
To use, put this file on your path and add it to your haystack settings, eg.