Skip to content

Instantly share code, notes, and snippets.

Avatar

Dário dmarcelino

View GitHub Profile
@dmarcelino
dmarcelino / flatten_folders.sh
Last active Nov 1, 2020
Reduce the number of folders taken by a music collection to please some car head units
View flatten_folders.sh
#!/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 Sep 30, 2020 — forked from marioBonales/.bashrc
Custom .bashrc for ubuntu with git and kubernetes support
View .bashrc
# ~/.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 Dec 1, 2019 — forked from elwinar/clip
Shortcut to pipe from and to clipboard using xclip
View clip
#!/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 Mar 9, 2018
Simple util library to show/hide HTML elements using the new BS4 classes d-none/d-*-none and d-block/d-*-block.
View bs4_display.js
(function(window){
'use strict';
// wrapper
function bs4Display() {
var _bs4Display = {};
_bs4Display.DUMMY_PREFIX = 'dummy'
// private methods
View xgettext-loader.js
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
View fix-wordpress-permissions.sh
#!/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 / stress.sh
Last active Apr 27, 2017
Raspberry Overclock stability test
View stress.sh
#!/bin/bash
# Simple stress test for system. If it survives this, it's probably stable.
# Free software, GPL2+
# Based on http://elinux.org/RPiconfig#Overclocking
# but using 'cat' instead of 'yes' since OpenELEC for Raspberry doesn't have yes
CORES=1
NO_READS=1
NO_WRITES=3
@dmarcelino
dmarcelino / compact_timezone_list.html
Last active Feb 10, 2017
Python script to generate compact list of timezones (HTML and json)
View compact_timezone_list.html
<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>
View gist:18c7877bbc4db5f1794b571136946b90
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 Sep 22, 2016 — forked from mathiasrw/True Trello Printer
Ever wanted to print your Trello board? Export as JSON and paste it into the code.
View True Trello Printer
<!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{
You can’t perform that action at this time.