Skip to content

Instantly share code, notes, and snippets.

View rmuslimov's full-sized avatar
:octocat:
I may be slow to respond.

rmuslimov rmuslimov

:octocat:
I may be slow to respond.
  • Stripe
  • Belmont, CA
View GitHub Profile
@rmuslimov
rmuslimov / anybar.el
Last active December 5, 2015 08:24
Anybar elisp function
(defun update-anybar-color (color &optional port)
(shell-command
(format "echo -n \"%s\" | nc -4u -w0 localhost %s"
color (or port 1738))))
;; (update-anybar-color "red")
@rmuslimov
rmuslimov / vk.applescript
Last active December 6, 2015 09:47
vk.com manipulate
tell application "Google Chrome"
repeat with current_tab in (tabs of front window)
set has_vk_player_mark to execute current_tab javascript "!!document.getElementById('gp')"
if has_vk_player_mark then
if URL of current_tab contains "vk.com" and has_vk_player_mark then
set URL of current_tab to "javascript:audioPlayer.nextTrack();"
end if
end if
end repeat
end tell
@rmuslimov
rmuslimov / vk.el
Created December 6, 2015 09:53
Manipulate vk audio from emacs
(setq
chrome-vk-player-base
"tell application \"Google Chrome\"
repeat with current_tab in (tabs of front window)
set has_vk_player_mark to execute current_tab javascript \"!!document.getElementById('gp')\"
if has_vk_player_mark then
if URL of current_tab contains \"vk.com\" and has_vk_player_mark then
%s
end if
end if
@rmuslimov
rmuslimov / python file header snippet
Last active December 22, 2015 23:07
Creating nice looking headers for python files
# -*- coding: utf-8 -*-
# name: cgd
# --
# coding: utf-8
"""
`(let* ((relative_p (f-relative (buffer-file-name) (vc-git-root (buffer-file-name))))
(package_name (s-replace "/" "." (s-replace ".py" "" relative_p))))
(format "%s\n%s\n%s\n"
(s-repeat (length package_name) "=")
@rmuslimov
rmuslimov / example.clj
Created January 8, 2016 23:52
Try to implement chunks with core.async
(ns cltrace.example
(:require [clojure.core.async :refer [<! >! >!! chan go-loop]]))
(def queue (atom []))
(defn process-chan [in]
(let [out (chan)]
(go-loop [item (<! in)]
(swap! queue conj item)
(when (> (count @queue) 3)
@rmuslimov
rmuslimov / prodigy-settings.el
Created January 12, 2016 08:12
My prodigy settings
;; Prodigy app and services
(defconst prodigy-python-apps
'(airborne airborne-gunicorn airborne-celery airborne-hyattfast bowman cessna fokker fasttrace))
(defconst prodigy-standard-python-service
'((airborne :args ("manage.py" "runserver" "5000"))
(airborne-gunicorn
:command "gunicorn"
:args ("wsgi:application" "-c" "gunicorn_conf.py" "--log-file=-"))
(airborne-celery
@rmuslimov
rmuslimov / dired-features.el
Last active February 15, 2016 03:22
Small extension for dired under Macosx
(setq
scripts-dired-find-owner
"tell application \"Finder\"
set appname to (default application of (info for POSIX file \"%s\"))
do shell script \"echo \" & appname
end tell")
(setq
scripts-dired-open-from-finder
;; /src/jiracli/web.clj
(ns jiracli.web
(:require [com.stuartsierra.component :as component]
[ring.component.jetty :refer [jetty-server]])
(:gen-class))
(defn app-handler
"Main application server."
[request]
@rmuslimov
rmuslimov / compare.clj
Last active February 19, 2016 07:55
Clojure version of xml parsing
(ns logprocessor.core
(:require [clojure.java.io :as io]
[clojure.zip :as zip]
[clojure.data.xml :as xml]
[clojure.data.zip.xml :as zx])
(:gen-class))
(def store "/Users/rmuslimov/projects/logs/d=12")
(defn get-zipper
@rmuslimov
rmuslimov / compare.py
Last active February 19, 2016 04:58
Python version of parsing
import os
from datetime import datetime
from lxml import etree
def import_file(filename):
with open(filename) as f:
body = etree.fromstring(f.read())
return etree.ETXPath(