Skip to content

Instantly share code, notes, and snippets.

View matt40k's full-sized avatar

Matt Smith matt40k

View GitHub Profile
@matt40k
matt40k / .gitignore
Created August 30, 2016 13:11
IBM Cognos Framework gitignore
## Ignore IBM Cognos Framework temporary files etc
# See: http://www.ibm.com/support/knowledgecenter/SSEP7J_10.2.2/com.ibm.swg.ba.cognos.dg_fm_sdk.10.2.2.doc/c_objectsyouwilluse.html
# A list of unsaved transactions in the model. When the project is saved, this list is deleted. View contents of this file using View Transaction History.
session-log.xml
# The session-log.xml from the previous session. Using this file, a modeler can run a script to restore the unsaved model transactions in the event of an unexpected interruption in the current session.
session-log-backup.xml
@matt40k
matt40k / ClearDuffReleases.ps1
Last active August 15, 2016 11:51
Remove duff releases
$url = 'https://api.github.com/repos/simsbulkimport/simsbulkimport/releases'
$apiKey = '{{removed}}'
$header = @{"Authorization"="token "+ $apiKey}
$i = 1
do {
#$content = @{tag_name="v1.0.0";target_commitish="master";name="v1.0.0";body="Description of the release";draft=$false;prerelease=$false} | ConvertTo-Json
$r = Invoke-WebRequest -Uri $url -Method GET -Headers $header -Body $content
# Gets a list of excuses from programmingexcuses.com
$url = 'http://programmingexcuses.com/'
$totalLoopCount = 10
$loopCount = 0
$excuses = @()
Function GetExcuse {
$result = Invoke-WebRequest -Uri $url
$lines = $result.Content.Split("`n")
# Note that this version will not descend directories.
function Publish-File {
param (
[parameter( Mandatory = $true, HelpMessage="URL pointing to a SharePoint document library (omit the '/forms/default.aspx' portion)." )]
[System.Uri]$Url,
[parameter( Mandatory = $true, ValueFromPipeline = $true, HelpMessage="One or more files to publish. Use 'dir' to produce correct object type." )]
[System.IO.FileInfo[]]$FileName,
[system.Management.Automation.PSCredential]$Credential
)
$wc = new-object System.Net.WebClient
@matt40k
matt40k / ADGroupsMembers
Created June 13, 2016 22:28
M (PowerQuery) query for querying members of AD Groups
let
Source = ActiveDirectory.Domains("domain.com"),
#"euser eroot eadidom com" = Source{[Domain="domain.com"]}[Object Categories],
group1 = #"euser eroot eadidom com"{[Category="group"]}[Objects],
#"Expanded securityPrincipal" = Table.ExpandRecordColumn(group1, "securityPrincipal", {"sAMAccountName"}, {"securityPrincipal.sAMAccountName"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded securityPrincipal", each Text.StartsWith([securityPrincipal.sAMAccountName], "GROUPNAME")),
#"Expanded group" = Table.ExpandRecordColumn(#"Filtered Rows", "group", {"member"}, {"group.member"}),
#"Expanded group.member" = Table.ExpandListColumn(#"Expanded group", "group.member"),
#"Expanded user" = Table.ExpandRecordColumn(#"Expanded group.member", "group.member", {"mail"}, {"Email Address"}),
#"Filtered Rows1" = Table.SelectRows(#"Expanded user", each [Email Address] <> null),
/*
The following is a simple console application that shows how to change values inside an ODC file. This code can be used in a feature or a console application with all the previous parameter values provided from a configuration file. This code changes the highlighted values in the data connection XML shown above.
*/
namespace UpdateODCFile
{
using System.Linq;
using System.Text;
using System.Xml;
No. of Attempts Age at test Gender Test Centre
31 27 Male Ipswich
27 41 Male Ipswich
26 35 Male Lowestoft
23 25 Male Ipswich
22 30 Male Ipswich
20 27 Male Ipswich
public void Main()
{
bool failure = false;
bool fireAgain = true;
foreach (var ConnMgr in Dts.Connections)
{
Dts.Events.FireInformation(1, "", String.Format("ConnectionManager='{0}', ConnectionString='{1}'",
ConnMgr.Name, ConnMgr.ConnectionString), "", 0, ref fireAgain);
try
{
@matt40k
matt40k / CUBE_NAME
Created May 18, 2016 09:59
Get cube names from SSAS
SELECT
[CUBE_NAME]
FROM
$SYSTEM.MDSCHEMA_CUBES
WHERE
CUBE_SOURCE=1
AND [BASE_CUBE_NAME] < ''
@matt40k
matt40k / dm.sql
Last active May 16, 2016 07:15
Query SIMS db for DocStorage file names etc
SELECT
docType = dt.[description]
,fileName = d.attachment_name
,Name = d.summary
,Note = d.note
,LastModDt = d.last_modification_date
,Type = et.[description]
,Status = s.[description]
,Username = u.[login_name]
,Name = p.[forename] + ' ' + p.[surname]