Skip to content

Instantly share code, notes, and snippets.

View dennythecoder's full-sized avatar

Denny dennythecoder

View GitHub Profile
@dennythecoder
dennythecoder / script.js
Last active May 24, 2018 00:40
PDFJS Wrapper to handle DD Form 2875.
/*
Usage:
const file = document.getElementById('a_file').files[0];
const fh = new FileHandler(file);
console.log(fh.fields.name, fh.fields.email);
*/
function JSAssert_print() {
var win=window.open("","_blank","width=400,height=300,toolbar=no,scrollbars=yes");
win.document.writeln("<TITLE>JSUnit</TITLE><PRE>");
win.document.writeln(""+this.count+" test(s): "+this.done+" ok, "+this.failed+" failed\n---");
win.document.writeln(this.text);
win.document.close();
}
function JSAssert_add(f, t) {
this.count++;
(function(){
var href = location.href;
if(href.indexOf('logout') !== -1){return ;}
var userAgree = sessionStorage.getItem('user_agree');
if(userAgree !== 'true'){
var msg = 'You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only.\n' +
'By using this IS (which includes any device attached to this IS), you consent to the following conditions:\n'+
@dennythecoder
dennythecoder / openSchema.js
Last active January 25, 2019 04:22
Open Schema Values enumerated
/*
Open Schema Values enumerated in JavaScript
https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/schemaenum?view=sql-server-2017
*/
const openSchema = {
adSchemaAsserts: 0,
adSchemaCatalogs: 1,
adSchemaCharacterSets: 2,
adSchemaCheckConstraints: 5,
@dennythecoder
dennythecoder / SP Rest Get Lists.js
Created November 8, 2019 01:59
SP 2010 Get List example
function getList(name, cb){
var serviceUrl = 'http://yoursite/_vti_bin/listdata.svc/';
var xhr = new XMLHttpRequest();
xhr.open('GET', serviceUrl + name);
xhr.setRequestHeader('accept', 'application/json;odata=verbose');
xhr.onreadystatechange = function(){
if(this.readyState === 4){
var obj = JSON.parse(this.response);
cb(obj.d.results);

Run PowerShell as Admin

$machineName = "MachineName"
Enable-PSRemoting -force 
Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value $machineName
Enter-PSSession -ComputerName $machineName -Credential (Get-Credential)
function Create-SPPermissionsReport($path , $isRecursive)
{
$web = (Get-SPWeb $path)
$users = (Get-SPUser -web $web -Limit ALL)
$users | ForEach {
[pscustomobject]@{
'Name' = $_.Name
'Email' = $_.Email
'UserLogin' = $_.UserLogin
@dennythecoder
dennythecoder / SharePoint Most Recent ULS.ps1
Created January 6, 2020 05:40
Get the most recent SharePoint ULS
$version = "15"
(ls "C:\program files\common files\microsoft shared\web server extensions\$version\logs\$env:COMPUTERNAME*.log" | sort LastWriteTime -Descending )[0]
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('yourname', MD5('mysecretpassword'), 'firstname lastname', 'you@your-domain.com', '0');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');