Skip to content

Instantly share code, notes, and snippets.

View rinx's full-sized avatar
🍵
sencha

Rintaro Okamura rinx

🍵
sencha
View GitHub Profile
\documentclass[a4paper,11pt]{ltjarticle}
% 余白調整
% TOP = 1inch + \voffset + \topmargin + \headheight + \headsep
% BOTTOM = \paperheight - TOP - \textheight
\setlength{\textheight}{\paperheight} %紙面縦幅を本文領域に
\setlength{\topmargin}{4.6truemm} %上部余白を30mm(=1inch+4.6mm)に
\addtolength{\topmargin}{-\headheight}
\addtolength{\topmargin}{-\headsep}
#!/usr/bin ruby
# -*- coding: utf-8 -*-
# ask file information
print("input filename: ")
filename = gets().chomp()
if (filename == "") then
filename = "lualatex-template.tex"
@rinx
rinx / python.vim
Last active December 14, 2015 03:09
ftplugin for vim
"python
setl autoindent
setl softtabstop=4
setl tabstop=4
setl shiftwidth=4
setl textwidth=80
setl smarttab
setl expandtab
@rinx
rinx / ruby.vim
Last active December 14, 2015 03:09
ftplugin for vim
"Ruby
setl autoindent
setl softtabstop=2
setl tabstop=2
setl shiftwidth=2
setl smarttab
setl expandtab
setl smartindent cinwords=if,elsif,else,unless,for,while,try,rescue,ensure,def,class,module
fb :: Int -> String
fb x
| x `mod` 15 == 0 = "FizzBuzz"
| x `mod` 3 == 0 = "Fizz"
| x `mod` 5 == 0 = "Buzz"
| otherwise = show x
fizzbuzz n = [ fb x | x <- [1..n]]
@rinx
rinx / calcGPA.hs
Last active December 14, 2015 18:09
GPA計算するやつ
-- <example>
-- $runghc calcGPA.hs
-- 3
-- A 2
-- B 2
-- C 1
-- 2.2
import Control.Monad
import Control.Applicative
@rinx
rinx / get_1000_tweets.rb
Last active December 16, 2015 15:49
userstreamで1000postを取得するだけ
#-*- coding: utf-8 -*-
require 'userstream'
# --- define consts ---
CONSUMER_KEY = ENV['CONSUMER_KEY']
CONSUMER_SECRET = ENV['CONSUMER_SECRET']
ACCESS_TOKEN = ENV['ACCESS_TOKEN']
ACCESS_SECRET = ENV['ACCESS_SECRET']
# -*- coding: utf-8 -*-
require 'nokogiri'
require 'open-uri'
# get prepaid balance
# from https://mp.seikyou.jp/mypage/Static.init.do
#
# The MIT License
# Copyright (c) 2013 @nepiadeath
#!/bin/sh
if [ -z $1 ]; then
filename=doc
else
filename=$1
fi
lualatex -ini lualatex.ini > /dev/null 2>&1
-- if this program stack space overflow,
-- ./monte_carlo +RTS -K200M
import System.Random
import Control.Monad
main :: IO ()
main = do
randsx <- replicateM s $ (randomRIO(0,1.0)::IO Double)
randsy <- replicateM s $ (randomRIO(0,1.0)::IO Double)
print (getPI (isInTheCircle randsx randsy) sDouble)