Skip to content

Instantly share code, notes, and snippets.

View Greyeye's full-sized avatar

James Hong Greyeye

  • Queensland, Australia
View GitHub Profile
# My UPM's "Path To User Store" value in GPO is
# \\DFSNameSpace\Profiles$\xa6\#company#\#samAccountName#
# result can be like, \\DFSNameSpace\Profiles$\xa6\XYZ Co\Tom.John
# so this script will loop twice (one for list of companies, other for list of users)
#
# This is because I work for Citrix Service Provider and system is multi-tennanted.
# if you only have 1 company, you can remove the for loop at line 34
# most important line is at line 48, this line controls what you target and how its filtered.
# foreach ($file in get-childitem $userpath -recurse -force | where {$_.PSIsContainer -eq $false -and $_.lastwritetime -le $datefilter -and $_.name -ne "desktop.ini"})
#change the number to filter the files OLDER than dates, eg, 90 means select files older than 90
$days = 90
#change silent to $true, if you want to see the remote-item in progress.
$silent = $false
#change profile location
$profileLocation = "E:\Profiles\XA6"
$now=get-date
@Greyeye
Greyeye / aws.js
Created January 14, 2014 03:45
sample EC2 code for aws-sdk
/* use http://localhost:8080/api/:environment/:searchstring
environment and searchstring is case sensitive.
please install express (npm install express)
*/
var aws = require('aws-sdk');
var express = require('express');
var app = express();
aws.config.logger = process.stdout;
@Greyeye
Greyeye / 0_reuse_code.js
Created February 12, 2014 23:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Greyeye
Greyeye / javascript_resources.md
Created February 12, 2014 23:36 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@Greyeye
Greyeye / partial.html
Created February 17, 2014 10:06
to make it download RDP file from node.js
<!-- AngularJS Sample code -->
<a class="btn btn-default" href="" ng-href="http://localhost:8080/rdp/{{PrivateIpAddress}}">{{PrivateIpAddress}}</a></div>
@Greyeye
Greyeye / overflow-control.html
Created February 17, 2014 10:08
CSS overflow control
<div style="max-height:200px;overflow-y:auto;">
some content...
</div>
# Query for volumes that are attached to my Instance Id
$volumes = (Get-EC2Volume).Attachment | where {$_.InstanceId -eq $myInstanceID } | Select VolumeId
@Greyeye
Greyeye / smtp.ps1
Created February 18, 2014 05:38
send email from powershell
#to send email
Send-Email -toAddress 'email@email.com' -subject 'subject' -body "The Upload Log Is Attached." -attachmentLocation 'c:\log\log.txt'
Function Send-Email{
Param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$toAddress,
@Greyeye
Greyeye / create-folder-if-not.ps1
Created February 20, 2014 23:46
create folder if doesnt exists
$path = \\hello\world
if (-Not (Test-Path $path)) {
new-item -ItemType directory -Path $path
}