Skip to content

Instantly share code, notes, and snippets.

Avatar

Roman Semenenko volh

  • Roman Semenenko Inc.
  • Earth
View GitHub Profile
@volh
volh / prettier.el
Created Apr 25, 2018
Call prettier.js on current emacs buffer file
View prettier.el
(defun shell-command-on-buffer (command)
"run a command on the current file and revert the buffer"
(interactive "sCommand:")
(shell-command
(format "%s %s"
command
(shell-quote-argument (buffer-file-name))))
(revert-buffer t t t))
(defun prettier-js-on-buffer ()
View day-night-switch.el
(defun daylight-mode ()
(interactive)
(mapc #'disable-theme custom-enabled-themes)
(setq fci-rule-color "lightgray")
(load-theme 'adwaita t)
(load-theme 'tango t))
(defun night-mode ()
(interactive)
(mapc #'disable-theme custom-enabled-themes)
@volh
volh / conkeror-org-protocol-capture.js
Last active Aug 29, 2015
Capture bookmarks from web browser right to your Org file with proper template
View conkeror-org-protocol-capture.js
// Integration with Conkeror
// For Firefox, see https://addons.mozilla.org/ru/firefox/addon/org-mode-capture/
function org_capture (url, title, selection, window) {
// Note the 'w' as capture template
var cmd_str = 'emacsclient \"org-protocol://capture:/w/'+url+'/'+title+'/'+selection+'\"';
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
@volh
volh / gist:8826e0302bd52db8f792
Created May 7, 2015
emacs global dir-locals ( per-directory settings )
View gist:8826e0302bd52db8f792
(dir-locals-set-class-variables 'smallindent-directory
'((nil . ((web-mode-markup-indent-offset . 2)
(web-mode-css-indent-offset . 2)
(web-mode-code-indent-offset . 2)
(js-indent-level . 2)
(whitespace-mode . -1)
(coffee-tab-width . 2)
(js2-basic-offset . 2)
))))
@volh
volh / gist:5760552
Created Jun 11, 2013
example of ssh config using LocalCommand option
View gist:5760552
PermitLocalCommand true
host localhost app* whatever_db* *exgirlfriendnameblog.net
user root
port 6666
LocalCommand echo -e "\033]11;#ff0000\007"
@volh
volh / gist:5433977
Last active Dec 16, 2015
play all the flash video/audio files open in chrome/firefox via mplayer
View gist:5433977
#!/bin/sh
mplayer $(find $(for i in `pgrep -f flashplayer`; do echo /proc/$i/fd/; done) -lname "*Flash*")
View gist:5371680
myLayout = ( (layoutN 1 (relBox 0 0 0.5 1) (Just $ relBox 0 0 1 1) $ simpleTabbed)
$ (layoutAll (relBox 0.5 0 1 1) $ simpleTabbed)
) |||
( (layoutN 1 (relBox (1/3) 0 (1/2) 1) (Just $ relBox 0 0 1 1) $ Tall 0 0.01 0.5)
$ (layoutR 0.1 0.5 (relBox (2/3) 0 1 1) Nothing $ Tall 0 0.01 0.5)
$ (layoutAll (relBox 0 0 (1/3) 1) $ Tall 0 0.01 0.5)
) |||
( (layoutN 1 (absBox (-512-200) 0 512 0) (Just $ relBox 0 0 1 1) $ simpleTabbed)
$ (layoutN 1 (absBox (-200) 0 0 0) Nothing $ simpleTabbed)
$ (layoutAll (absBox 0 0 (-512-200) 0) $ simpleTabbed)
@volh
volh / asound.conf
Created Jan 21, 2013
alsa config to play both through internal and external sound cards
View asound.conf
pcm.!default plug:both
ctl.!default {
type hw
card 0
}
pcm.both {
type route;
slave.pcm {
View mozilla_notification.js
function notification(title, body){
Components.classes['@mozilla.org/alerts-service;1'].
getService(Components.interfaces.nsIAlertsService).
showAlertNotification(null, title, body, false, '', null);
}
View masterwindow.js
const OPEN_MASTER_WINDOW = 7;
function master_window () {
let windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
let windows = windowMediator.getEnumerator(null);
let max_width = 0;
let master = null;
while (windows.hasMoreElements()) {
let win = windows.getNext()