Skip to content

Instantly share code, notes, and snippets.

View pavloo's full-sized avatar
🎯
Focusing

Pavlo Osadchyi pavloo

🎯
Focusing
View GitHub Profile
;;; -*- lexical-binding: t -*-
(defun dowrap (list beg_i l lambd)
(let (i)
(dotimes (j l)
(setq i (+ beg_i j))
(setq i (% i (length list)))
(apply lambd (list i j))
)
)
(defun read-file-as-string (file-path)
(with-temp-buffer
(insert-file-contents file-path)
(mapcar 'string-trim (split-string (buffer-string) "," t))
)
)
(defun calculate-dist (x y z)
(/
(+
Step # Illustration State of Queue Pool of workers Description
1 Alt text 1, r,y,g,b Initial state, node 1 is scheduled for processing
2
def _is_node_rdy(task, graph):
tasks = session.query(Task).filter(Task.id.in_(list(graph.predecessors(task.id)))).all()
for dep_task in tasks:
if not dep_task.celery_task_uid or \
not AsyncResult(dep_task.celery_task_uid).state == SUCCESS:
return False
return True
@app.task(bind=True)
def run(self, workflow_id, cur_task_id=None):
def _is_node_rdy(task, graph):
tasks = session.query(Task).filter(Task.id.in_(list(graph.predecessors(task.id)))).all()
for dep_task in tasks:
if not dep_task.celery_task_uid or \
not AsyncResult(dep_task.celery_task_uid).state == SUCCESS:
return False
return True
@app.task(bind=True)
def run(self, workflow_id, cur_task_id=None):
(defun copy-current-line-position-to-clipboard (p)
"Copy current line in file to clipboard as '</path/to/file>:<line-number>'"
(interactive "sAbsolute path y/n?: ")
(let ((path-with-line-number) (file-name (buffer-file-name)))
(when (and (not (string= p "y")) (projectile-project-root))
(setq file-name (file-relative-name buffer-file-name (projectile-project-root)))
)
(setq path-with-line-number (concat file-name ":" (number-to-string (line-number-at-pos))))
(x-select-text path-with-line-number)
(message (concat path-with-line-number " copied to clipboard"))))
@pavloo
pavloo / btt-enable-disable.applescript.template
Last active May 16, 2019 15:42
A script to enable/disable certain keystrokes in BetterTouchTool when external keyboard connected/disconnected
tell application "BetterTouchTool"
activate
update_trigger "EAE52DEC-26DA-40DC-8BB1-62A102FE676C" json "{\"BTTEnabled\" : %d}"
update_trigger "7C3BC3BC-2B93-4674-8A5F-6697FDC6E723" json "{\"BTTEnabled\" : %d}"
end tell