Skip to content

Instantly share code, notes, and snippets.

View podviaznikov's full-sized avatar
🗽
NYC, hacking, thinking, observing, feeling

anton podviaznikov

🗽
NYC, hacking, thinking, observing, feeling
View GitHub Profile
@podviaznikov
podviaznikov / test.md
Created August 27, 2020 03:22
second gist

again?

@podviaznikov
podviaznikov / test.md
Created August 27, 2020 03:22
test me

hello

world

@podviaznikov
podviaznikov / error-handling-workers.js
Created May 25, 2017 23:35
error handling on the workers
onContainerDataSaved = function (container) {
let networkData
try {
networkData = network.fetchNetworkData()
network.attachContainerToNetwork(networkData, container)
websockets.sendErrorToClients("Cannot attach container to the network")
} catch (err) {
if (err instanceof NetworkAttachError) {
messageBus.emit('network.attach.failed', { container, networkData })
}
@podviaznikov
podviaznikov / error-handling.js
Last active June 1, 2017 21:10
error-handling
// ideally those should be sent in parallel
// failure of one shouldn't impact failure of others
function sendNotifications (data, instance, container) {
try {
slack.sendNotification(data, instance, container)
} catch (err) {
// retry sending a message
slack.sendNotification(data, instance, container)
}
try {
{"name":"palantiri","commit":"e8d147487e65d9dcf2f90ba9827c7e3ee3e23cfa","environment":"production-delta","hostname":"palantiri","pid":15,"tx":true,"module":"Swarm","method":"getHostsWithOrgs","level":10,"info":{"ID":"","Containers":14457,"ContainersRunning":3122,"ContainersPaused":0,"ContainersStopped":11335,"Images":6485,"Driver":"","DriverStatus":null,"SystemStatus":[["Role","primary"],["Strategy","spread"],["Filters","health, port, containerslots, dependency, affinity, constraint"],["Nodes","257"],[" (unknown)","10.8.204.92:4242"],[" ? ID",""],[" ? Status","Pending"],[" ? Containers","0"],[" ? Reserved CPUs","0 / 0"],[" ? Reserved Memory","0 B / 0 B"],[" ? Labels",""],[" ? Error","Cannot connect to the Docker daemon. Is the docker daemon running on this host?"],[" ? UpdatedAt","2016-08-03T16:55:09Z"],[" ? ServerVersion",""],[" ip-10-8-192-52.9487339","10.8.192.52:4242"],[" ? ID","SRSN:VBV3:4ZSI:J3HF:AXQF:KZWX:2SJH:7TUY:N3KG:WEP5:AIHP:5FSQ"],[" ? Status","Healthy"],[" ? Containers","36"],[" ? Reserved CPUs"
@podviaznikov
podviaznikov / Dockerfile-metalsmith-blog
Created May 19, 2016 18:30
Dockerfile-metalsmith-blog
# Full list of versions available here: https://registry.hub.docker.com/_/node/tags/manage/\n' +
FROM node:0.10.38
# Open up ports on the container
EXPOSE 80 8000 8080 3000
# Add repository files to container
ENV BASE_URL=http://metalsmith-blog-staging-runnable.runnableapp.com
@podviaznikov
podviaznikov / Datomic News Updates
Created April 21, 2016 04:20 — forked from stuarthalloway/Datomic News Updates
Datomic update examples against a social news database
;; Datomic example code
;; demonstrates various update scenarios, using a news database
;; that contains stories, users, and upvotes
;; grab an in memory database
(use '[datomic.api :only (q db) :as d])
(def uri "datomic:mem://foo")
(d/create-database uri)
(def conn (d/connect uri))
@podviaznikov
podviaznikov / idea-shortcust
Created July 3, 2015 21:32
Intelij idea shortcust
http://blog.jetbrains.com/idea/2014/03/intellij-idea-13-1-rc-introduces-sublime-text-style-multiple-selections/
@podviaznikov
podviaznikov / nace.clj
Last active August 29, 2015 14:19
generate naces
(ns nace.core
(:require [cheshire.core :refer :all]))
(def st (slurp "./resources/nace.json" :encoding "UTF-8"))
(defn remove-dots [s]
(clojure.string/replace s "." ""))