Skip to content

Instantly share code, notes, and snippets.

@genegoykhman
genegoykhman / qb2ledger
Created September 22, 2012 04:19
Converts a QuickBooks General Journal CSV export to a ledger_cli compatible transaction file. More details at http://www.timetiger.com/gene/blog/2012/2012-09-23-an-alternative-to-quickbooks.html
#! /usr/bin/env ruby
require 'csv'
require 'Date'
require 'optparse'
SCRIPT_VERSION = [1, 0, 0]
class Transaction
attr_accessor :transaction_id, :type, :date, :num, :rows
def initialize
#! /usr/bin/env ruby
# strip-silence version 1.1
#
# Usage:
# strip-silence input.mp4
#
# Description:
# Uses auto-editor to identify areas of silence in input.mp4,
# then uses ffmpeg to strip them out (without recompression).
@genegoykhman
genegoykhman / custom-compose-resend.el
Created October 21, 2023 19:21
mu4e: custom compose-resend that includes in-line attachments
(defun my/mu4e-compose-resend ()
(interactive)
(advice-add 'mu4e~compose-handler :after #'my/mu4e-compose-resend-processing)
(mu4e-compose 'resend))
(defun my/mu4e-compose-resend-processing (&rest args)
;; Make sure we are in a compose buffer
(unless (derived-mode-p 'mu4e-compose-mode)
(error "Must be in a mu4e-compose buffer."))
@genegoykhman
genegoykhman / disable-window-splitting.el
Created October 21, 2023 19:17
mu4e: temporarily disable window splitting while sending email
;; Temporarily disable window splitting while sending mu4e email
(defun my/mu4e-split-single-window (&rest args)
(setq mu4e-split-view 'single-window))
(defun my/mu4e-split-horizontal (&rest args)
(setq mu4e-split-view 'horizontal))
(advice-add 'message-send-and-exit :before #'my/mu4e-split-single-window)
(advice-add 'mu4e-sent-handler :after #'my/mu4e-split-horizontal)
@genegoykhman
genegoykhman / multi-tty.patch
Created December 6, 2020 17:14
Fix support for macOS multi-tty in Emacs 27.1
diff --git a/lisp/server.el b/lisp/server.el
index 5efba17a01..c194d78ad1 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1182,10 +1182,9 @@ The following commands are accepted by the client:
;; choice there.) In daemon mode on Windows, we can't
;; make tty frames, so force the frame type to GUI
;; there too.
- (when (or (and (eq system-type 'windows-nt)
- (or (daemonp)
@genegoykhman
genegoykhman / Blitz Talk.scpt
Created June 24, 2016 01:29
Auto-advance a Deckset presentation 15-seconds per slide
tell application "Deckset"
set doc to first document
set ind to 0
set slideIndex of doc to ind
set delaySeconds to 15
--set question to display dialog "Start presentation?" buttons {"OK", "Cancel"} default button 1
--set answer to button returned of question
--if answer is equal to "OK" then
@genegoykhman
genegoykhman / ec.sh
Created November 3, 2019 00:27
Zsh shell function 'ec' for opening emacsclient in an sshd or mosh session
#! /bin/zsh
function pid_has_ancestor_server() {
pstree -p $1 | grep $2
}
function pid_of_shell_process() {
if is_not_inside_local_tmux; then
echo "$$"
else
@genegoykhman
genegoykhman / gist:c086db41b26e4cf9ca419aefdb874be4
Last active November 3, 2019 00:10
My custom Emacs font colors for dark themes
(custom-set-faces
'(default ((t (:stipple nil :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 130 :width normal :family "Source Code Pro for Powerline"))))
'(line-number ((t (:foreground "#485e65" :background "#081e25" :height 0.8))))
'(magit-mode-line-process ((t (:inherit mode-line-emphasis :foreground "yellow"))))
'(markdown-comment-face ((t (:foreground "#586e75" :strike-through nil))))
'(mu4e-view-body-face ((t (:foreground "#ffffff"))))
'(smerge-upper ((((class color) (min-colors 88) (background light))
:background "#ffdddd")
(((class color) (min-colors 88) (background dark))
:background "#330000")
@genegoykhman
genegoykhman / open-in-emacs.applescript
Last active August 25, 2016 03:00
My QuickCursor replacement, opening the selected text (or full document) in Emacs client for editing
#!/usr/bin/osascript
-- open-in-emacs.applescript
-- https://gist.github.com/genegoykhman/357bd6f64263e541c6f7
--
-- By Gene Goykhman, 2016
-- No warranties expressed or implied: use at your own risk.
--
-- When triggered by a system-wide hotkey, opens the selected text (if any) or the full document in your frontmost application in an Emacs client buffer. When you exit the buffer the edited text replaces the selection (or full document).
--
-- Installation
@genegoykhman
genegoykhman / gist:4514089
Created January 11, 2013 21:26
Modified create_mail routine in Mail.scpt of the QuickSilver Apple Mail support plugin that includes mail signatures in new messages you create. The first signature with the name "Default" or "Quicksilver" is used.
on create_mail(theSubject, theBody, theSender, theRecipients, thePaths)
tell application "Mail"
set theMessage to (make new outgoing message at the beginning of outgoing messages with properties {subject:theSubject, content:theBody})
repeat with i from (count of theRecipients) to 1 by -1
tell theMessage to make new to recipient at beginning of to recipients with properties {address:(item i of theRecipients)}
end repeat
if (theSender is not missing value) then set sender of theMessage to theSender
end tell
if (thePaths is not missing value) then
set theAliases to my aliasesForPaths(thePaths)