- What do Etcd, Consul, and Zookeeper do?
- Service Registration:
- Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
- Service Discovery:
- Ability for client application to query the central registry to learn of service location.
- Consistent and durable general-purpose K/V store across distributed system.
- Some solutions support this better than others.
- Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
- Service Registration:
- Centralized locking can be based on this K/V store.
๐
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
| @Grapes([ | |
| @Grab(group='org.gperfutils', module='gbench', version='[0.4,)'), | |
| @Grab(group='org.apache.commons', module='commons-lang3', version='[3.7,)'), | |
| @Grab(group='joda-time', module='joda-time', version='[2.9.9,)') | |
| ]) | |
| /** | |
| * Java 8 DateTimeFormatter | |
| */ | |
| import java.util.Date; |
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
| # This demo is a transliteration of the below referenced demo to use the async/await syntax | |
| # | |
| #https://www.reddit.com/r/Python/comments/33ecpl/neat_discovery_how_to_combine_asyncio_and_tkinter/ | |
| # | |
| # For testing purposes you may use the following command to create a test daemon: | |
| # tail -f /var/log/messages | nc -l 5900 | |
| # Enter localhost:5900 in the entry box to connect to it. | |
| from tkinter import * |
Suppose you want to inject a credential into a Pipeline script. The cloudbees note does not include Pipeline script examples. https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs
The Jenkins Pipeline Docs' description of the git pushmethod doesn't have an example using injected credentials.
(https://jenkins.io/doc/pipeline/examples/#push-git-repo)
The Snippet generator is helpful, but not not if you try to follow the instructions at: https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin
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
| """ | |
| Usage: python script.py search_string replace_string dir | |
| Eg. python batchreplace.py galleries productions /Sites/cjc/application/modules/productions/ | |
| And it will search recursively in dir | |
| and replace search_string in contents | |
| and in filenames. | |
| Case-sensitive | |
| """ | |
| from sys import argv |
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
| //Gist note this is snippet from root build.gradle in project with subprojects | |
| checkstyle { | |
| // use one common config file for all subprojects | |
| configFile = project(':').file('config/checkstyle/checkstyle.xml') | |
| configProperties = [ "suppressionFile" : project(':').file('config/checkstyle/suppressions.xml')] | |
| } |
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
| upstream fuel { | |
| # Defines a group of servers. Servers can listen on different ports. | |
| server IP:PORT fail_timeout=0; | |
| } | |
| upstream frontend { | |
| server IP:PORT fail_timeout=0; | |
| } |
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 _convert_java_millis(java_time_millis): | |
| """Provided a java timestamp convert it into python date time object""" | |
| ds = datetime.datetime.fromtimestamp( | |
| int(str(java_time_millis)[:10])) if java_time_millis else None | |
| ds = ds.replace(hour=ds.hour,minute=ds.minute,second=ds.second,microsecond=int(str(java_time_millis)[10:]) * 1000) | |
| return ds | |
| def _convert_datetime_java_millis(st): | |
| """Provided a python datetime object convert it into java millis""" |
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 differ(loan, rate, t, accuracy=2): | |
| list_pay_per_month = [] | |
| body_of_loan = loan | |
| month_count = t * 12 | |
| body_per_month = loan / month_count | |
| sum = 0 | |
| for _ in range(month_count): | |
| interest = body_of_loan * rate / 12 | |
| pay_per_month = interest + body_per_month |
NewerOlder