Skip to content

Instantly share code, notes, and snippets.

🌉
SF, hacking, thinking, observing, feeling

Anton Podviaznikov podviaznikov

🌉
SF, hacking, thinking, observing, feeling
Block or report user

Report or block podviaznikov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@podviaznikov
podviaznikov / error-handling-workers.js
Created May 25, 2017
error handling on the workers
View error-handling-workers.js
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 })
}
View error-handling.js
// 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 {
View gist:f088b96dc3886b1717b93a7220da33b0
{"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"
View 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 Apr 21, 2016 — forked from stuarthalloway/Datomic News Updates
Datomic update examples against a social news database
View Datomic News Updates
;; 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 Jul 3, 2015
Intelij idea shortcust
View 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 Aug 29, 2015
generate naces
View nace.clj
(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 "." ""))
View freebase-countries.json
[ { capital: 'Вашингтон',
type: '/location/country',
id: '/en/united_states',
name: 'Сполучені Штати Америки' },
{ capital: 'Берлін',
type: '/location/country',
id: '/en/germany',
name: 'Німеччина' },
{ capital: 'Канберра',
type: '/location/country',
View sublime-tricks.md
  • Command + D - select a word.
  • Command + L - select a line.
  • Command + Ctrl + G - select a code, line, or word first the hit this combo to select the others with the same instances.
  • F5 - sort the properties in alphabetical order
  • Command - hold the Command key and click on the lines that you want to select.
  • Command + Shift + ] - bring you immediately to the next tab.
  • Command + Shift + [ - bring you the previous tab.
  • Command + Ctrl + P - switch between the projects that are listed on the SublimeText Sidebar.
  • Command + E - put the code selected in the Find input field.
  • Command + R - file crawling.
You can’t perform that action at this time.