Skip to content

Instantly share code, notes, and snippets.

View mikeplate's full-sized avatar

Mikael Plate mikeplate

View GitHub Profile
@mikeplate
mikeplate / html.snippets
Created November 13, 2012 11:00
Snipmate Snippet for HTML
snippet doc
<html>
<head>
<title>${1}</title>
</head>
<body>
${2}
</body>
</html>
snippet doc2
@mikeplate
mikeplate / launch-command.c
Created November 27, 2012 16:22
Execute script in sub folder with same name
/* Launch Command
*
* This program will search for an executable with the same name, or with extra file extension
* ".sh", in all sub folders and execute it if such a file exists.
*
* I've written this program since I didn't like that you can't double click Bash script files in
* Nautilus file manager on Ubuntu and have them executed immediately without changing settings.
* With this program, I can have Bash script files in sub folder(s) and have them executed
* immediately when the user double clicks this program.
*/
@mikeplate
mikeplate / gist:4351975
Created December 21, 2012 10:21
Active Directory User Handling
# List all users
$filter = "(&(objectClass=user)(objectCategory=person))"
$users = ([adsiSearcher]$filter).findall()
$users | %{ $_.Properties['displayname'] }
# Sort
$users | %{ $_.Properties['displayname'] } | sort
# Filter by part of name
$users | %{ $_.Properties['displayname'] } | where { $_ -match "John" }
@mikeplate
mikeplate / gist:4556985
Created January 17, 2013 15:57
Search all columns in all tables for a specific text
set nocount on;
declare @TableName nvarchar(200)
declare @SchemaName nvarchar(200)
declare @ColumnName nvarchar(200)
declare @Sql nvarchar(4000)
declare @SearchValue nvarchar(200)
declare @Count int
-- Change the value below to the value to search for.
<!DOCTYPE html>
<title>Curly Shadow</title>
<style>
body {
margin: 0px;
font-family: Calibri, sans-serif;
background-color: #eee;
}
* {
-webkit-box-sizing: border-box;
<!DOCTYPE html>
<title>Box Flip</title>
<style>
body {
margin: 0px;
font-family: Calibri, sans-serif;
background-color: #eee;
}
* {
-webkit-box-sizing: border-box;
@mikeplate
mikeplate / ColumnUsage.ps1
Created August 6, 2013 06:08
Find all Content Types and Lists where a particular column is used within a site collection
param (
[String]$SiteUrl = 'http://spdev',
[String]$FieldName = 'Title'
)
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$site = Get-SPSite $SiteUrl
"Showing where ""$FieldName"" is used"
@mikeplate
mikeplate / StartHyperMachine.ps1
Last active December 23, 2015 08:49
Start Remote Desktop Client against a locally running Hyper-V virtual machine by finding out the actual IP number
Param (
[string]$VirtualMachineName,
[switch]$FullScreen,
[string]$Width = '1600',
[string]$Height = '900'
)
function WaitAndExit() {
Write-Host "Press any key to exit script"
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null
@mikeplate
mikeplate / web.config
Created October 3, 2013 11:50
Parts extracted from web.config in order to map .js file extension as an ordinary aspx page
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation>
<buildProviders>
<remove extension=".js"/>
<add extension=".js" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
</compilation>
</system.web>
@mikeplate
mikeplate / float-clear.html
Last active December 28, 2015 20:49
Autoclear a container's floating children
<!DOCTYPE HTML>
<html>
<head>
<title>Clearing My Floats</title>
<style>
body {
font-family: Calibri, sans-serif;
font-size: 14pt;
width: 990px;
margin: 0px auto;