Skip to content

Instantly share code, notes, and snippets.

View NorakGithub's full-sized avatar
🎯
Focusing

Khemanorak Khath NorakGithub

🎯
Focusing
View GitHub Profile
@NorakGithub
NorakGithub / java.security
Created January 21, 2022 03:39
nCipherKM
#
# This is the "master security properties file".
#
# An alternate java.security properties file may be specified
# from the command line via the system property
#
# -Djava.security.properties=<URL>
#
# This properties file appends to the master security properties file.
# If both properties files specify values for the same key, the value

Python Virtual Environment

Why do you need Python virtual environment? Because we don't want to messed up Python installed with the MacOS.

Who is this for?

  • Of course you are a Python Developer.
  • Work with multiple Python versions.
  • Work with multiple Python projects.
user root;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@NorakGithub
NorakGithub / sendgrid.py
Created May 27, 2019 10:13
SendGrid Python API Client for Sending Email
import requests
class SendGrid:
def __init__(self, **kwargs):
self.api_key: str = kwargs.get('api_key')
self.subject: str = kwargs.get('subject')
self.sender: str = kwargs.get('sender')
self.receivers: [str] = kwargs.get('receivers')
self.content_type: str = kwargs.get('content_type', 'text/plain')
>>> from ldap3 import Server, Connection, ALL
>>> server = Server('localhost', get_info=ALL)
>>> conn = Connection(server, 'cn=admin,dc=codium,dc=com', 'codium123', auto_bind=True)
>>> conn.search('dc=codium,dc=com', '(objectclass=person)')
True
>>> conn.entries
[DN: cn=Htet Naing Aung,ou=people,dc=codium,dc=com - STATUS: Read - READ TIME: 2016-12-27T21:23:11.662103
, DN: cn=Than Htike Aung,ou=people,dc=codium,dc=com - STATUS: Read - READ TIME: 2016-12-27T21:23:11.662241
]
>>> conn.add('cn=Noark,ou=people,dc=codium,dc=com', ['inetOrgPerson', 'organizationalPerson', 'person', 'top'], {'cn': 'Norak', 'sn': 'Khath', 'mail': 'norak@codium.com'})