Skip to content

Instantly share code, notes, and snippets.

View superjojo140's full-sized avatar

Johannes Schnirring superjojo140

View GitHub Profile
@superjojo140
superjojo140 / secret_data.php
Created February 11, 2021 10:18
Controlled data access with PHP
<?php
$default_info =
"<br><b>Persönliche Daten</b><br>"
."<b>Name:</b> Detlef Dummy<br>";
$TOKEN = "superSecretToken";
$code = $_GET["code"];
$name = $_GET["name"];
@superjojo140
superjojo140 / formatDate.ts
Last active March 10, 2021 12:47
Format javascript Date object with template string
/**
* Formats a date as string specified by a template string
* @param date Date to be formatted
* @param templateString Template of the expected format. e.g. "YYYY-MM-DD hh:mm:ss" or "YY-M-D h:m:s" to trim leading zeros
*/
export function formatDate(date: Date, templateString: string): string {
const year = date.getFullYear().toString();
const shortYear = date.getFullYear().toString().substr(2, 2);
const month = date.getMonth() < 9 ? "0" + String(date.getMonth() + 1) : String(date.getMonth() + 1);
const shortMonth = String(date.getMonth() + 1);
@superjojo140
superjojo140 / php_formatting_vscode.md
Last active May 7, 2021 13:56
PHP and HTML Formatting in VS Code
@superjojo140
superjojo140 / compress_photos.sh
Created May 21, 2022 13:59
Batch compress photos with imagemagick
mogrify -strip -interlace Plane -gaussian-blur 0.05 -quality 20% *.jpg
@superjojo140
superjojo140 / network_cheat_sheet.sh
Last active August 22, 2022 19:56
Some cute linux commands to analyse your network
#scan local network for clients
sudo arp-scan --interface=enp4s0 --localnet
#live monitoring of network traffic and datavolume
nload
@superjojo140
superjojo140 / tasks.svgz
Created October 20, 2022 10:42
KDE Plasma theme modificator for taskbar [depends on Chrome OS theme]
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
id="svg2"
width="144"
height="126"
version="1.0"
viewBox="0 0 144 126"
sodipodi:docname="tasks.svgz"
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
@superjojo140
superjojo140 / format_date.php
Last active October 23, 2022 16:35
Print UTC datetime-string as locale date in PHP
<?php
$inputUtc = "2022-10-23T10:00:00";
$dateObject = date_create($inputUtc,timezone_open("UTC"));
print_r($dateObject);
$timestamp = date_timestamp_get($dateObject);
date_default_timezone_set("Europe/Berlin");
echo date("d.m.Y H:i",$timestamp);
@superjojo140
superjojo140 / ical_syntax.md
Last active November 2, 2022 04:14
iCalendar / ical / ics basic syntax

ICAL / ICS Syntax

References

Defined in RFC2445
Nice to read on https://www.kanzaki.com/docs/ical/

Basics

Allways start file with BEGIN:VCALENDAR and end with END:VCALENDAR
Events allways start with BEGIN:VEVENT and end with END:VEVENT and are nested in VCALENDAR
Timezones are mandatory for recurring events and recommended for all events.

@superjojo140
superjojo140 / uberspace_new_webapp.md
Last active January 2, 2023 15:00
[Checklist] New webapp on uberspace

This guide shows all steps to deploy a webapp on uberspace.

NOTE: This shows my personal workflow. This might not be fitting for your webapp.

Clone git repo

git clone <URL>

Install dependecies and build

@superjojo140
superjojo140 / arch_install.md
Last active February 15, 2023 14:38
Arch Linux UEFI Installation mit KDE Desktop

Diese Anleitung beschreibt die wichtigsten Schritte einer Arch Linux Installation.

Sie ist stark angelehnt an die Anleitung für Einsteiger, verzichtet jedoch auf viele Erklärungen und Variationen.

Installiert wird hier auf UEFI, als Desktop wird KDE Plasma installiert.

Vorbereitungen

Iso herunterladen http://www.archlinux.org/download/