Skip to content

Instantly share code, notes, and snippets.

View superjojo140's full-sized avatar

Johannes Schnirring superjojo140

View GitHub Profile
@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 / reset_vscode.md
Last active November 14, 2023 17:08
Reset Visual Studio Code | Code OSS on Linux

Reset all user settings for VSCode (Code OSS) on Linux

(Archlinux in my case)
Reset all settings and extensions. Like a fresh and clean VSCode installation.

  • Close VSCode
  • Remove the ~/.vscode-oss folder and the ~/.config/Code - OSS/ folder

~ is a shorthand for your user folder /home/username but should work on all unix systems

Via Console:

WARNING: This will remove all your settings and installed extensions without any prompt

@superjojo140
superjojo140 / apache_and_php.md
Last active April 17, 2024 03:57
Apache, PHP, MariaDB and PhpMyAdmin on Archlinux

Guide to install a LAMP system on on your archlinux system and serve php-based database applications.
LAMP stands for a Linux system with Apache (webserver), MariaDB (database) and PHP (programming language). In this guide we will also install PhpMyAdmin (database admin GUI) to easily manage the SQL tables.

Apache

apache logo

The Apache HTTP Server is an open-source and free product of the Apache Software Foundation and one of the most widely used web servers on the Internet. In addition to factors such as performance, expandability, security, freedom from license costs and support from a very large community, its long-term availability for a wide variety of operating systems is one of the reasons for its widespread use; it is most frequently used as a LAMP system.

Install packages

@superjojo140
superjojo140 / php_formatting_vscode.md
Last active May 7, 2021 13:56
PHP and HTML Formatting in VS Code
@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 / 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 / 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 / child_process_node.js
Created December 16, 2020 14:02
[Node] Executes a shell command as Promise.
import * as child_process from 'child_process'
/**
* Executes a shell command and return it as a Promise.
*/
export function exec(cmd: string): Promise<string> {
return new Promise((resolve, reject) => {
child_process.exec(cmd, (error, stdout, stderr) => {
if (error) {
reject({ error: error, stderr: stderr });
@superjojo140
superjojo140 / mysql_cheatsheet.md
Last active September 9, 2020 09:53
Mysql Cheatsheet

Use mysql CLI

mysql --user=my_username --password

Create a new user

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
@superjojo140
superjojo140 / cors-fetch-express.md
Last active June 14, 2020 14:59
CORS fetch-request with credentials

This sounds easy but... it isn't!

Client side

Use this fetch options:

fetch('superUnsecureCorsUrl',{
   credentials: 'include'
})