This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var user = System.Security.Principal.WindowsIdentity.GetCurrent(); | |
foreach(var group in user.Groups) | |
{ | |
var x =group.Translate(typeof(System.Security.Principal.NTAccount)); | |
Console.Out.WriteLine(x.Value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using(DirectoryEntry d = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer")) | |
{ | |
using(DirectoryEntry g = d.Children.Find("Administrators", "group")) | |
{ | |
object members = g.Invoke("Members", null); | |
foreach(object member in (IEnumerable)members) | |
{ | |
DirectoryEntry x = new DirectoryEntry(member); | |
Console.Out.WriteLine(x.Name); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using NLog; | |
using NLog.Common; | |
using NLog.Targets; | |
using NLog.Config; | |
namespace ConsoleApplication1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'linkedin' | |
client = LinkedIn::Client.new('api_key', 'api_secret') | |
rtoken = client.request_token.token | |
rsecret = client.request_token.secret | |
puts client.request_token.authorize_url | |
pin = gets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\RubyStack-3.2.3-0>gem install ruby-debug | |
Temporarily enhancing PATH to include DevKit... | |
Building native extensions. This could take a while... | |
ERROR: Error installing ruby-debug: | |
ERROR: Failed to build gem native extension. | |
C:/RubyStack-3.2.3-0/ruby/bin/ruby.exe extconf.rb | |
Can't handle 1.9.x yet | |
*** extconf.rb failed *** | |
Could not create Makefile due to some reason, probably lack of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="cnn.com"><button type="button">CNN</button></a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var scriptsDotChirpDotConfig = @"C:\Users\rstackhouse\Desktop\WellTrak AFE\trunk\CostTrak\UI\Web\Admin\Administration\Scripts\scripts.chirp.config"; | |
var xDoc = XDocument.Load(scriptsDotChirpDotConfig); | |
xDoc.Descendants("FileGroup").ToList().ForEach(x => { | |
//Default for a FileGroup is to minify. Remove the attribute. | |
var attr = x.Attribute("Minify"); | |
if (attr != null) | |
{ | |
attr.Remove(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DirectoryEntry rootEntry = new DirectoryEntry("LDAP://some.ldap.server.com"); | |
rootEntry.AuthenticationType = AuthenticationTypes.None; //Or whatever it need be | |
DirectorySearcher searcher = new DirectorySearcher(rootEntry); | |
searcher.Filter = "(&(objectClass=user)(objectCategory=person)(SAMAccountName=some_user_name)"; | |
foreach(SearchResult result in searcher.FindAll()) | |
{ | |
Console.WriteLine("account name: {0}", result.Properties["samaccountname"].Count > 0 ? result.Properties["samaccountname"][0] : string.Empty); | |
Console.WriteLine("common name: {0}", result.Properties["cn"].Count > 0 ? result.Properties["cn"][0] : string.Empty); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Open a browser window on local machine from C# | |
Process.Start("http://www.cnn.com"); |
OlderNewer