Skip to content

Instantly share code, notes, and snippets.

View dennyweiss's full-sized avatar

Denny Weiß dennyweiss

View GitHub Profile
@dennyweiss
dennyweiss / Git Subtree basics.md
Created April 17, 2019 19:34 — forked from SKempin/Git Subtree basics.md
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@dennyweiss
dennyweiss / Enable xdebug for PHPStorm 2018.2.md
Last active November 9, 2018 08:39
Laravel Homestead 7 – xdebug `/etc/php/7.2/mods-available/xdebug.ini`

Tasks

  1. Add xdebug.remote_autostart = 1 to /etc/php/7.2/mods-available/xdebug.ini
  2. Activate xDebug for CLI
sudo ln -s /etc/php/7.2/mods-available/xdebug.ini /etc/php/7.2/cli/conf.d/20-xdebug.ini
  1. Add Remote CLI Interpreter (vagrant)
@dennyweiss
dennyweiss / delete_git_submodule.md
Created November 8, 2018 16:41 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@dennyweiss
dennyweiss / enable-guest-sharing.ps
Created October 22, 2018 10:58
Enable anonymous guest sharing in Teams - Powershell snippet
$teamurl="https://<admin-url>.sharepoint.com"
$siteurl="https://<tenant-name>.sharepoint.com/sites/<team name>"
Connect-SPOService -Url $teamurl
Get-SPOSite -Identity $siteurl | select SharingCapability
Set-SPOSite -Identity $siteurl -SharingCapability ExternalUserAndGuestSharing
@dennyweiss
dennyweiss / fix-homebrew-owner-perms.sh
Last active April 17, 2018 23:37 — forked from stefanschmidt/fix-homebrew-owner-perms.sh
Fix ownership and permissions of a multi-user Homebrew installation
# fix owner of files and folders recursively
sudo chown -vR $(whoami) /usr/local /opt/homebrew-cask /Library/Caches/Homebrew
# fix read/write permission of files and folders recursively
chmod -vR ug+rw /usr/local /opt/homebrew-cask /Library/Caches/Homebrew
# fix execute permission of folders recursively
find /usr/local /opt/homebrew-cask /Library/Caches/Homebrew -type d -exec chmod -v ug+x {} +
@dennyweiss
dennyweiss / language-switch-bookmarklet.js
Last active March 29, 2018 11:58
bookmarklet for switching languages from german to english
javascript:(function() {
/* add this code starting at 'javscript:' as address to a bookmark entry */
var currentUrl = window.location.href;
var targetUrl = null;
var BreakException = {};
var replaceMatrix = [
{ search: '/de/', replace: '/en/'},
{ search: '/de-de/', replace: '/en-us/'}
];
@dennyweiss
dennyweiss / script.sh
Created March 7, 2018 14:36
Remove directory from git history
# unashamed copied from https://stackoverflow.com/a/17824718
RELATIVE_DIRECTORY="node_modules"
git filter-branch --tree-filter "rm -rf ${RELATIVE_DIRECTORY}" --prune-empty HEAD
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
echo "${RELATIVE_DIRECTORY}/ >> .gitignore
git add .gitignore
git commit -m "Removing ${RELATIVE_DIRECTORY} from git history"
git gc
@dennyweiss
dennyweiss / postgres-brew.md
Created April 14, 2017 08:36 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@dennyweiss
dennyweiss / SimpleLogCheck.cs
Created April 11, 2017 10:53 — forked from cknaap/SimpleLogCheck.cs
Easily check ILogger<T> interactions with ASP.NET Core Logging and Moq
using Microsoft.Extensions.Logging;
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Knaap.Utilties
{
@dennyweiss
dennyweiss / pedantically_commented_playbook.yml
Created June 28, 2016 13:04 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.