Skip to content

Instantly share code, notes, and snippets.

Mohammad Dehghan mdunicorn

Block or report user

Report or block mdunicorn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mdunicorn
mdunicorn / activeDirectoryUserSearch.js
Created Mar 18, 2020
A sample node script for searching in Active Directory users, using "activedirectory2" package
View activeDirectoryUserSearch.js
var ActiveDirectory = require('activedirectory2');
var config = { url: 'ldap://sgdc.SYSTEMGROUP.NET',
baseDN: 'dc=systemgroup,dc=net',
username: 'mohammadhd@systemgroup.net',
password: 'your_password' }
var ad = new ActiveDirectory(config);
var query = 'sAMAccountName=MohammadHD';
ad.find(query, function(err, result) {
@mdunicorn
mdunicorn / activeDirectoryTest.js
Created Mar 18, 2020
A test for active directory authentication, using "ldapauth-fork" library
View activeDirectoryTest.js
var LdapAuth = require('ldapauth-fork');
var ldap = new LdapAuth({
url: 'ldap://sgdc.SYSTEMGROUP.NET',
bindDN: "mohammadhd@systemgroup.net",//"CN=MohammadHasan Dehghan,OU=Users,OU=MIS,OU=VNK,OU=SG Main,DC=systemgroup,DC=net",
bindCredentials: 'your_password', // <-- supply a valid email and password
searchBase: 'DC=systemgroup,DC=net',
searchFilter: '(|(samaccountname={{username}})(mail={{username}}))',
reconnect: true
});
@mdunicorn
mdunicorn / TestGrid.xaml
Last active Dec 16, 2015
A simple WPF Grid with two columns, each having 50% of the grid's width. Using *star* sizing, we can distribute remaining space proportionally.
View TestGrid.xaml
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0">Button 1</Button>
<Button Grid.Column="1">Button 2</Button>
</Grid>
You can’t perform that action at this time.