Skip to content

Instantly share code, notes, and snippets.

View mkpelletier's full-sized avatar

Mathieu Pelletier mkpelletier

View GitHub Profile
@mkpelletier
mkpelletier / fixnames.sh
Last active May 17, 2022 14:02
Bash script to remove spaces and special characters from directories and filenames
#!/bin/bash
SAFEIFS=$IFS
IFS=$'\n' #Change field separator so our variables are not broken by spaced names
#Fix space names
for spacename in `tree -f -L 3 --noreport -i | grep " "` # find names with spaces
do
if [[ $spacename != '.' ]]; # Exclude top level directory listed in tree output
then
NEW_NAME=$(sed 's/ /_/g' <<< $spacename) #remove spaces
@mkpelletier
mkpelletier / RegexSubstitute.EXCEL.yaml
Created May 6, 2022 07:57
Replace accented characters with ISO compliant characters
name: RegexSubstitute
description: Replace accented characters with ISO compliant characters
host: EXCEL
api_set: {}
script:
content: |-
function main
(
workbook: ExcelScript.Workbook,
searchString: string,
@mkpelletier
mkpelletier / cleanAlfPropTables-MySQL.sql
Created December 3, 2015 05:41
SQL script for properly clearing Alfresco unused audit data / property values (NOT node properties, but the property tables used for AuditComponent and AttributeService functionality) for PostgreSQL / MySQL.NOTE: Only run when the Alfresco Repository is NOT running as values kept in in-memory caches will otherwise result in constraint violations.
set autocommit=0;
begin;
-- get all active references to alf_prop_root
create temporary table temp1 (id bigint(20), index (id));
insert into temp1 select disabled_paths_id as id from alf_audit_app;
insert into temp1 select audit_values_id as id from alf_audit_entry;
insert into temp1 select prop1_id as id from alf_prop_unique_ctx;
-- determine the obsolete entries from alf_prop_root