Skip to content

Instantly share code, notes, and snippets.

@mattimatti
mattimatti / ChatGPTService.php
Created March 21, 2023 09:20 — forked from whoisthisstud/ChatGPTService.php
ChatGPT written Laravel Service class for interacting with ChatGPT's API.
<?php
namespace App\Services;
use GuzzleHttp\Client;
class ChatGPTService
{
private $apiKey;
private $baseUrl;
@mattimatti
mattimatti / README.md
Created March 19, 2023 21:00 — forked from heywoodlh/README.md
Auth logging on MacOS using the log command
mkdir -p /opt/scripts
mkdir -p /var/log/custom
mkdir -p /var/root/Library/LaunchAgents


curl 'https://gist.githubusercontent.com/heywoodlh/0295135b9e24ec0729571497c9ab5a77/raw/b3032d9a563c956f574176c39cb2a5382f8c579c/auth-log.sh' -o /opt/scripts/auth-log.sh
chmod +x /opt/scripts/auth-log.sh

@mattimatti
mattimatti / TemplateProcessor.php
Created March 15, 2022 06:28 — forked from jeffsrepoaccount/TemplateProcessor.php
PHPOffice/PHPWord - Injecting AltChunks in word document using placeholders in template file
<?php namespace My\Namespace;
use DOMDocument;
use Parsedown;
use PhpOffice\PhpWord\TemplateProcessor as PhpWordTemplateProcessor;
class TemplateProcessor extends PhpWordTemplateProcessor
{
/**
* Injects a markdown snippet as HTML into the word document.
@mattimatti
mattimatti / README.md
Created September 21, 2021 10:35 — forked from m1keil/README.md
Configure Kibana to use SAML with GSuite (Google Apps, GApps, G Suite)

The following worked with Elastic Cloud, Elasticsearch & Kibana v7.6.0. It should be pretty close for other kinds of deployments. Before starting, make sure you have the right license level that allows SAML.

Create SAML App in GSuite:

  • Navigate to the SAML apps section of the admin console
  • Click the Add button and choose to "SETUP MY OWN CUSTOM APP"
  • Write down the Entity ID and download the Idp metadata file
  • Choose application name, description and add logo
  • In the "Service Provider Details" screen add the following:
@mattimatti
mattimatti / Docverter PHP-CURL example
Created November 28, 2019 12:57 — forked from tim-peterson/Docverter PHP-CURL example
Docverter PHP-CURL example
//set POST variables
$url = 'http://c.docverter.com/convert';
$fields = array('from' => 'markdown',
'to' => 'pdf',
'input_files[]' => "@/".realpath('markdown.md').";type=text/x-markdown; charset=UTF-8"
);
//open connection
$ch = curl_init();
@mattimatti
mattimatti / AwakenSpotify.scpt
Created July 19, 2018 13:43 — forked from alisonailea/AwakenSpotify.scpt
AppleScript to automate the Spotify playlist launch based on the time of day
--current time in seconds since midnight
set currentTime to (time of (current date))
## Morning
-- (04:00 - 10:30)
set morning to 37800
set morningVolume to 80
-- Happy: Wake Up in a Good Mood
set morningTrack to "spotify:user:116779154:playlist:5sYrf2RnhPY22meUSS5fUu"
@mattimatti
mattimatti / useradd.sh
Created May 27, 2018 15:40 — forked from igorvoltaic/useradd.sh
Create new user using command line in Mac OS X. Do not forget to set correct permissions for the file.
#!/bin/sh
if [[ `id -u` != 0 ]]; then
echo "Must be root to run script"
exit
fi
read -p "Enter user name and press [ENTER]: " UserName
if [[ $UserName == `dscl . -list /Users UniqueID | awk '{print $1}' | grep -w $UserName` ]]; then
function exportJSON() {
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
var result = sheets.reduce(function(result, sheet) {
var id = sheet.getName().toLowerCase();
var data = sheet.getDataRange();
var values = data.getValues();
result[id] = values.map(function(row) {
return row.map(function(column) {
return Math.round(column) || column;
function onOpen() {
var menuEntries = [ {name: "Create Diary Doc from Sheet", functionName: "createDocFromSheet"}];
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.addMenu("Fitness Diaries", menuEntries);
}
function createDocFromSheet(){
var templateid = "1O4afl8SZmMxMFpAiN16VZIddJDaFdeRBbFyBtJvepwM"; // get template file id
var FOLDER_NAME = "Fitness Diaries"; // folder name of where to put completed diaries
// get the data from an individual user
username: vagrant
password: vagrant
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev
sudo aptitude install mysql-server mysql-client
sudo nano /etc/mysql/my.cnf