Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am msmorul on github.
  • I am msmorul (https://keybase.io/msmorul) on keybase.
  • I have a public key ASC-Kx4yYIAj2zC6DtVGexYDLEuDiAMXxFnsWhG0d-d30wo

To claim this, I am signing this object:

View cleanfolderperms.ps1
$user = "NT User:S-1-5-21-579602563-1105609867-1454996784-1641"
$mailbox = "someuser@contoso.com"
$folders = @(Get-MailboxFolderStatistics $mailbox | Where {!($exclusions -icontains $_.FolderPath)} | Select FolderPath)
foreach ($origFolder in $folders) {
$id = $mailbox + ":" + $origFolder.FolderPath.Replace('/','\')
# Uncomment this to list all unattached sids
# get-MailboxFolderPermission -Identity $id | where {$_.user -like "*S-1-5*"}
# Remove dead permissions
if ($perm = get-MailboxFolderPermission -Identity $id -user $user -ErrorAction SilentlyContinue) {
remove-MailboxFolderPermission -Identity $id -user $user -Confirm:$false -ErrorAction STOP
View getMonday.ps1
function getMonday {
$days="Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"
return (Get-Date).AddDays(-([array]::IndexOf($days,(Get-Date).DayOfWeek.ToString())-1))
}
@msmorul
msmorul / main.c
Created Nov 12, 2015
serial boot loader for a pic12f1822
View main.c
/*
* File: main.c
* Author: toaster
*
* Created on November 5, 2015, 8:45 PM
*/
#include <xc.h> /* XC8 General Include File */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@msmorul
msmorul / create-uid.ps1
Created Nov 5, 2015
Example script showing how to create the aut-generated unix uid for centrify
View create-uid.ps1
param (
[string]$username = $(throw "-username is required.")
)
#
# Load Account Details
#
$user = Get-ADObject -Filter {(sAMAccountName -eq $username)} -Properties 'ObjectSID','uidNumber'
$sidStr = $user.ObjectSID
"Found ObjectSID: {0} for {1}" -f $sidStr,$username
#
@msmorul
msmorul / halloween.py
Last active Oct 31, 2015
Quick hack to have an HC-sr04 play an mp3 or a scary sound when something comes near.
View halloween.py
import RPi.GPIO as GPIO
import time
from pygame import mixer
import random
GPIO.setmode(GPIO.BCM)
TRIG = 23
ECHO = 24
#
# background music
View du.ps1
#
# Print a summary of disk usage in the supplied directory
# -directory <directory>
#
Param(
[parameter(Mandatory=$true)]
[alias("d")]
$directory
)
View ko.simplegrid.js
// based on the grid from: http://knockoutjs.com/examples/resources/knockout.simpleGrid.3.0.js
// configuration: columns: {headerText, rowText (fn or property name,) headerClass, cellTemplate}
(function () {
// Private function
function getColumnsForScaffolding(data) {
if ((typeof data.length !== 'number') || data.length === 0) {
return [];
}
var columns = [];
for (var propertyName in data[0]) {
@msmorul
msmorul / class.smbAccessDriver.php.class
Created Oct 23, 2014
patch for fixing zipping files over the smb driver in pyd.io
View class.smbAccessDriver.php.class
--- class.smbAccessDriver.php.orig 2014-10-23 11:15:47.699206429 -0400
+++ class.smbAccessDriver.php 2014-10-23 11:21:50.423194343 -0400
@@ -86,16 +86,33 @@
require_once(AJXP_BIN_FOLDER."/pclzip.lib.php");
$filePaths = array();
foreach ($src as $item) {
- $realFile = call_user_func(array($this->wrapperClassName, "getRealFSReference"), $this->urlBase.(($item[0] == "/")? "" : "/").AJXP_Utils::securePath($item));
- $basedir = trim(dirname($realFile))."/";
- $filePaths[] = array(PCLZIP_ATT_FILE_NAME => $realFile,
- PCLZIP_ATT_FILE_NEW_SHORT_NAME => basename($item));
@msmorul
msmorul / sid-convert.py
Created Apr 23, 2014
convert windows sid to uid for centrify express
View sid-convert.py
#!/usr/bin/python
#
# Convert windows sid to centrify express generated uid
# http://community.centrify.com/t5/DirectControl-Express-for-UNIX/RE-Evaluating-Centrify-Express-Now-And-Have-Some-Questions/td-p/3174
import argparse
import re
def sid(value):
sidrx = re.compile('^S-1-5-\d{2}-\d+-(\d{4,10})-\d+-(\d+)$')
m = sidrx.match(value)
You can’t perform that action at this time.