Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@hidsh
hidsh / gist:3930335
Created October 22, 2012 08:30
elisp: set-mark w/ fringe-indicator (like xyzzy)
(defvar fringe-indicator-ol nil)
(defun fringe-indicator (pt bitmap)
(let ((s (make-string 1 ?x)))
(when fringe-indicator-ol (delete-overlay fringe-indicator-ol))
(setq fringe-indicator-ol (make-overlay pt (1+ pt)))
(put-text-property 0 1 'display (list 'left-fringe bitmap) s)
(overlay-put fringe-indicator-ol 'before-string s)))
(defadvice set-mark-command (after fringe-indicator-adv activate)
"indicate mark-position at fringe."
@hidsh
hidsh / .emacs
Created October 22, 2012 09:24
.emacs / cocoa Emacs24
;;;; -*- coding: utf-8-unix -*-
;; (defconst my-time-zero (current-time)) ;; for my-time-lag in discrete.el
;;;;
;;;; Filename: .emacs
;;;; Last modified: Mon Oct 22 2012 18:21:38 JST
;;;;
;;;; based: $Id: .emacs,v 1.26 2006/02/16 06:44:23 gnrr Exp gnrr $
;;;;
;;;; note: update --> M-x eval-current-buffer
;;;;
@hidsh
hidsh / discrete.el
Created October 22, 2012 09:26
discrete.el / cocoa Emacs24
;;;; -*- mode: lisp-interaction; syntax: elisp; coding: iso-2022-7bit -*-
;;;;
;;;; discrete elisp
;;;;
;;;; Filename: discrete.el
;;;; Last modified: Mon Oct 22 2012 18:15:05 JST
;;;;
;;;; based: $Id: discrete.el,v 1.51 2006/02/16 05:13:34 gnrr Exp gnrr $
;;;;
@hidsh
hidsh / .bash_profile
Created October 22, 2012 10:12
.bash_profile on mac
#!/bin/bash
#
# Filename: .bash_profile
# Last modified: Mon Oct 22 2012 19:09:23 JST
#
# note: for mac
if [ -f ~/.bashrc ] ; then
. ~/.bashrc
fi
@hidsh
hidsh / .bashrc
Created October 22, 2012 10:12
.bashrc on mac
#!/bin/bash
#
# Filename: .bashrc
# Last modified: Mon Oct 22 2012 19:09:34 JST
#
# note: require ~/.bash_profile on mac
#
export PS1="\[\e[35;1m\]\u@\[\e[34;1m\]\h\e[0m:\[\e[0m\]\e[32;1m\w\e[0m $"
@hidsh
hidsh / mkramdisk.sh
Created October 22, 2012 11:35
ram disk for mac
#!/bin/sh
#
# mkramdisk.sh : prepare ramdisk for mac
#
# install:
# 1. modify variables (caches, mb) as your like, in this script.
#
# 2. register to startup:
# 1. open "Ligon"
# 2. New to "Users Daemons"
@hidsh
hidsh / hello.py
Created November 7, 2012 21:20
python: test: hello
#! /usr/bin/python
class Hello():
def pprint(self):
print 'hello'
if __name__ == '__main__':
h = Hello()
h.pprint()
@hidsh
hidsh / hello-pytk.py
Created November 8, 2012 01:20
python: sample: hello using python/Tkinter
#!/usr/bin/python
#
# http://www.geocities.jp/m_hiroi/light/pytk01.html
from Tkinter import *
root = Tk()
button = Button(root, text = 'Hello PyTk')
button.pack()
root.mainloop()
@hidsh
hidsh / full_adder.vhdl
Created December 4, 2012 07:07
VHDL: half adder and full adder
-- full_adder.vhdl
-- desc: 1bit full adder
entity FULL_ADDER is
port(A, B, CIN: in bit;
SUM, COUT: out bit);
end FULL_ADDER;
architecture STRUCT of FULL_ADDER is
component HALF_ADDER
@hidsh
hidsh / complete2.py
Created January 4, 2013 07:28
doctestモジュールのサンプル
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# みんなのPython p388, doctestモジュールのサンプル
#
# 完全数を求める
# e.g. 1000以下の完全数 6, 28, 49
def get_divisor(num):