Skip to content

Instantly share code, notes, and snippets.

@syohex
syohex / easy-highlight.el
Created November 21, 2012 01:03
wrapper hi-lock.el for easy to use highlight word or regexp
(eval-when-compile
(require 'cl))
(require 'hi-lock)
(require 'thingatpt)
(defgroup easy-highlight nil
"Easy to use `hi-lock'"
:group 'faces
:prefix "easy-highlight:")
@syohex
syohex / github-markdown-api.el
Created November 22, 2012 02:58
Using Github Markdown Rendering API from Emacs
(eval-when-compile
(require 'cl))
(require 'url)
(require 'url-http)
(require 'json)
(defvar github-markdown:url "https://api.github.com/markdown")
(defvar github-markdown:url-raw "https://api.github.com/markdown/raw")
@syohex
syohex / buffer_flush.pl
Created November 26, 2012 10:17
Buffer flush sample
#!perl
use strict;
use warnings;
use POSIX ();
sysopen my $in, "/proc/net/dev", POSIX::O_RDONLY or die "Can't open file: $!";
open my $out, '>', 'output.log' or die "Can't open file: $!";
#$out->autoflush(1); # <== バッファリングしない(autoflush $out, 1; も可)
@syohex
syohex / flymake-setting.el
Created November 26, 2012 15:01
flymake setting
;; flymake setting
(require 'flymake)
;; Show error message under current line
(require 'popup)
(defun flymake-display-err-menu-for-current-line ()
(interactive)
(let* ((line (flymake-current-line-no))
(line-err-info (flymake-find-err-info flymake-err-info line))
(error-infos (nth 0 line-err-info))
@syohex
syohex / helm-ghc-find-document.el
Created November 26, 2012 23:26
helm version of 'anything-ghc-browse-document'
;; Please see http://d.hatena.ne.jp/kitokitoki/20111217/p1
(defvar helm-c-source-ghc-mod
'((name . "GHC Browse Documennt")
(init . helm-c-source-ghc-mod)
(candidates-in-buffer)
(candidate-number-limit . 9999)
(action . helm-c-source-ghc-mod-action)))
(defun helm-c-source-ghc-mod ()
@syohex
syohex / theme-molokai.el
Created November 27, 2012 04:02
Color theme 'molokai' for Emacs 24 color theme framework
(deftheme molokai
"Color theme based on the Molokai color scheme for vim.")
(custom-theme-set-faces
'molokai
'(cursor ((t (:foreground "#F8F8F0"))))
'(default ((t (:foreground "#F8F8F2" :background "#1B1D1E"))))
'(bold ((t (:weight bold))))
'(bold-italic ((t (:weight bold :slant italic))))
@syohex
syohex / haskell-block-comment.el
Created November 29, 2012 14:11
Wrap region with Haskell block comment
(defun haskell-block-commend-region (start end)
(interactive "r")
(save-excursion
(let (end-marker)
(goto-char end)
(setq end-marker (point-marker))
(goto-char start)
(insert "{-\n")
(goto-char (marker-position end-marker))
(insert "-}"))))
@syohex
syohex / pydoc.el
Created December 1, 2012 08:25
Show pydoc in Emacs
;; help utilities
(defun my/python-help ()
(interactive)
(let ((module (read-string "Pydoc module: " ))
(buf (get-buffer-create "*Python Help*")))
(with-current-buffer (get-buffer-create buf)
(erase-buffer)
(call-process-shell-command (format "pydoc %s" module) nil t t)
(goto-char (point-min)))
(pop-to-buffer buf)))
@syohex
syohex / helm-silver-searcher.el
Created December 3, 2012 14:05
initial implementation helm-silver-searcher
;;; helm-silver-searcher.el ---
;; Copyright (C) 2012 by Syohei YOSHIDA
;; Author: Syohei YOSHIDA <[email protected]>
;; URL:
;; Version: 0.01
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@syohex
syohex / installed_modules.py
Created December 4, 2012 04:21
show all installed python modules
#!/usr/bin/python
from pkgutil import iter_modules
a = iter_modules()
while True:
try:
x = a.next()
except: