Skip to content

Instantly share code, notes, and snippets.

(set-language-environment "Japanese")
(prefer-coding-system 'utf-8)
(keyboard-translate ?\C-h ?\C-?)
(global-font-lock-mode t)
(show-paren-mode 1)
(menu-bar-mode -1)
(line-number-mode 1)
(column-number-mode 1)
(auto-fill-mode -1)
(cd "~")
@viz3
viz3 / random_mac.py
Created September 17, 2013 07:44
generate random mac address for xen or qemu
#!/usr/bin/env python
import sys
import random
# this function is directly from xend/server/netif.py and is thus
# available under the LGPL,
# Copyright 2004, 2005 Mike Wray <mike.wray@hp.com>
# Copyright 2005 XenSource Ltd
def randomMAC(type="xen"):
@viz3
viz3 / extract_audio.sh
Last active March 27, 2022 08:17
extract audio from dvd.
#!/bin/sh
dvd_device="/PATH/TO/VIDEO_TS"
# exec mplayer -dvd-device "$dvd_device" dvd:// -identify to acquire chapters and aid.
chapters="21"
aid="160"
title="1"
for chapter in `seq 1 $chapters`; do
wav=`printf %02d.wav $chapter`
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
@viz3
viz3 / tver.py
Last active October 31, 2021 09:31
youtube-dl -o "あとで見る.%(ext)s" "$(./tver.py https://tver.jp/episode/1234567)" https://blog.srytk.com/aquei/555.html
#!/usr/bin/env python3
"""
CC0で公開する https://creativecommons.org/publicdomain/zero/1.0/deed.ja
"""
import re
from urllib.request import urlopen
import argparse
@viz3
viz3 / btree.c
Created August 27, 2012 08:19
B木 B-Tree C言語によるアルゴリズム辞典 P.316
/**
* C言語によるアルゴリズム辞典
* P.316
* B木 B-Tree
*/
#include <stdio.h>
#include <stdlib.h>
/* 1ページのデータ数の上限の半分 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int addition(char *s)
{
int x = ((unsigned)rand() % 99) + 1;
int y = ((unsigned)rand() % 99) + 1;
sprintf(s, "%d + %d = ", x, y);
@viz3
viz3 / dot.emacs.d.init.chromebook.el
Created January 7, 2021 03:03
dot.emacs.d.init.chromebook.el
(set-language-environment "Japanese")
(prefer-coding-system 'utf-8)
(keyboard-translate ?\C-h ?\C-?)
(global-font-lock-mode t)
(show-paren-mode 1)
(menu-bar-mode -1)
(line-number-mode 1)
(column-number-mode 1)
(auto-fill-mode -1)