This file contains hidden or 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
| Below are the Big O performance of common functions of different Java Collections. | |
| List | Add | Remove | Get | Contains | Next | Data Structure | |
| ---------------------|------|--------|------|----------|------|--------------- | |
| ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array | |
| LinkedList | O(1) | O(1) amortized | O(n) | O(n) | O(1) | Linked List | |
| CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array | |
This file contains hidden or 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
| location / { | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-NginX-Proxy true; | |
| proxy_set_header X-Forwarded-Proto $scheme; | |
| proxy_pass http://localhost:9000; | |
| proxy_redirect http://localhost:9000 http://dzodzikov.com; | |
| } |
This file contains hidden or 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
| location /portainer/ { | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-NginX-Proxy true; | |
| proxy_set_header X-Forwarded-Proto $scheme; | |
| proxy_pass http://localhost:9000/; | |
| proxy_redirect http://localhost:9000/ http://dzodzikov.com/portainer/; | |
| } |
This file contains hidden or 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
| /** | |
| * Runs remote Jenkins job and waits for it to finish | |
| * | |
| * Use in Gitlab CI YAML as follows: | |
| * mvn -q groovy:execute -Dsource=ci/execute-remote-job.groovy -Durl=URL -DjobName=NAME -Dlogin=LOGIN -Dpassword=PASS -Dparameters.one=ONE -Dparameters.two=TWO | |
| * | |
| * Expects as input: | |
| * url - URL of Jenkins | |
| * jobName - name of the job | |
| * login - login of the user of Jenkins |
This file contains hidden or 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 factorial(number: Int): Int = { | |
| def factorialIter(multiple: Int, nextNumber: Int): Int = { | |
| if (nextNumber == 1) multiple else factorialIter(multiple * nextNumber, nextNumber - 1) | |
| } | |
| factorialIter(number, number - 1) | |
| } |
This file contains hidden or 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
| # deploy under "path" context path | |
| curl --upload-file appplication-0.1-1.war "http://tomcat:tomcat@localhost:8080/manager/deploy?path=/application-0.1-1 | |
| # undeploy | |
| curl "http://tomcat:tomcat@localhost:8080/manager/undeploy?path=/application-0.1-1" | |
| # ! tomcat7 uses /manager/text/undeploy and /manager/text/deploy paths | |
| # tomcat6-admin (debian) or tomcat6-admin-webapps (rhel) has to be installed | |
| # tomcat-users.xml has to be setup with user that has admin, manager and manager-script roles |
This file contains hidden or 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 send_request(url, data, method, content_type): | |
| """ | |
| Send HTTP request and return response | |
| """ | |
| opener = urllib2.build_opener(urllib2.HTTPHandler) | |
| request = urllib2.Request(url, data=data) | |
| request.add_header('Content-Type', content_type) | |
| request.get_method = lambda: method | |