Skip to content

Instantly share code, notes, and snippets.

View vmassuchetto's full-sized avatar

Vinicius Massuchetto vmassuchetto

View GitHub Profile
@vmassuchetto
vmassuchetto / mcblist
Created August 24, 2014 20:44
Shell script to list MP3 files in the format "<title> (<minute:seconds lengh>)", as required by the MusicBrainz parser
#!/bin/bash
GREP="grep"
GREP_E="not found"
CURDIR=`pwd`
TITLEINFO_1="beet info "
TITLEINFO_2=" | grep \"\ title:\" | awk -F':' '{print \$2 }' | sed 's/^ //g'"
TIMEINFO_1="mp3info -p \"\%S\""
TIMEINFO_2=""
@vmassuchetto
vmassuchetto / etc-init.d-protheus
Last active June 10, 2018 14:18
Initscript para o Totvs Microsiga Protheus: License server, cTree, DBAccess, Appserver e Workflow
#!/bin/bash
### BEGIN INIT INFO
# Provides: protheus
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Start/stop protheus server
### END INIT INFO
@vmassuchetto
vmassuchetto / youtube-dl-cron.sh
Last active September 26, 2023 12:21
Shell script cron job to download YouTube videos from your subscription feed
#!/bin/bash
#
# Script to keep downloading YouTube videos to your computer using youtube-dl:
# http://rg3.github.io/youtube-dl/
#
# Put it to work:
#
# sudo wget "https://gist.github.com/vmassuchetto/10338703/raw" -O /etc/cron.hourly/youtube-dl-cron.sh
# sudo chmod +x /etc/cron.hourly/youtube-dl-cron.sh
@vmassuchetto
vmassuchetto / migration.php
Last active August 29, 2015 13:55
WordPress migration template
<?php
// we need memory and time
ini set( 'memory limit', -1);
set_time_limit( 0 );
// WordPress environment
include( 'wp-load.php' );
@vmassuchetto
vmassuchetto / .gitignore
Created November 28, 2013 22:23
etckeeper sample .gitignore
# begin section managed by etckeeper (do not edit this section by hand)
# new and old versions of conffiles, stored by dpkg
*.dpkg-*
# new and old versions of conffiles, stored by ucf
*.ucf-*
# old versions of files
*.old
@vmassuchetto
vmassuchetto / post_mail.php
Last active December 29, 2015 12:49
Notifies WordPress site admins when some posts are pending for approval
<?php
/**
* Wraps a message $content in a responsive e-mail template.
*
* Reference: http://zurb.com/playground/projects/responsive-email-templates/basic.html
*/
function post_mail_content( $content ) {
ob_start(); ?><html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta content="width=device-width" name="viewport">
@vmassuchetto
vmassuchetto / deploy.php
Last active December 28, 2015 00:19
PHP script to automate deploy using Git
<?php
/**
* This scripts is intended to be triggered by Git hooks. For deployment you'll
* probably want to use `post-update`:
* http://schacon.github.io/git/githooks.html#post-update
*
* First, set the `PASS` constant to limit access to this script and use it as
* a `pass` GET variable.
*
@vmassuchetto
vmassuchetto / oembed-youtube.sh
Last active December 21, 2015 06:09
Replace Youtube oEmbed entries by iframe tags in text files
#!/bin/bash
for FILE in `rgrep -il "youtube.com" * | grep -v iframe` ; do
perl -p -i -e 's/(<p>)?.*youtube\.com\/watch.*v=([A-Za-z0-9]*).*(<\/p>)?/<iframe width="560" height="315" frameborder="0" src="\/\/www\.youtube\.com\/embed\/\2\" allowfullscreen><\/iframe>/g' $FILE ;
done
@vmassuchetto
vmassuchetto / purge.sh
Last active August 2, 2023 15:07 — forked from adrienbrault/purge.sh
Script to clean a Vagrant box before packaging it. Updated to work with Debian and some additional directories. It's also less general and does not remove any system packages at all.
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
# - https://gist.github.com/adrienbrault/3775253
# Unmount project
umount /vagrant
@vmassuchetto
vmassuchetto / f2f.py
Created August 7, 2013 03:44
Import Flickr images from one account to another based on text files links.
#!/usr/bin/python
FILES_READ_PATH = '/path/to/txt/files'
FILES_WRITE_PATH = '/where/to/save/images'
FROM_USER = 'you_username'
FROM_FLICKR_API_KEY = 'some_key'
FROM_FLICKR_API_SECRET = 'some_secret'
TO_USER = 'your_username'