Skip to content

Instantly share code, notes, and snippets.

@CodeBrauer
CodeBrauer / .zshrc
Created June 8, 2022 12:09
Show Timestamp in each line for ZSH. Use only one which suits the best for you
#left side with date
PROMPT='%{$fg[yellow]%}[%D %*] '$PROMPT
#left side without date
PROMPT='%{$fg[yellow]%}[%*] '$PROMPT
#right side with date
RPROMPT="[%D %*]"
#right side without date
RPROMPT="[%*]"
@CodeBrauer
CodeBrauer / install_IM6.sh
Created March 11, 2022 16:31
Install latest ImageMagick6
#!/bin/bash
# Author CodeBrauer 2022
export TMP=~./tmp/
# thanks to: https://stackoverflow.com/a/67404585/1990745
LATEST_IM_VERSION=$(curl "https://api.github.com/repos/ImageMagick/ImageMagick6/tags" | jq -r '.[0].name')
echo ">>> Found latest IM6 version: $LATEST_IM_VERSION";
echo ">>> Start Download..."
@CodeBrauer
CodeBrauer / check_domain_dns.php
Created February 17, 2022 13:47
Quick and Dirty DNS checker - shows A, MX, TXT & NS Entries with ipinfo.io details
<?php
function get_dig($addr, $ns, $type)
{
$addr = escapeshellarg($addr);
$ns = escapeshellarg($ns);
$type = escapeshellarg($type);
$cmd = "dig +short {$addr} {$type} @{$ns}";
return shell_exec($cmd);
}
@CodeBrauer
CodeBrauer / better_touch_tools.json
Created January 17, 2022 14:50
quick and dirty soultion for me to toggle between mac speakers, bluetooth headphones and wired headphones with one keystroke.
{
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : 172,
"BTTPredefinedActionName" : "Run Apple Script (blocking)",
"BTTInlineAppleScript" : "do shell script \"\/php \/Users\/USERNAME\/dev\/togglaudio.php\"",
"BTTAdditionalConfiguration" : "8519680",
"BTTEnabled2" : 1,
"BTTKeyboardShortcutKeyboardType" : 3253,
"BTTRepeatDelay" : 0,
"BTTUUID" : "E86A6EE6-0B34-4607-8D94-9AE303AF29CB",
<?php
/**
* @param string $url The URL to fetch
* @param boolean $json if true, returns decoded json array
* @param boolean $show_error if true, prints curl error to screen
* @author CodeBrauer <https://github.com/CodeBrauer>
* @return string result of fetched url, false on failure
*/
function curl_get_contents($url, $json = false, $show_error = false) {
if (!function_exists('curl_init')) { return file_get_contents($url); } // fallback
@CodeBrauer
CodeBrauer / outlook-extract-emails-mac.md
Last active September 3, 2021 15:16
Outlook local saved mails back to IMAP

Outlook local saved mails back to IMAP

Somehow the "new version" of Outlook for macOS fucked up and all "Sent" Mails we're only saved locally. And turns out, moving them to an IMAP-Folder syncs nothing. Litterly useless. To sync the missing mail to your server, this is the only way I got the mails back in my IMAP/webmail/Apple Mail.

  1. Create a folder on your desktop like mails-outlook-export
  2. Go to the folder in "new" Outlook for Mac, which are not synced
  3. Mark all the mails with CMD+A
  4. Move all mails with drag & drop to your folder mails-outlook-export
  5. Rename the folder to mails-outlook-export.mbox (file extension)
@CodeBrauer
CodeBrauer / README.md
Last active February 17, 2022 13:49
Mask IBAN with PHP for privacy (GDPR/DSGVO)

Mask IBAN with PHP for privacy (GDPR/DSGVO)

Masks an IBAN so that the user still recognizes you, but no one else can do anything with it.

<?php
/**
 * Masks an IBAN so that the user still recognizes you, but no one else can do anything with it.
 * @param  string $iban           the iban to mask
 * @param string $mask_character character/symbol to replace
@CodeBrauer
CodeBrauer / code_letter_cases.md
Last active July 27, 2021 07:32
All code letter cases for programming

letter cases:

Identifier Name Example
ada Ada case The_Quick_Brown_Fox
camel Camel case theQuickBrownFox
cobol COBOL case THE-QUICK-BROWN-FOX
dot Dot notation the.quick.brown.fox
kebab Kebab case the-quick-brown-fox
lower Lower case the quick brown fox