Skip to content

Instantly share code, notes, and snippets.

@typosone
typosone / Student.java
Last active August 29, 2015 14:03
Java講義 サンプル (Student)
public class Student {
private String firstName;
private String lastName;
private String course;
private String gender;
private double height;
private double weight;
public Student() {
setFirstName("ひろき");
@typosone
typosone / Cat.java
Created July 2, 2014 02:48
Java講義 サンプル (例外)
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;
public class Cat {
public static void main(String...args) {
for (int i = 0; i < args.length; i++) {
System.out.println("ファイル名: " + args[i] + "====");
try {
@typosone
typosone / BadBank.java
Created July 2, 2014 07:17
Java講義 サンプル (すれっど?)
public class BadBank {
// 預金残高
private int value = 0;
// 預け入れ・引き出し
public void addMoney(int money) {
// 現在残高を保存
int currentValue = value;
// 状況表示
System.out.println(Thread.currentThread() + " がaddMoneyに入りました");
@typosone
typosone / ArrayListTest1.java
Last active August 29, 2015 14:03
Java講義サンプル (コレクション)
import java.util.ArrayList;
public class ArrayListTest1 {
public static void main(String...args) {
ArrayList<String> list = new ArrayList<String>();
list.add("Alice");
list.add("Bob");
list.add("Chris");
@typosone
typosone / fibu.py
Created July 4, 2014 05:49
適当にFizzBuzz
#!/usr/bin/env python3
# 面倒なので関数化とかしてないよ
end = 1000
print([x if x % 3 != 0 and x % 5 != 0
else 'FizzBuzz' if x % 15 == 0
else 'Buzz' if x % 5 == 0
else 'Fizz' for x in range(1,end)])
@typosone
typosone / odd_even.py
Created July 4, 2014 06:32
てきとーに奇偶判定
#!/usr/bin/env python3
def isOdd(i):
return False if i & 0x1 == 0 else True
def isEven(i):
return not isOdd(i)
if __name__ == '__main__':
for x in range(100):
@typosone
typosone / tmux.conf
Created July 13, 2014 16:06
いつものドットファイル (バックアップ
set-option -g prefix C-j
setw -g utf8 on
set -g status-utf8 on
set -g mouse-select-pane on
setw -g mode-mouse on
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set -g base-index 1
@typosone
typosone / pass_gen.py
Created July 29, 2014 17:47
Python3 でランダム文字列作るやつ。
#!/usr/bin/env python3
import sys
import random
argv = sys.argv
argc = len(argv)
if argc not in {2, 3}:
print("Usage: pass_gen digis [mode(1:number,2:lower,4:upper,8:specials]")
package jp.ac.it_college.std.nakasone.actionbartab;
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@typosone
typosone / MainActivity.java
Last active August 29, 2015 14:11
Android の Service のさんぷる
package jp.ac.it_college.std.nakasone.servicetest;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.view.View;