Skip to content

Instantly share code, notes, and snippets.

@dbirks
dbirks / clean-build.sh
Created Sep 30, 2020
Clean build an Arch Linux package inside a container
View clean-build.sh
#!/bin/sh
set -o errexit
trap "docker rm --force lens-build" EXIT
docker pull archlinux
docker run \
--detach \
@dbirks
dbirks / migrate-git-repos.md
Last active Jul 19, 2022
Script to fully migrate git repos, including all tags and branches
View migrate-git-repos.md

Migrate git repos script

I used this for migrating git repos from Bitbucket to Github. It uses git's --mirror flag for cloning and pushing to also transfer all tags and branches.

It would be helpful to have SSH keys set up on both ends. Then all you should have to do is to make sure the hardcoded orgname is set to the appropriate one for both the source and destination.

Once I migrated repos, I used this to replace my origin url locally (assumes using ssh):

sed -i s/bitbucket.org:orgname/github.com:orgname/g .git/config
@dbirks
dbirks / google-analytics-for-static-sites.sh
Created Feb 8, 2018 — forked from stevenscg/google-analytics-for-static-sites.sh
Add Google Analytics tracking to an existing static website
View google-analytics-for-static-sites.sh
#!/bin/sh
#
# Add a Google Analytics tag to static website files
# @see http://adambuchanan.me/post/26345221717/updating-google-analytics-code-on-many-static-pages
# Tested on MacOS 10.8.X
#
# Usage:
# Set the GA parameters below
# Execute the script from the top-level of the static site
#
@dbirks
dbirks / shared-inbox-notes.md
Last active May 11, 2018
Exchange shared inbox notes
View shared-inbox-notes.md

Exchange shared inbox notes

Copy sent emails to the shared inbox's sent folder

For emails sent as from the shared inbox, make a copy of the email in the shared inbox's sent items folder as well.

set-mailbox <mailbox name> -MessageCopyForSentAsEnabled $True
@dbirks
dbirks / helpful-powershell-commands.md
Last active Jun 21, 2018
Helpful Powershell commands
View helpful-powershell-commands.md

Helpful Powershell commands

Add a computer to the domain

Add-Computer -DomainName corp.contoso.com 

I've found the FQDN is required in my environment.

@dbirks
dbirks / chan-setup-notes
Last active Dec 8, 2017
chan setup notes
View chan-setup-notes
https://github.com/arisu-dev/arisuchan
debian 9
apt install git apache2 mysql-server php php-mbstring php-gd php-pdo imagemagick php-mysql php-mcrypt
systemctl enable --now apache2
mysql_secure_installation
@dbirks
dbirks / change-room-booking.md
Created Nov 2, 2017
Change how far in advance you can book a room in Exchange
View change-room-booking.md

For Office 365, the default time into the future you can book a room looks to be 180 days. Find out the current time with:

Get-CalendarProcessing -Identity "Conference Room" | select BookingWindowInDays

You can then set the window to the maximum of 1080 days with:

Set-CalendarProcessing -Identity "Conference Room" -BookingWindowInDays 1080
@dbirks
dbirks / arch-install-notes.md
Last active Jul 27, 2018
Arch install notes
View arch-install-notes.md

Rank repo mirrors

rankmirrors is included in the pacman-contrib package.

Make a backup, then run the rankmirrors script through sed to remove some extra commented-out lines.

mv /etc/pacman.d/mirrorlist{,.old}
@dbirks
dbirks / mailbox-recursive-access.md
Last active Oct 19, 2017
Give a user access recursively to another mailbox's folders
View mailbox-recursive-access.md

Give a user access recursively to another mailbox's folders

I was running into a problem giving a user access to another user's mailbox, where the user was only getting permission to view the top level folders, while the subfolders had no viewing permissions set on them.

Here's the way to set permissions on each folder recursively if all else fails.

In this example, we are giving Mike editor privileges on Kukuri's mailbox folders.

ForEach($f in (Get-MailboxFolderStatistics kukuri@company.com | Where { $_.FolderPath.Contains("/") -eq $True } ) ) {