Skip to content

Instantly share code, notes, and snippets.

View pavloo's full-sized avatar
🎯
Focusing

Pavlo Osadchyi pavloo

🎯
Focusing
View GitHub Profile
@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
(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"))))
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):
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
(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)
(/
(+
;;; -*- 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 calculate-score (str)
(let ((list (split-string str "" t)) garbage (depth 0) (s 0) (g-count 0) ch)
(loop
for i from 0 to (1- (length list))
do
(progn
(setq ch (nth i list))
(cond
((string= ch "!")
(setq i (+ i 1))
(defstruct statement instruction condition)
(defstruct instruction reg value op)
(defstruct condition reg value con)
;; 1. Parse each line as Instruction
;; 2. Create Memory hash table with regs name - value (default of each reg is 0) +
;; 3. Execute each Instruction populating Memory +
;; 4. The largest reg value in Memory +
;; Part 2
;; 5. Add eval-after-statement hook for eval-statement
(defstruct node name weight parent)
(defun split-and-trim-each (&rest args)
(mapcar 'string-trim (apply 'split-string (append args (list t))))
)
(defun parse-weight (str)
(string-to-number (substring str 1 -1))
)