Skip to content

Instantly share code, notes, and snippets.

@akkijp
akkijp / Vagrantfile
Last active November 2, 2015 03:11
aws をmacから起動するvagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "dummy"
config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
@akkijp
akkijp / README.md
Last active October 29, 2015 16:35
jQueryを使ったいろいろなエフェクト あれそれ

jQueryを使ったいろいろなエフェクト あれそれ

クラス名「slide_page_handler」がクリックされた時に、 ページ全体が横にスライドするエフェクトを追加する。

$("body > *").wrapAll('<div id="slide_page_wrapper" style="width:100%"></div>');
$('.slide_page_handler').click(function(){
  var pass = $(this).attr("href");
 $('#slide_page_wrapper').animate({marginLeft: '-='+$(window).width()+'px'},300,function(){
@akkijp
akkijp / main.c
Created October 26, 2015 11:44
c言語で正規表現で検索を行う
#include <stdio.h>
#include <regex.h>
void put_n_char(const char *s, regoff_t so, regoff_t eo)
{
const char * const ep = s + eo;
for(s += so; s != ep; s++) putchar(*s);
}
@akkijp
akkijp / main.go
Created October 25, 2015 12:06
rbgをhexに相互変換する。golang
package main
import "fmt"
func main() {
fmt.Println(dec2hex(256, 4))
fmt.Println(rgb2int(256, 256, 256))
fmt.Println(int2rgb(0))
}
@akkijp
akkijp / mcat.c
Last active October 22, 2015 18:05
catコマンドを作る! stdio版
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]){
int i;
if(argc < 2){
fprintf(stderr, "%s: file name not given\n", argv[0]);
exit(1);
}
@akkijp
akkijp / mcat.c
Last active October 22, 2015 18:05
catコマンドを作る! linuxのファイルディスクリプタを使って、ファイルから端末へ出力する
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define BUFFER_SIZE 2048
static void die(const char *s){
@akkijp
akkijp / main.go
Last active October 21, 2015 10:03
tmp golang test
package main
import "fmt"
func f1() (int, string, float32) {
return 0, "xyz", 3.14
}
func f2(a int, b string, c interface{}) {
fmt.Println(a, b, c)
@akkijp
akkijp / main.rb
Last active October 20, 2015 07:50
twitter で指定ユーザーのツイートを過去200件まで自動取得する。取得したデータは、sqlight3にて保存される。
require 'rubygems'
require 'sqlite3'
require 'twitter'
require 'pp'
# ログイン
client = Twitter::REST::Client.new do |config|
config.consumer_key = ""
config.consumer_secret = ""
config.access_token = ""
@akkijp
akkijp / TOPIX100_list.tsv
Created October 20, 2015 02:23 — forked from YoshihitoAso/TOPIX100_list.tsv
TOPIX100の銘柄リスト(TSV)
stock_code name
1605 国際石油開発帝石
1878 大東建託
1925 大和ハウス工業
1928 積水ハウス
1963 日揮
2502 アサヒグループホールディングス
2503 キリンホールディングス
2802 味の素
2914 日本たばこ産業
@akkijp
akkijp / main.c
Created October 20, 2015 02:19
自力で、HTTPサーバーをc言語で1から作る!
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <signal.h>
#include <string.h>
typedef void (*sighandler_t)(int);
/*
* 標準エラー出力にフォーマットしたものを出力して、プロセスを終了する。
* @vars (char *fmt, ...)