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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fixIncompleteJson($partialJson) { | |
$jsonWithoutBraces = trim($partialJson, '{}'); | |
$pairs = explode(',', $jsonWithoutBraces); | |
$validPairs = []; | |
foreach ($pairs as $pair) { | |
if (preg_match('/^\s*"([^"]+)"\s*:\s*"([^"]+)"\s*$/', $pair, $matches)) { | |
$key = $matches[1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given regexp pattern: | |
^1\..*?\s | |
gh label list --sort name | grep -o -E '^1\..*?\s' | xargs -I% gh label delete --yes % |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SerialNumber=$(/usr/sbin/system_profiler SPHardwareDataType | grep "Serial Number (system)" | awk '{print $4}') | |
log stream --style syslog -predicate 'subsystem == "com.apple.Authorization" AND eventMessage contains "authenticated as user queenofclubs"' | while read LINE; do | |
echo "$LINE" && curl -X POST --silent --data-urlencode \ | |
"payload={\"text\": \"$(echo $LINE | sed "s/\"/'/g")\"}" https://hooks.slack.com/services/xxxxxx/xxxxx/xxxxx; | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services; | |
use GuzzleHttp\Client; | |
class ChatGPTService | |
{ | |
private $apiKey; | |
private $baseUrl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. |
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.
- 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:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events { | |
} | |
http { | |
# Proxy Cache | |
# Cache 10GB for 1 Month | |
#proxy_cache_path /var/cache/nginx keys_zone=GS:10m inactive=720h max_size=10240m; |
NewerOlder