Skip to content

Instantly share code, notes, and snippets.

View dennyweiss's full-sized avatar

Denny Weiß dennyweiss

View GitHub Profile
@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.
@dennyweiss
dennyweiss / phpspec-phpstorm-watcher-run.sh
Created June 11, 2016 10:45
Run phpspec through phpstorm filewatcher
#!/usr/bin/env bash
FILE_PATH="${1}"
PHPSPEC_PATH="bin/phpspec"
if [[ "${FILE_PATH}" == "" ]]; then
echo "File path missing"
exit 1
#
# REQUIRES:
# - server (the forge server instance)
# - site_name (the name of the site folder)
# - sudo_password (random password for sudo)
# - db_password (random password for database user)
# - event_id (the provisioning event name)
# - callback (the callback URL)
#