Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)| # Prometheus configuration to scrape Kubernetes outside the cluster | |
| # Change master_ip and api_password to match your master server address and admin password | |
| global: | |
| scrape_interval: 15s | |
| evaluation_interval: 15s | |
| scrape_configs: | |
| # metrics for the prometheus server | |
| - job_name: 'prometheus' |
| #!/bin/bash | |
| log=/var/log/syslog.log | |
| api_url='https://api.hipchat.com/v1/rooms/message?auth_token=XXXXXXXXXX' | |
| tail -f $log|grep --line-buffered 'XXXXXXX'|while read line;do | |
| msg=`echo "$line" | cut -d' ' -f5-` | |
| echo 'Got' $msg | |
| curl $api_url -vv -d "room_id=ops&from=Syslog¬ify=1&color=yellow&message_format=text" --data-urlencode "message=$msg @notsobad" |
| #!/usr/bin/python | |
| # | |
| # This is a rough Python script that demonstrates running AutoPkg with Jenkins | |
| # as only a "check" action, using the ScriptTrigger plugin. It's assumed | |
| # that AutoPkg is running directly out of a Git checkout from somewhere, but | |
| # this is not necessary. | |
| # | |
| # Also note that the the '-d' option is given to hardcoded recipe | |
| # search directories. | |
| # |
| # taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/ | |
| # generate server.xml with the following command: | |
| # openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes | |
| # run as follows: | |
| # python simple-https-server.py | |
| # then in your browser, visit: | |
| # https://localhost:4443 | |
| import BaseHTTPServer, SimpleHTTPServer | |
| import ssl |
Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)##Google Interview Questions: Product Marketing Manager
| #!/usr/bin/env python | |
| """A simple Bloom Filter implementation | |
| Calculating optimal filter size: | |
| Where: | |
| m is: self.bitcount (how many bits in self.filter) | |
| n is: the number of expected values added to self.filter | |
| k is: the number of hashes being produced | |
| (1 - math.exp(-float(k * n) / m)) ** k | |
| http://en.wikipedia.org/wiki/Bloom_filter | |
| """ |
| #!/usr/bin/env python | |
| """ | |
| Very simple HTTP server in python (Updated for Python 3.7) | |
| Usage: | |
| ./dummy-web-server.py -h | |
| ./dummy-web-server.py -l localhost -p 8000 | |
| Send a GET request: |