Skip to content

Instantly share code, notes, and snippets.

View ryosan-470's full-sized avatar
🍻
Working with Elixir and Beer

ryosan-470 ryosan-470

🍻
Working with Elixir and Beer
View GitHub Profile
@ryosan-470
ryosan-470 / lpshow
Last active December 31, 2015 00:19
platexコマンドで生成されるdviファイルをdvipdfmxを利用してpdfファイルを生成し,それをMacに付属するopenコマンドを用いて表示するシェルスクリプト なお,Ubuntuにおいてはalias open='gnome-open'にしておけば同様に動作する.
#!/bin/sh
platex ${1%.*}.tex
dvipdfmx ${1%.*}.dvi
open ${1%.*}.pdf
@ryosan-470
ryosan-470 / onlyuseaddoperator.java
Last active January 2, 2016 11:49
加算演算のみを使って減算,乗算,除算の実装
/**
* 減算
*/
/* 負の数を正に,正の数を負にする */
public static int negrate(int a){
int neg = 0;
int d = a < 0 ? 1 : -1;
while(a != 0){
neg += d;
a += d;
@ryosan-470
ryosan-470 / fibonacci.java
Created January 9, 2014 08:27
フィボナッチ数列を高速に求める
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] fib = new long[5000];
System.out.println(fibonacci(n+1, fib));
}
public static long fibonacci(int x, long fib[]){
if(x == 0) return 0;
@ryosan-470
ryosan-470 / morse_matrix.ino
Created January 31, 2014 00:01
モールス符号を画面に表示
// モールス符号と画面の対応
#include <Matrix.h>
#include <Sprite.h>
// DIN, CLK, LOAD の各ピン番号
Matrix mtx = Matrix(10, 12, 11);
// モールス信号
int To = 120;
int Tu = To * 3;
int low = 1500;
// デジタル13番ピンにスピーカー接続
@ryosan-470
ryosan-470 / switcher_emacsd
Last active August 29, 2015 13:56
複数のemacs.dを切り替えるよっ! 超限定的だけどねw
#!/bin/bash
OLD_CONF="$HOME/.dotconfig/dotemacs"
REPO="$HOME/emacs"
TARGET_DIR="$HOME/.emacs.d"
echo "Switch repo to .emacs.d link"
echo "Choose switch to repo."
echo "1:${REPO}"
echo "2:${OLD_CONF}"
read val
@ryosan-470
ryosan-470 / autoshutdown.sh
Created March 23, 2014 01:00
epgrecを自動起動, 自動終了スクリプト. 参考:http://d.hatena.ne.jp/ftem/20120315/1331817148
#!/bin/bash
# sort works well when LANG=C
LANG=C
# Nobody use recpt1 realtime broadcast
if [ `ps aux|grep recpt1|grep http|wc -l` -ne 1 ]; then
# if nobody logged in.
if [ `who|wc -l` -eq 0 ] ; then
# if nobody are using samba.
if [ `smbstatus -L|wc -l` -eq 2 ]; then
# if no at jobs are runnning.
@ryosan-470
ryosan-470 / JudgeGreatScore.py
Created April 18, 2014 04:37
coins13向け上限解除申請可否診断スクリプト
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
import sys
# 登録の判定を行う
# A,A+の取得単位割合を返す
def getrate(csvfile):
total_score = 0
great_score = 0
public class List {
static List へっど; // 先頭
List つぎ; // 次を指すポインタ
int でーた; // 格納されるデータ
/* 新しいセルの挿入(挿入位置はセルpの直後) */
static void 挿入(List p, int d) {
List 新しいセル = new List();
新しいセル.でーた = d;
新しいセル.つぎ = p.つぎ;
@ryosan-470
ryosan-470 / README.markdown
Created May 4, 2014 07:07
LaTeX Equation Editor

LaTeX Equation Editor

LaTeX Equation Editor likes codecogs editor.

Requirements

  • Python 3.3 or higher
  • NumPy
  • pylatex

Plan

  • To implement real time convert.
  • GUI(Tck/Tk, GTK+ or Qt4)
@ryosan-470
ryosan-470 / README.markdown
Created July 5, 2014 02:21
録画サーバー向けスクリプトと設定

録画サーバー用スクリプト

各ファイルに関する説明

  • smb.conf

Samba向けの設定

  • autoshutdown.sh