Skip to content

Instantly share code, notes, and snippets.

(require 'package)
;; package.elの初期化
(package-initialize)
;; 日本語化
(set-language-environment "Japanese")
;; emacsサーバ起動
(require 'server)
(unless (server-running-p)
#include <stdio.h>
/**
* @brief set days of month(from m[1] to m[12])
* @param[in, out] m month array
* @note we ignore m[0], so m must have more than 13 space
*/
void init_month(int m[])
{
int i;
@vicowara
vicowara / dump.s
Created October 11, 2017 17:47
hello, world!
.byte 0x7f
.byte 0x45
.byte 0x4c
.byte 0x46
.byte 0x02
.byte 0x01
.byte 0x01
.byte 0x00
.byte 0x00
.byte 0x00
@vicowara
vicowara / Makefile
Created September 4, 2017 13:37
論文用Makefileテンプレート(${NAME}.tex、bibtexを使用する場合は${NAME}.bibを同じ階層上に置く)
NAME = thesis
TEX = platex
BIBTEX = pbibtex
TEXFLAGS = --kanji=utf8
#TEXFLAGS =
BIBTEXFLAGS = --kanji=utf8
DVIPDF = dvipdfmx
TARGET := $(NAME).pdf $(NAME).dvi
#!/bin/bash
mount -t cifs -o username=vicowara,uid=portage,gid=portage //nas_address/vicowara/var/tmp/portage /var/tmp/portage
@vicowara
vicowara / gist:f51181f98d62c3aa04ee576cff48cda7
Created April 9, 2017 09:07
ELFファイルのダンプ結果
$ ./dump
Elf file header(equivalent as readelf -h)
ehdr->e_ident = 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
ehdr->e_type = 2(0x2)
ehdr->e_machine = 62(0x3e)
ehdr->e_version = 1(0x1)
ehdr->e_entry = 4195456(0x400480)
ehdr->e_phoff = 64(0x40)
ehdr->e_shoff = 6056(0x17a8)
ehdr->e_flags = 0(0x0)
/*
* 意図的にバグを埋め込んだリストプログラム
*
* @author vicowara
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/*
* 当然segmentation faultするプログラム
* gdbの練習用に
*
* @author vicowara
*/
#include <stdio.h>
int f3() {
@vicowara
vicowara / functest.s
Created February 20, 2016 08:34
https://gist.github.com/vicowara/b1021f7af5170f1e0e3a を gcc functest.c -S -fno-asynchronous-unwind-tables した
.file "functest.c"
.section .rodata
.LC0:
.string "test"
.text
.globl test
.type test, @function
test:
pushq %rbp
movq %rsp, %rbp
@vicowara
vicowara / functest.c
Last active February 20, 2016 08:33
関数ポインタの例
#include <stdio.h>
int test(){
printf("test\n");
return 0;
}
int main(){
int (*func)();
func = test;