Skip to content

Instantly share code, notes, and snippets.

View jjo's full-sized avatar
🏠
Working from home

JuanJo Ciarlante jjo

🏠
Working from home
View GitHub Profile
@jjo
jjo / node-custom-setup.yaml
Last active January 28, 2023 03:23
Run commands at Kubernetes *nodes* via `privileged` DaemonSet + `nsenter` hack, very useful for setups requiring base packages pre-installed at nodes. Please take a moment to understand what it does, and *don't* use it for *production*. Grab the logs with: kubectl logs -n kube-system -l k8s-app=node-custom-setup -c init-node
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
namespace: kube-system
name: node-custom-setup
labels:
k8s-app: node-custom-setup
annotations:
command: &cmd apt-get update -qy && apt-get install -qy tgt ceph-fs-common ceph-common xfsprogs
@jjo
jjo / kube-router.ds.yaml
Created January 11, 2019 22:37
kube-router v0.2.4 DaemonSet running on a Raspberry PI B+ cluster (ARMv7)
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
creationTimestamp: "2018-12-04T20:17:44Z"
generation: 2
labels:
k8s-app: kube-router
tier: node
name: kube-router
@jjo
jjo / kube-router.ds.yaml
Created January 11, 2019 22:38
kube-router v0.2.4 DaemonSet running on a Raspberry PI B+ cluster (ARMv7)
## Output from:
# kubectl get ds --namespace=kube-system kube-router -oyaml
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
creationTimestamp: "2018-12-04T20:17:44Z"
generation: 2
labels:
k8s-app: kube-router
tier: node
#!/bin/bash
#
# Workaround CVE-2019-5736 via patched runc provided by
# https://github.com/rancher/runc-cve
# The script does:
# 1) find "docker-runc" executable and docker version
# 2) download corresponding patched runc
# 3) dpkg-divert (ie "permanently move") pkg installed runc and replace it by 2)
#
# Run with "-n" for dry-run.
var resourceConfigAddCmd = &cobra.Command{
Use: "add",
Short: "adds specific resources to be watched",
Long: `adds specific resources to be watched`,
Run: func(cmd *cobra.Command, args []string) {
conf, err := config.New()
if err != nil {
logrus.Fatal(err)
}
flags := []struct {
jjo@sapito:~/coro/clases-devops/c01/p01/api_jwt$ docker-compose up
Starting api_jwt_init_1 ... done
Starting api_jwt_main_1 ... done
Starting api_jwt_test_1 ... done
Attaching to api_jwt_init_1, api_jwt_main_1, api_jwt_test_1
init_1 | fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
test_1 | fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
init_1 | fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
main_1 | Server started at 3001
init_1 | v3.8.4-63-g0ce51efa7e [http://dl-cdn.alpinelinux.org/alpine/v3.8/main]
local kube = (import "lib/kube.libsonnet") {
PodSecurityPolicy(name):: kube._Object("policy/v1beta1", "PodSecurityPolicy", name) {
metadata+: {
assert !std.objectHas(self, "namespace"): "PSPs are not namespaced",
},
},
};
{

Steps to setup Telegram(TG) Cornix BOT autotrading, feeding from Hirn Crypto Free signals TG channel against Binance.

These signals instruct the BOT to trade altcoins against BTC, towards getting returns in BTC, typically via high-freq trading (sometimes ~handful trades per min).

  • [1] Add cornix bot to TG: https://t.me/cornix_trading_bot (free trial 2/weeks)
  • [2] Add Hirn Crypto Free (signals) to TG: https://t.me/hirn_Crypto (free)
  • [3] Create Binance API key, only allowing in-account trading (default), save key and secret
  • Setup cornix bot, from Main Menu ->
    • Add Another Client -> New Client -> Link to an existing account -> Binance using API <key>,<secret> from [3]
    • Subscribe to Channel -> should automagically show Hirn ... from [2]
# Deploy an additional thanos-store-gateway instance in to feed
# thanos-querier with TSDB from a different cluster S3 bucket
# (no direct connectivity between clusters)
# There `clusterfoo` is the "remote" cluster, running under
# a different AWS_ACCOUNT_NUM, using kiam to assume a role
# able to read the S3 bucket.
---
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
@jjo
jjo / Dockerfile
Last active May 13, 2020 15:59
Generic python dockerfile for multistage builds
FROM python:3.8-slim as compile-image
RUN apt-get update && apt-get install -y --no-install-recommends build-essential gcc && apt-get clean
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . /app
FROM python:3.8-slim as runtime-image