Skip to content

Instantly share code, notes, and snippets.

@remitaffin
remitaffin / tail_mongos.py
Last active December 6, 2019 20:42
python tail_mongos.py
import os
import subprocess
import statsd
filename = '/var/log/mongo/mongos.log'
graphite_host = 'statsd.hostedgraphite.com'
graphite_api_key = os.environ['GRAPHITE_API_KEY']
f = subprocess.Popen(
DATABASE_URL=postgres://saleor:saleor@db/saleor
DEFAULT_FROM_EMAIL=noreply@example.com
OPENEXCHANGERATES_API_KEY=
CACHE_URL=redis://redis:6379/0
CELERY_BROKER_URL=redis://redis:6379/1
SECRET_KEY=changeme
JWT_VERIFY_EXPIRATION=True
VATLAYER_ACCESS_KEY=
@remitaffin
remitaffin / index_redis.py
Created September 7, 2019 13:09
index_redis.py
import time
import redis
from flask import Flask
app = Flask(__name__)
cache = redis.Redis(host='redis', port=6379)
def get_hit_count():
@remitaffin
remitaffin / index.py
Created September 5, 2019 21:19
index.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello OG World!"
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=True)
@remitaffin
remitaffin / clear_cache_github_jenkins_auth
Created August 16, 2019 21:25
Clean Cache Github Jenkins Auth
# /script
org.jenkinsci.plugins.GithubAuthenticationToken.clearCaches();
@remitaffin
remitaffin / .codeclimate.yml
Created June 4, 2019 20:16
codeclimate.yml example
engines:
duplication:
enabled: true
config:
languages:
- python
fixme:
enabled: true
radon:
enabled: true
@remitaffin
remitaffin / Dockerfile
Created April 19, 2019 16:09
Basic Dockerfile to be used for testing
FROM python:3.6
ARG SSH_PRIV_KEY
RUN mkdir /root/.ssh/ && echo "${SSH_PRIV_KEY}" | base64 -d > /root/.ssh/id_rsa && chmod 400 /root/.ssh/id_rsa
# Required for cloning git repos
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan -H github.com > /root/.ssh/known_hosts
# Path to requirements.txt might need to be updated here depending on the application
#!/bin/bash
# This script kills running containers, old stopped containers,
# and dangling images.
# Set -e exits the script if any command has a non-zero exit status
# Set -u returns an error when a variable is unknown instead of silently ignore it
# Set -o pipefail prevents errors in a pipeline (sequence of |) from being masked
set -euo pipefail
IFS=$'\n\t'
@remitaffin
remitaffin / docker-compose-stellar-testnet.yml
Created May 28, 2018 00:18
stellar-horizon-testnet docker-compose
version: '3'
services:
postgres-core:
image: postgres:9.6
volumes:
- "/var/lib/stellar/postgres-core:/var/lib/postgresql/data"
environment:
- POSTGRES_DB=stellar-core
stellar-core:
image: satoshipay/stellar-core
@remitaffin
remitaffin / docker-compose-stellar-prodnet.yml
Last active July 31, 2019 12:32
stellar-horizon-prodnet docker-compose
version: '3'
services:
postgres-core:
image: postgres:9
volumes:
- "/var/lib/stellar/postgres-core:/var/lib/postgresql/data"
environment:
- POSTGRES_DB=stellar-core
stellar-core:
build: .