Skip to content

Instantly share code, notes, and snippets.

View tasdikrahman's full-sized avatar
💭
Automate everything

Tasdik Rahman tasdikrahman

💭
Automate everything
View GitHub Profile
"""
Create a new number C from A and B (both non -ve’s)
- 1st digit of C = 1st digit of A
- 2nd digit of C = 1st digit of B
- 3rd digit of C = 2nd digit of A
- 4th digit of C = 2nd digit of B
- so on
Rules
- A & B are non -ve’s
# Requirements:
# - upper case characters >= 1
# - no digits
# I/p
# S -> len(S) = N
# O/P -> len(longest_substring) which passes requirements
import re
from string import ascii_uppercase
acl = AccessControlList()
acl.resource_read_rule(everyone_role, 'GET', '/api/v1/employee/1/info')
acl.resource_delete_rule(admin_role, 'DELETE', '/api/v1/employee/1/')
# checking READ operation on resource for user `everyone_user`
for user_role in [role.get_name() for role in everyone_user.get_roles()]:
assert acl.is_read_allowed(user_role, 'GET', '/api/v1/employee/1/info') == True
# checking WRITE operation on resource for user `everyone_user`
$ ls -la roles
total 0
drwxr-xr-x 13 tasdik tasdik 442 May 23 14:28 .
drwxr-xr-x 20 tasdik tasdik 680 May 24 11:05 ..
-rw-r--r-- 1 tasdik tasdik 0 May 23 14:28 ansible.cfg
drwxr-xr-x 6 tasdik tasdik 204 May 23 14:28 ovirt-collect-logs
drwxr-xr-x 6 tasdik tasdik 204 May 23 14:28 ovirt-common
drwxr-xr-x 6 tasdik tasdik 204 May 23 14:28 ovirt-engine-backup
drwxr-xr-x 7 tasdik tasdik 238 May 23 14:28 ovirt-engine-cleanup
drwxr-xr-x 6 tasdik tasdik 204 May 23 14:28 ovirt-engine-config
[root@centos-4gb-blr1-ovirt-engine ~]# yum update
[root@centos-4gb-blr1-ovirt-engine ~]# yum install http://resources.ovirt.org/pub/yum-repo/ovirt-release41.rpm
[root@centos-4gb-blr1-ovirt-engine ~]# yum -y install ovirt-engine
[root@centos-4gb-blr1-ovirt-engine ~]# engine-setup
[ INFO ] Stage: Initializing
[ INFO ] Stage: Environment setup
Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging-jboss.conf', '/etc/ovirt-engine-setup.conf.d/10-packaging.conf']
Log file: /var/log/ovirt-engine/setup/ovirt-engine-setup-20170520124451-wvuuny.log
Version: otopi-1.6.1 (otopi-1.6.1-1.el7.centos)
[ INFO ] Stage: Environment packages setup
>>> from markovipy.markovipy import MarkoviPy
>>>
>>> obj = MarkoviPy("/Users/tasrahma/development/projects/markovipy/corpus/shakespeare/hamlet_utf8.txt", 3)
>>> obj.generate_sentence()
'If his occulted guilt, Do not it selfe vnkennell in one speech, It is most retrograde to our desire And we beseech you, bend you to remaine Heere in the cheere and comfort of our eye, Our cheefest Courtier Cosin, and our whole Kingdome To be contracted in one brow of woe Yet so farre hath Discretion fought with Nature, That we with wisest sorrow thinke on him, Together with remembrance of our selues.'
>>> obj.generate_sentence()
'Fare you well my Lord Ham.'
>>> obj.generate_sentence()
'To thinke, my Lord? Ham.'
@tasdikrahman
tasdikrahman / npm-remove-global-install.md
Created April 8, 2017 11:35
By default npm packages would be installed in the root dir, change it to install the npm packages to the non-root user.
@tasdikrahman
tasdikrahman / deployment-tool-ansible-puppet-chef-salt.md
Created April 8, 2017 06:49 — forked from jaceklaskowski/deployment-tool-ansible-puppet-chef-salt.md
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@tasdikrahman
tasdikrahman / deployment-tool-ansible-puppet-chef-salt.md
Created April 8, 2017 06:49 — forked from jaceklaskowski/deployment-tool-ansible-puppet-chef-salt.md
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution