Skip to content

Instantly share code, notes, and snippets.

@volh
volh / gist:5760552
Created June 11, 2013 20:51
example of ssh config using LocalCommand option
PermitLocalCommand true
host localhost app* whatever_db* *exgirlfriendnameblog.net
user root
port 6666
LocalCommand echo -e "\033]11;#ff0000\007"
@volh
volh / prettier.el
Created April 25, 2018 08:28
Call prettier.js on current emacs buffer file
(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 ()
(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 / gist:5433977
Last active December 16, 2015 12:19
play all the flash video/audio files open in chrome/firefox via mplayer
#!/bin/sh
mplayer $(find $(for i in `pgrep -f flashplayer`; do echo /proc/$i/fd/; done) -lname "*Flash*")
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 January 21, 2013 16:03
alsa config to play both through internal and external sound cards
pcm.!default plug:both
ctl.!default {
type hw
card 0
}
pcm.both {
type route;
slave.pcm {
function notification(title, body){
Components.classes['@mozilla.org/alerts-service;1'].
getService(Components.interfaces.nsIAlertsService).
showAlertNotification(null, title, body, false, '', null);
}
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()
@volh
volh / rc.lua
Created September 19, 2012 17:17
awful.key({ modkey }, "g",
function ()
awful.prompt.run({ prompt = "Go to Nth: " },
promptbox[mouse.screen].widget,
function (n)
local c = awful.tag.selected():clients()[tonumber(n)]
client.focus = c
c:raise()
end)
end)
@volh
volh / 1.md
Created September 14, 2012 18:12
custom twitter mode for conkeror