Skip to content

Instantly share code, notes, and snippets.

View fintanmm's full-sized avatar

Fintan MacMahon fintanmm

View GitHub Profile
@fintanmm
fintanmm / tasks.json
Created June 14, 2022 06:01
vscode quarkus lambda tasks
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Create Lambda",
"type": "shell",
"command": "target/manage.sh create",
"group": "none",
@fintanmm
fintanmm / jshell-run.sh
Created November 11, 2021 11:44
Run jshell with with the current env loaded.
mvn compile com.github.johnpoth:jshell-maven-plugin:1.3:run
@fintanmm
fintanmm / gist:213db6485c95cb74dd58a8f21c8cce9b
Created September 23, 2021 08:31
ansible apt update report
ansible-playbook -i hosts pacakges.yml -k -K |grep -A 1000 "PLAY RECAP"|tail -n +2|tr -d ':'|tr -s '[:space:]'|sed 's/[[:space:]]/,/g'> fixed_output.csv
SELECT
th.name as metric,
long_lat.site AS name,
long_lat.Latitude AS latitude,
long_lat.Longitude AS longitude,
COUNT(th.type_id) AS value
FROM ticket_history th
LEFT JOIN
-- SUB QUERY FOR LOCATIONS
(SELECT
@fintanmm
fintanmm / text.py
Created August 14, 2019 13:22
text prep for k-nn
import sys, os
# sys.path.append('./Common') # noqa
sys.path.append(os.path.abspath('./Common'))
import Common.common as common
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib
from collections import Counter, OrderedDict
@fintanmm
fintanmm / alfPeopletoCSV.sh
Created May 2, 2019 11:19
Get all users from Alfresco and convert it to csv file.
echo '"userName", "enabled", "firstName", "lastName", "jobtitle", "organization", "location", "telephone", "mobile", "email", "companyaddress1", "companyaddress2", "companyaddress3", "companypostcode", "companytelephone", "companyFax", "companyemail", "isDeleted"' > people.csv
curl -u user:"password" "https://domain.com/alfresco/s/api/people?maxResults=2000" | \
jq -r '.people[] | [.userName, .enabled, .firstName, .lastName, .jobtitle, .organization, .location, .telephone, .mobile, .email, .companyaddress1, .companyaddress2, .companyaddress3, .companypostcode, .companytelephone, .companyFax, .companyemail, .isDeleted] | @csv' >> people.csv
@fintanmm
fintanmm / findingFiles.sh
Last active March 27, 2019 11:25
Finding info about files and directories
#!/bin/bash
export project=$1
export pathOfProject=$2
mkdir -p "./$project"
# find data/B8493 -type f -printf '%h\n' | sort -u
echo "Empty Dirs"
import java.io.File
import org.apache.poi.ss.usermodel.WorkbookFactory
import org.apache.poi.ss.usermodel.{Row, Cell}
val baseUnitFile = new File("./BaseUnits_export_.xlsx")
var workbook = WorkbookFactory.create(baseUnitFile)
val sheet = workbook.getSheetAt(0)
val xmlTemplate = (DevName: Cell, IP: Cell) => <MirrorOp>
<Device>
@fintanmm
fintanmm / windows1251ToUTF8.py
Last active June 22, 2018 05:28
Parses log file from alfresco bulk import tool then runs convmv on files
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse, sys, re, signal
from subprocess import call
parser = argparse.ArgumentParser()
parser.add_argument("--file", help="The log file to parse.")
parser.add_argument(
"--notest", help="Use --notest to finally rename the files.", action="store_true")
parser.add_argument("--printtest", help="Just print out line contents")
@fintanmm
fintanmm / fixmetadata.get.js
Last active October 2, 2019 12:19
Fixing metadata within Alfresco.
/**
* Summary. Attempts to fix metadata that is in the Alfresco Repo.
* @param {object} args
*/
const invalidArg = function (message) {
status.code = 400
status.message = message
status.redirect = true
}