Skip to content

Instantly share code, notes, and snippets.

View vmassuchetto's full-sized avatar

Vinicius Massuchetto vmassuchetto

View GitHub Profile
@vmassuchetto
vmassuchetto / commit.sh
Created September 25, 2017 15:21
Commit and push changes on a shared codebase using a single user (used in Cobol mainframes for teams not familiar with Git)
#!/bin/sh
#
# Script to help users in version control in a shared codebase
# and a single user account. It will parse a USERS_FILE to
# fill the proper committer info and push changes. Pull and
# merges are not used. Pushes are forced because the main codebase
# is the work-tree and not the upstream code.
#
@vmassuchetto
vmassuchetto / remote-mysqldump.sh
Created July 4, 2017 15:14
Run mysqldump remotely via SSH to create local SQL dumps
#!/bin/bash
usage() {
echo ""
echo "USAGE:"
echo ""
echo " $0 [ OPTIONS and PARAMETERS ]"
echo ""
echo "OPTIONS:"
echo ""
@vmassuchetto
vmassuchetto / cleanbox-centos5.sh
Created May 30, 2017 18:50
Script to clean a CentOS 5 virtual machine for pre-packaging on Vagrant
#!/bin/sh
usage() {
echo ""
echo "USAGE:"
echo ""
echo " Run as root on virtual environment:"
echo " $0"
echo ""
echo "RESULTS:"
@vmassuchetto
vmassuchetto / shotwell-sync-dirs
Last active January 2, 2018 15:45
Syncronize Shotwell photos directories moving files to the exposure time adjusted in the application
#!/bin/bash
DBFILE=~/.local/share/shotwell/data/photo.db
PHOTODIR="~/photos"
STRUCTURE="%Y/%m"
UPDATE="$(mktemp -d "${TMPDIR:-/tmp/}$(basename 0).XXXXXXXXXXXX")/update.sql"
echo '' > $UPDATE
PHOTODIR=${PHOTODIR/#\~/$HOME}
@vmassuchetto
vmassuchetto / shotwell-thumbnailer
Last active April 10, 2017 04:12 — forked from benjaoming/shotwell_regenerate_thumbnails.sh
Regenerate Shotwell thumbnails in parallell processing
#!/bin/bash
THUMB_ROOT=~/.cache/shotwell/thumbs
MAX_PROCESSES=4
i=0
sqlite3 ~/.local/share/shotwell/data/photo.db \
"select id||' '||filename from PhotoTable order by exposure_time desc" |
while read id filename; do
@vmassuchetto
vmassuchetto / winopen
Last active June 8, 2023 04:49
Shell script to open files in a VirtualBox Windows guest from the Linux host
#!/bin/bash
# Based on http://tinyurl.com/jmze5lw with some additions
# Dependencies: detox wmctrl
# In your VM, share the root host location "/" in $DRIVE
SCRIPTPATH="$(basename "$0")"
VMNAME="WindowsXP"
DRIVE="E:"
@vmassuchetto
vmassuchetto / etc-init.d-protheus_env
Last active August 29, 2015 14:25
Variáveis de ambiente para o initscript do Totvs Microsiga Protheus: License server, cTree, DBAccess, Appserver e Workflow
#!/bin/bash
#
# Arquivo de ambiente para o Totvs Microsiga Protheus. Serve como suporte para
# um arquivo principal de execução disponível em:
# https://gist.github.com/vmassuchetto/d43886fa0726feb73b73
#
# Definição do ambiente
if [ -z "$PROTHEUS_ENV" ]; then
@vmassuchetto
vmassuchetto / countbib
Created May 7, 2015 07:24
Shell script to count citations in TeX files
#!/bin/bash
#
# Counts the number of lines each citation appears on a tex file.
#
# Usage:
#
# ./countbib texfile.tex
#
TEXFILE=$1
@vmassuchetto
vmassuchetto / sw-struct.py
Created April 11, 2015 14:35
SolidWorks BOM to database parent-child part number conversion
"""
Python script to generate SolidWorks BOM lists into a database-usable parent
child relationship.
CSV data of the first column:
"<parent>.<child>.<subchild>.<subsubchild>"
Usage:
@vmassuchetto
vmassuchetto / copyallh.vba
Last active August 29, 2015 14:13
Copy all sheets of a Workbook to a 'Master' sheet horizontally
Sub CopyAllH()
Dim wrk As Workbook 'Workbook object
Dim sht As Worksheet 'Object for handling worksheets in loop
Dim trg As Worksheet 'Master Worksheet as a target
Dim col As Integer 'Column count
Dim i As Integer 'Some index
Dim rng As Range 'Range object
Dim rng1 As Range 'Range object
Dim rng2 As Range 'Range object