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
func (ldapConn LdapConn) CompareAndFix(desiredMap map[string]map[string][]string, existingMap map[string]map[string][]string, ignoreMembers bool, update bool) (err error) { | |
// first let's look at entire entries that we can delete | |
sortedExistingEntries := make([]string, 0, len(existingMap)) | |
for dn := range existingMap { | |
sortedExistingEntries = append(sortedExistingEntries, dn) | |
} | |
natsort.Sort(sortedExistingEntries) | |
for _, dn := range sortedExistingEntries { | |
if _, ok := desiredMap[dn]; !ok { | |
log.Printf("Entry %v exists in LDAP, but shouldn't. Deleting", dn) |
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
[{ | |
"uid=joe,ou=users,dc=acme,dc=com": { | |
"uid": "joe", | |
"firstName": "Joe", | |
"lastName": "Jones", | |
"email": "joejones@acme.com", | |
"department": "Sales", | |
"location": "US", | |
"status": "active" | |
} |
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
Write a function that returns a list of all people (uid) based in a specific location that is passed in as a parameter, i.e. myfunc("US") | |
Update the function to take a generic attribute name and a corresponding value as input parameters, i.e. myfunc("location", "US") or myfunc("department", "Sales") | |
Write a function that takes "uid" as an input parameter and returns firstName and lastName | |
Use those functions to find a list of all CA-based Sales people and print their first and last name | |
Use those functions to find a list of all US-based Marketing people and print their first and last name Output this format: "The following employees: firstname lastname, firstname lastname, etc. work in Marketing in the US" |
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
[{ | |
"uid=joe,ou=users,dc=acme,dc=com": { | |
"uid": "joe", | |
"firstName": "Joe", | |
"lastName": "Jones", | |
"email": "joejones@acme.com", | |
"department": "Sales", | |
"location": "US", | |
"status": "active" | |
} |
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
#!/usr/bin/env python | |
def main(): | |
data = [ | |
("uid=joe,ou=users,dc=acme,dc=com", {"uid": "joe", "firstName": "Joe", "LastName": "Jones", "department": "Sales", "location": "US"}), | |
("uid=john,ou=users,dc=acme,dc=com", {"uid": "john", "firstName": "John", "LastName": "Jacobson", "department": "Sales", "location": "CA"}), | |
("uid=joel,ou=users,dc=acme,dc=com", {"uid": "joel", "firstName": "Joel", "LastName": "Johnson", "department": "Marketing", "location": "US"}), | |
("uid=jack,ou=users,dc=acme,dc=com", {"uid": "jack", "firstName": "Jack", "LastName": "Jackson", "department": "Sales", "location": "US"}), | |
("uid=jason,ou=users,dc=acme,dc=com", {"uid": "jason", "firstName": "Jason", "LastName": "Jameson", "department": "Sales", "location": "CA"}), | |
("uid=jeremy,ou=users,dc=acme,dc=com", {"uid": "jason", "firstName": "Jeremy", "LastName": "Jordan", "department": "Marketing", "location": "CA"}), |
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
def blur_emoji(): | |
# emoji_url ="https://emoji.slack-edge.com/T0HQUTCSF/gif/5954cc85a1779a58.gif" | |
emoji_url="https://a.slack-edge.com/production-standard-emoji-assets/14.0/apple-large/1f648.png" | |
Original_emoji = Image.open(requests.get(emoji_url, stream=True).raw) | |
response = urlopen(emoji_url) | |
extension_type =response.info().get_content_type() | |
blurredEmoji="" | |
if extension_type == "image/gif": | |
print("do nothing it's a gif") | |
else: |
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
#!/usr/bin/env python | |
def main(): | |
list_a = [ | |
"joe", | |
"steve", | |
"monica", | |
"scott", | |
"jordan", |
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
#!/usr/bin/env python | |
def main(): | |
list_a = [ | |
"joe", | |
"steve", | |
"monica", | |
"scott", | |
"jordan", |
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
#!/usr/bin/env python | |
import os | |
SEED = 0 | |
def rand(): | |
global SEED | |
SEED = (((((SEED * 24362837402) & 0xFFFFFFFF) + 15) % 0x1000000000000) % 0xffffffff) | |
#print(SEED) | |
return SEED |
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
Write a function that returns a list of all people (uid) based in a specific location that is passed in as a parameter, i.e. myfunc("US") | |
Update the function to take a generic attribute name and a corresponding value as input parameters, i.e. myfunc("location", "US") or myfunc("department", "Sales") | |
Write a function that takes "uid" as an input parameter and returns firstName and lastName | |
Use those functions to find a list of all CA-based Sales people and print their first and last name | |
Use those functions to find a list of all US-based Marketing people and print their first and last name Output this format: "The following employees: firstname lastname, firstname lastname, etc. work in Marketing in the US" |
NewerOlder