Skip to content

Instantly share code, notes, and snippets.

View asifiqbal's full-sized avatar

ASIF IQBAL asifiqbal

View GitHub Profile
@asifiqbal
asifiqbal / python_decorator_guide.md
Created September 22, 2024 05:39 — forked from Zearin/python_decorator_guide.md
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

(Mon Apr 2 15:59:31 2018) [sssd[be[LDAP]]] [dp_get_account_info_handler] (0x0200): Got request for [0x1][BE_REQ_USER][idnumber=4311]
(Mon Apr 2 15:59:31 2018) [sssd[be[LDAP]]] [dp_attach_req] (0x0400): DP Request [Account #29]: New request. Flags [0x0001].
(Mon Apr 2 15:59:31 2018) [sssd[be[LDAP]]] [dp_attach_req] (0x0400): Number of active DP request: 1
(Mon Apr 2 15:59:31 2018) [sssd[be[LDAP]]] [sss_domain_get_state] (0x1000): Domain LDAP is Active
(Mon Apr 2 15:59:31 2018) [sssd[be[LDAP]]] [sdap_id_op_connect_step] (0x4000): reusing cached connection
(Mon Apr 2 15:59:31 2018) [sssd[be[LDAP]]] [sdap_search_user_next_base] (0x0400): Searching for users with base [ou=People,dc=mnet,dc=qintra,dc=com]
(Mon Apr 2 15:59:31 2018) [sssd[be[LDAP]]] [sdap_print_server] (0x2000): Searching 151.116.137.34:1636
(Mon Apr 2 15:59:31 2018) [sssd[be[LDAP]]] [sdap_get_generic_ext_step] (0x0400): calling ldap_search_ext with [(&(mnetid=4311)(objectclass=mnetPerson)(uid=*)(&(mnetid=*)(!(mnetid=0))))][ou=People,dc=mnet,
@asifiqbal
asifiqbal / parse-groups.py
Created November 11, 2017 04:45
parse groups
#!/usr/bin/env python
with open('/etc/group') as f:
groups = f.readlines()
mygroups = {}
for ll in groups:
ll = ll.split(':')
if len(ll[3]) > 1:
---
- hosts: localhost
gather_facts: no
roles:
- ldap
vars:
ldap_lookup_config:
url: ldaps://192.168.1.100
base: ou=People,dc=com
binddn: uid=bind,dc=com
---
- hosts: localhost
roles:
- ldap
vars:
ldap_lookup_config:
url: ldaps://192.168.1.100
base: ou=People,dc=com
binddn: uid=bind,dc=com
bindpw: secret
@asifiqbal
asifiqbal / playbook.yml
Created April 12, 2017 20:46
ansible to verify account againts ldap and then push as local account
---
- hosts: localhost
roles:
- ldap
vars:
ldap_lookup_config:
url: ldaps://192.168.1.100
base: ou=People,dc=com
binddn: uid=bind,dc=com
bindpw: secret
@asifiqbal
asifiqbal / Cliref.md
Created March 14, 2017 23:15 — forked from yunga/Cliref.md
CLIRef.md
_________ _____ _______________       _____
\_   ___ \\    \\___________   \____ / ____\     ~/.bash/cliref.md
/    \  \/|    | |   ||       _/ __ \  __\    copy/paste from whatisdb
\     \___|__  |_|_  ||    |   \  __/|_ |   http://pastebin.com/yGmGiDQX
 \________  /_____ \_||____|_  /____  /_|     [email protected]
 20160515 \/ 1527 \/         \/     \/

alias CLIRef.txt='curl -s "http://pastebin.com/raw/yGmGiDQX" | less -i'

---
- hosts: all
gather_facts: no
tasks:
- shell: ls ratelimit.log*
args:
chdir: /var/named/var/log/named
register: ratelimitlogs
---
- hosts: all
gather_facts: no
tasks:
- shell: ls ratelimit.log*
args:
chdir: /var/named/var/log/named
register: ratelimitlogs
@asifiqbal
asifiqbal / vagrant network interface error
Created September 9, 2016 18:03
vagrant error: Configuring and enabling network interfaces
==> default: Configuring and enabling network interfaces...
INFO ssh: SSH is ready!
INFO ssh: Execute: (sudo=false)
ERROR warden: Error occurred: Vagrant attempted to execute the capability 'configure_networks'
on the detect guest OS 'linux', but the guest doesn't
support that capability. This capability is required for your
configuration of Vagrant. Please either reconfigure Vagrant to
avoid this capability or fix the issue by creating the capability.
INFO warden: Beginning recovery process...
INFO warden: Calling recover: #<Vagrant::Action::Builtin::HandleForwardedPortCollisions:0x000000024ff478>