Skip to content

Instantly share code, notes, and snippets.

@mafice
mafice / .tmux.conf
Created August 10, 2012 08:41
my dotfiles
set-option -g base-index 1
set-option -g default-shell /bin/zsh
@mafice
mafice / realtimeSafari.py
Created June 5, 2012 08:00
ファイルに変更があったらSafariを勝手にリロードしてくれるやつ
#!/usr/bin/env python
# conding: utf-8
#
# It works on Mac OS X only.
#
import os
import time
import pipes
@mafice
mafice / macho2bin.sh
Created May 27, 2012 15:31
convert Mach-O to plain binary
#
# install GNU Binutils
#
# cd /tmp
# curl -O http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.gz
# tar vxf binutils-2.22.tar.gz
# cd binutils-2.22
# ./configure
# sudo make install
#
@mafice
mafice / lets_x86.sh
Created May 23, 2012 13:04
れっつx86 on Mac
#!/bin/sh
brew install nasm omake doxygen mercurial
brew qemu --use-gcc
#define PCI_IOPORT_CONFIG_ADDRESS 0x0cf8
#define PCI_IOPORT_CONFIG_DATA 0x0cfc
#define PCI_BUS_MAX 255
#define PCI_DEVICE_MAX 31
#define PCI_FUNC_MAX 7
#define PCI_CONFIGREG_VENDOR_AND_DEVICE_ID 0x00
#define PCI_CONFIGREG_INTERRUPT 0x3c
typedef unsigned char u8;
typedef unsigned short u16;
@mafice
mafice / serialport.c
Created May 12, 2012 00:52
serialport
#define IOPORT_SERIALPORT_BASE 0x03f8
void serialport_sendString (const char* str){
unsigned int i;
asm_out8(IOPORT_SERIALPORT_BASE+1, 0x00);
asm_out8(IOPORT_SERIALPORT_BASE+3, 0x80);
asm_out8(IOPORT_SERIALPORT_BASE+0, 0x03);
@mafice
mafice / test_linux_kernel.sh
Created April 22, 2012 13:08
test the Linux kernel with QEMU
#!/bin/sh
#
# build the kernel and download linux-0.2.img from http://wiki.qemu.org/Testing
#
KERNEL_VERSION=3.3.2
qemu -hda linux-0.2.img -append "root=/dev/sda" -kernel linux-$KERNEL_VERSION/arch/i386/boot/bzImage
@mafice
mafice / notify.py
Created April 22, 2012 13:02
show notification using pynotify
import pynotify
pynotify.init("pynotify_test")
n = pynotify.Notification("Hi!", "1\n2")
n.show()
@mafice
mafice / Main.java
Created March 16, 2012 15:04
retrieve tweets from userstream
import twitter4j.*;
import twitter4j.conf.*;
import twitter4j.auth.*;
public class Main{
public static void main(String[] args){
@mafice
mafice / http-client.c
Created March 14, 2012 14:25
a http client
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <netinet/in.h>