Skip to content

Instantly share code, notes, and snippets.

View designrubenz's full-sized avatar

Johannes Rubenz designrubenz

View GitHub Profile
@designrubenz
designrubenz / README.md
Created February 15, 2019 08:32
Different ways of creating a foreign key (constraint) in postgresql

Different ways of creating a foreign key (constraint) in postgresql

Prerequisite

CREATE TABLE products (
    product_no integer PRIMARY KEY,
    name text,
    price numeric
);
@designrubenz
designrubenz / ansible.txt
Last active September 28, 2018 18:26
ansible
Note: By default Ansible will use the same username as your current machine’s username.
Ansible ad hoc command, python not installed on host
ansible -i realhosts host1 -m raw -a "uname -r" -u root
realhosts file:
[web]
host1 ansible_ssh_host=12.123.456.789
Ping a host (mybox) defined in your hosts file:
@designrubenz
designrubenz / vim-enter-mapping.md
Last active June 3, 2022 06:35
vim: remap enter with multiple commands (once and for all)

:nnoremap :w<CR> :VtrSendCommandToRunner<CR>

:nnoremap <CR> :!./build.sh<CR>

@designrubenz
designrubenz / README.md
Created July 26, 2018 14:54
mySQL 8 / PHP: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root
@designrubenz
designrubenz / README.md
Last active September 30, 2021 23:14
Neuen SSH-Key auf Hetzner-Server hinterlegen
  1. neues SSH keypair generieren (s. github-Doku )
  2. Dann in der robot-Oberfläche:
  • rescue-System aktivieren (Passwort notieren)
  • Server restart
  • auf Server per SSH/rescue-Passwort zugreifen
  • Server-Partition mounten! (sonst befindet man sich nur auf der Partition des Rescue-Systems) (s. hetzner-Doku )
  • neue Keys hinterlegen (z.B. in /root/.ssh/authorized_keys)
  • Server restart

Systeminitialisierung in macOS

Nach dem Start des Kernels (PID 0: kernel_task) wird als Erstes der launchdaemon launchd (PID: 1) gestartet. Dieser lädt und verwaltet alle Hintergrundprozesse:

"Many kinds of tasks that do not require user interaction are most effectively handled by a process that runs in the background. You can use a daemon or service to:

@designrubenz
designrubenz / functions.php
Last active November 25, 2020 07:51
Wordpress: reduce to the max
<?php
function wp_customize_admin_menu() {
remove_menu_page( 'edit.php' );
remove_menu_page( 'edit-comments.php' );
remove_submenu_page( 'themes.php', 'theme-editor.php' );
remove_submenu_page( 'plugins.php', 'plugin-editor.php' );
remove_submenu_page( 'tools.php', 'tools.php' );
remove_submenu_page( 'tools.php', 'import.php' );
remove_submenu_page( 'options-general.php', 'options-discussion.php' );
@designrubenz
designrubenz / apache.md
Last active November 10, 2021 22:35
Apache MacOS
@designrubenz
designrubenz / php-brew.md
Last active March 6, 2018 20:01
multiple PHP versions with homebrew

multiple PHP versions with homebrew

brew switch php70 7.0.15_8

unlink previous version, eg. brew unlink php56

Currently can't use 7.2 as it responds way too slowly.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');