Skip to content

Instantly share code, notes, and snippets.

View oliveratgithub's full-sized avatar

Oliver oliveratgithub

View GitHub Profile
@Swiss-Mac-User
Swiss-Mac-User / add_alarms_to_ics.sh
Created January 16, 2024 20:47
Shell script to insert a VALARM block to every event in an iCalendar file (.ics), making imported events show an alert x hours before the event
#!/bin/bash
# Inspired from: https://x.com/SwissMacUser/status/1349065380514426883
# Personally used to add event reminders to the downloadabl iCalendar files
# of the yearly Stadt Zürich digital Entsorgungskalender at
# https://www.stadt-zuerich.ch/ted/de/index/entsorgung_recycling/entsorgen/persoenlicher_entsorgungskalender.html
# Check if the minimum number of arguments is provided
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <path-to-ics-file> <hours-to-alert-before> [backup]"
@Swiss-Mac-User
Swiss-Mac-User / Terminal.sh
Created June 22, 2023 21:07
Find non UTF-8 encoded files on macOS: a shell command to recursively list all non UTF-8 encoded files within a directory (and its subdirectories)
find /path/to/dir -maxdepth 2 -type f -exec sh -c 'iconv -f utf-8 -t utf-8 "{}" >/dev/null 2>&1 || echo "{}: Not UTF-8"' \;

FIRST mermaid graph

Keeping in mind the "Latency Numbers Every Programmer Should Know", i.e. network access is expensive.

Online request (service is provided by hashlookup online API)

  • existing / not existing have the same high cost
  • network access takes a long time
  • leak every hash to hashlookup service
@Swiss-Mac-User
Swiss-Mac-User / a_Docker setup.md
Last active March 20, 2024 16:35
Installing SonarQube on Docker and SonarScanner using Homebrew on macOS

Docker setup

Install the Docker UI application for macOS

brew install docker --cask

Open the Docker.app

from /Applications/Docker.app

Go to the Docker Dashboard

Wait until the "Docker Dashboard starting…"-message disappears (= Setup complete)

@yskxi
yskxi / css-macos-big-sur-window.markdown
Created May 16, 2022 02:25
CSS MacOS Big Sur Window
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UnifiedBar</key>
<dict>
<key>DisclosureRequired</key>
<string>ace440ac-b4f6-4b43-aade-02bba1589aef</string>
<key>Enabled</key>
<false/>
@Swiss-Mac-User
Swiss-Mac-User / mysql57_convert_datetime_null.sql
Created March 23, 2021 20:19
MySQL 5.7 set datetime or date to NULL from 0000-00-00 00:00:00 - Fixes incorrect datetime value: '0000-00-00 00:00:00' (without NO_ZERO_DATE workaround)
/** ---
* To set an existing column in MySQL 5.7 from 0000-00-00 00:00:00 to NULL as default
* the following iterative 3 steps will get the job done.
* (Without just using the NO_ZERO_DATE compatibility mode-workaround)
--- */
/* Step 1) Set all 0000-00-00... to a valid but nonsense value: */
UPDATE my_table SET my_datetime_col = '1001-01-01 00:00:00' WHERE CAST(my_datetime_col AS CHAR(20)) = '0000-00-00 00:00:00';
/* Step 2) Modify the column to DEFAULT: NULL */
@oliveratgithub
oliveratgithub / socialnetworkimagesizes.js
Last active May 9, 2023 07:11
Social media networks image sizes as JSON and JavaScript lists – Contains image sizes for all major social networks and messengers as of 2020 (Facebook, Twitter, Instagram, Tik Tok, Telegram, WhatsApp, and more)
let socialnetworkimagesizes = {
'facebook': {
'profile': {
'Profile picture': { 'w': 180, 'h': 180 }
,'Cover photo': { 'w': 820, 'h': 312 }
}
,'content': {
'Timeline image': { 'w': 1200, 'h': 630 }
,'Highlighted image': { 'w': 1200, 'h': 717 }
,'Link - rectangular': { 'w': 1200, 'h': 628 }
@lsauer
lsauer / Docker: save_load_compressed_container.bash
Created March 25, 2019 11:37
Docker: save/load container using tgz file (tar.gz)
#for an image ("not running container") use save:
docker save <dockernameortag> | gzip > mycontainer.tgz
#for running or paused docker, use export:
docker export <dockernameortag> | gzip > mycontainer.tgz
#load
gunzip -c mycontainer.tgz | docker load
@chaance
chaance / semantic-commit-messages.md
Last active June 29, 2022 13:58 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example