Skip to content

Instantly share code, notes, and snippets.

View alexesDev's full-sized avatar

Alexey Yurchenko alexesDev

  • Digital Nomad
View GitHub Profile
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"regexp"
"time"
const { exec } = require('child_process');
const view = `
<pre style="height:300px; overflow: auto; border: 1px solid #eee" id="history">
</pre>
<form method="post" id="form">
<input type="text" name="command" size="100" id="command" />
<button>Run</button>
</form>
<script>
[defaults]
inventory = hosts
pipelining = True
timeout = 30
module Main exposing (..)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
import Random
main : Program () Model Msg
main =
Browser.element { init = \_ -> init, update = update, view = view, subscriptions = \_ -> Sub.none }
@alexesDev
alexesDev / Dokerfile
Created January 10, 2020 14:41
Dockerfile for golang
FROM golang:1.13.4-alpine3.10 as build
RUN apk add --update git
WORKDIR /app
COPY go.mod go.sum /app/
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags '-w -extldflags "-static"' -o app .
FROM fpco/stack-build:lts-14.20 as build
WORKDIR /app
COPY .init-stack.yaml stack.yaml
COPY .init-stack.yaml.lock stack.yaml.lock
COPY .init-package.yaml package.yaml
RUN stack build --only-dependencies
COPY . .
@alexesDev
alexesDev / consul-exporter.hcl
Last active November 22, 2019 08:16
Example Consul Exporter Nomad Job
job "consul-exporter" {
datacenters = ["dc1"]
group "consul-exporter" {
task "consul-exporter" {
driver = "exec"
artifact {
source = "https://github.com/prometheus/consul_exporter/releases/download/v0.4.0/consul_exporter-0.4.0.linux-amd64.tar.gz"
options {
@alexesDev
alexesDev / site.yml
Created October 27, 2019 13:07
Ansible zero downtime for docker_container
vars:
version: "{{ ansible_date_time.epoch }}"
backend_container_name: "backend-{{ version }}"
tasks:
- name: Run backend container
docker_container:
<<: *base-app
name: "{{ backend_container_name }}"
command: bundle exec puma -C config/puma.rb -t 1:3
@alexesDev
alexesDev / main.js
Created August 31, 2019 08:26
Обновление хуков moysklad.ru
const fetch = require('node-fetch');
const MoyskladCore = require('moysklad');
const MoyskladQueueExtension = require('moysklad-extension-queue');
const { loadRows } = require('moysklad-tools');
const { readFileSync } = require('fs');
const Moysklad = MoyskladCore.compose(MoyskladQueueExtension);
const ms = Moysklad({
queue: true,
fetch,
@alexesDev
alexesDev / 0.md
Last active June 20, 2019 21:35
Deploy App+Postgres+Traefik Using Ansible
Bootstrap
ansible-galaxy install -p roles geerlingguy.docker
ansible-playbook site.yml
chmod +x deploy.sh
Deploy