Skip to content

Instantly share code, notes, and snippets.

View yaotti's full-sized avatar

Hiroshige Umino yaotti

View GitHub Profile
;; 選択範囲をコメントアウト&その後ろにコメントアウトした物をペースト
(defun comment-out-and-paste ()
(interactive)
(save-excursion
(kill-ring-save (region-beginning) (region-end))
(comment-region (region-beginning) (region-end))
(goto-char (region-end))
(insert "\n\n")
(yank)
))
;; 選択範囲をコメントアウト&その後ろにコメントアウトした物をペースト
;; とりあえずのもの
(defun comment-out-and-paste ()
(interactive)
(save-excursion
(kill-ring-save (region-beginning) (region-end))
(comment-region (region-beginning) (region-end))
(goto-char (region-end))
(move-end-of-line 1)
(insert "\n")
@yaotti
yaotti / uva-pdf.sh
Created February 5, 2009 17:08
downloading pdf files at UVa
#!/bin/zsh
# UVa pdf files download script
# http://icpcres.ecs.baylor.edu/onlinejudge/
start=${1:-101} # 最初の問題
num=${2:-1} # ダウンロードしたい問題数(省略時は1つ)
cdir=$(pwd)
savedir=${3:-.}
vol=$(( $start / 100 ))
;; insert "- " with nesting
;; for clmemo users
(defun change-log-insert-list()
(interactive)
(let* ((end-point (point))
(start-point (- end-point 2))
(str (buffer-substring start-point end-point)))
(if (string-equal "- " str)
(delete-backward-char 1))
;; とりあえずのプログラム
(defun mf-cp-current-buffer ()
(interactive)
(let* ((filename (buffer-file-name))
(local-prj-root "/path/to/prj/root")
;;filenameからlocal-prjを除いたもの
(local-file-path-from-root (substring filename
(length local-prj-root)
(length filename)))
(mf-prj-root "/Volumes/mount-name"))
/* http://d.hatena.ne.jp/yaotti/20090330/1238391711 */
#include <stdio.h>
#include <stdlib.h>
/* structure inside queue like atoms of a list */
typedef struct atom_t{
#include <stdio.h>
#include <stdlib.h>
#define STACKSIZE 256
typedef struct {
int *nums;
size_t len;
# Makefile
bintree: bintree.c queue.c
gcc bintree.c queue.c
random-tree: random-tree.c queue.c stack.c
gcc random-tree.c queue.c stack.c
#include <stdio.h>
#include <stdlib.h>
#include "bintree.h"
#include "Bplustree.h"
int main(void)
{