Skip to content

Instantly share code, notes, and snippets.


Artem Chistyakov temochka

View GitHub Profile
temochka / karabiner.notes.json
Created Feb 25, 2021
An example of Anykey-like complex automation in karabiner.
View karabiner.notes.json
"title": "Notes automations",
"rules": [
"description": "Launch Apple Notes automations in Alfred",
"manipulators": [
"type": "basic",
"conditions": [
temochka /
Last active Jun 27, 2020
My Philly ETE 2020 references
View snake-case-tokenizer.rb
#!/usr/bin/env ruby
while (path = gets)
filename = File.basename(path)
next if filename.start_with?('@')
filename.gsub(/\..+$/, '').split(/[_.]/).reject(&:empty?).each { |token| puts token }
temochka / most-changed-dirs
Created May 20, 2019
Print often changed files and dirs.
View most-changed-dirs
#!/usr/bin/env ruby
# pipe the following command into this script:
# git log --pretty=format: --name-only | most-changed-dirs
counts = { |hash, k| hash[k] = 0 }
while (filename = gets)
next if filename.start_with?('@')
parts = filename.strip.split(File::SEPARATOR).reject(&:empty?)
temochka / current_tab_to_omni.js
Created Oct 4, 2017
Save current tab’s title and URL to OmniFocus via the quick entry dialog.
View current_tab_to_omni.js
var Safari = Application('Safari');
var OmniFocus = Application('OmniFocus');
var currentWindow =[0];
var currentTab = currentWindow.currentTab();
var task = OmniFocus.InboxTask({ name:, note: currentTab.url() });;


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html xmlns="">
    <center><img src="cid:logo.png"/></center><br/>
    Hello {{name}}!
temochka / mad.clj
Last active Jul 6, 2017
4clojure #112
View mad.clj
(defn eval-expr [max-sum [sum sequence stack] lexeme]
(case lexeme
"[" [sum (conj sequence "(") (cons ")" stack)]
"]" [sum (conj sequence ")") (next stack)]
(let [x (Integer/parseInt lexeme)]
(if (<= (+ sum x) max-sum)
[(+ sum x) (conj sequence lexeme) stack]
(reduced [sum (concat sequence stack) nil])))))
(defn horribilis [max-sum program]
View 1_before.clj
(ns cursive-test)
(defn $render-digest
[{{{accept "accept"} :headers} :request
{:keys [date-range]} ::request
record ::entry}]
(let [digest (apply db/get-digest-data record date-range)]
(if (re-matches #"^application/json;?.*" accept)
(json/generate-string digest)
(ring-response {:headers {"Cache-Control" "max-age=0, private, no-cache, no-store, must-revalidate"
View Main.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NamedFieldPuns #-}
module Main where
import Control.Monad
import Network.HTTP.Simple
import Network.HTTP.Client.TLS
import System.Environment
import System.Exit
View reader.rb
#!/usr/bin/env ruby
require 'timeout'
abort "Usage: #{$0} <file> [duration] [rps]" unless ARGV.size >= 1
filename, duration, rps = ARGV
duration = (duration || 5).to_i
rps = (rps || 100).to_i
pause = 1.0 / rps