Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Davies justindavies

View GitHub Profile
View Dockerfile-Inklin
# build environment
FROM node as builder
ARG REACT_APP_SHA
ENV REACT_APP_SHA=${REACT_APP_SHA}
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY package.json /usr/src/app/package.json
RUN npm install -g -s --no-progress yarn
View nginx-rendertron.conf
server {
listen 80;
listen [::]:80;
root /usr/share/nginx/html;
index index.html;
location / {
View crypto_patterns.py
from flask import Flask, make_response
from pymongo import MongoClient
import numpy as np
import talib
from talib import abstract
from talib.abstract import *
import json
import datetime
import numpy as np
import StringIO
View Get Block
import urllib, json
url = "http://api.inkl.in/api/inklin/live/0"
response = urllib.urlopen(url)
data = json.loads(response.read())
print "Starting from " + str(data["block_number"])
View Generate sitemaps
for x in range(int(data["block_number"]), 1, -1):
line = line + "<url>\n"
line = line + "<loc>http://inkl.in/"+str(x)+ "</loc>\n"
line = line + "<changefreq>never</changefreq>"
line = line + "</url>\n"
counter=counter+1
if counter == 50000:
counter = 1
print("Writing " + str(filename))
View Generate index
sitemapindex = '<?xml version="1.0" encoding="UTF-8"?>\n'
sitemapindex = sitemapindex + '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'
for file in glob.glob('*.xml'):
sitemapindex = sitemapindex + '<sitemap>\n'
sitemapindex = sitemapindex + ' <loc>http://inkl.in/sitemaps/' + file + '</loc>\n'
sitemapindex = sitemapindex + '</sitemap>\n'
sitemapindex = sitemapindex + '</sitemapindex>'
View Sitemaps Job
apiVersion: batch/v1
kind: Job
metadata:
name: sitemap
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: sitemap
View Frontend Helm template
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
name: frontend
spec:
type: LoadBalancer
ports:
- name: http
View generate_sitemaps.py
import urllib, json
import glob
import os
import pymongo
from pymongo import MongoClient
# Set the latest Block form the API
client = MongoClient(os.environ["DB"])
View Dockerfile-sitemaps
FROM nginx
RUN mkdir /usr/share/nginx/html/sitemaps
COPY *.xml /usr/share/nginx/html/sitemaps/