Skip to content

Instantly share code, notes, and snippets.

View emergent's full-sized avatar
🐈
love cats

Satoshi Yoshikawa emergent

🐈
love cats
View GitHub Profile
@emergent
emergent / file0.txt
Created July 16, 2018 12:02
Pythonとvirtualenvのセットアップ@MacOS X ref: https://qiita.com/emergent/items/2c35ffbf7d13ffa35cb5
$ xcode-select --install
@emergent
emergent / rotate.rb
Created April 20, 2018 16:07
ターミナル上でぐるぐるするやつ
#! /usr/bin/env ruby
def rotate interval
while true
"|/-\\|/-\\".chars.each {|c| print "\r#{c}"; sleep interval}
end
end
rotate 0.1
import random
ZUN = "zun"
DOKO = "doko"
KIYOSHI = "kiyoshi!"
ZUNDOKO = [0,0,0,0,1]
MAXLEN = len(ZUNDOKO)
def zundoko():
words = []
import random
ZUN = "zun"
DOKO = "doko"
MAXLEN = 5
def match(arr):
print(arr)
if (len(arr) >= MAXLEN
import random
ZUN = "zun"
DOKO = "doko"
MAXLEN = 4
def match(arr):
print(arr)
if (len(arr) >= MAXLEN
#import <stdio.h>
#import <Foundation/NSObject.h>
@interface HelloClass : NSObject
- (void) sayHello;
@end
@implementation HelloClass
- (void) sayHello {
printf("Hello Objective-C world!\n");
@emergent
emergent / mechanize_with_proxy_and_basicauth.rb
Created October 30, 2012 23:47
Using mechanize with proxy and basic auth
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
agent.set_proxy('proxy.example.com', 80, 'username', 'password')
agent.add_auth('http://hoge.com','b_username','b_password')
agent.user_agent_alias = "Windows Mozilla"
res = agent.get('http://hoge.com/some/page')
puts res.body
@emergent
emergent / draw.py
Created September 16, 2012 13:21
PILを使った適当なグラフ生成サンプル
#! /usr/bin/env python
from PIL import Image, ImageDraw
import random
import socialdata as sd
def drawnetwork(people,links):
img = Image.new('RGB',(500,500),(255,255,255))
draw = ImageDraw.Draw(img)
@emergent
emergent / BubbleSort.java
Created September 16, 2012 08:35
ソートアルゴリズムをJAVAで実装してみる練習
class BubbleSort extends Sorter {
BubbleSort(boolean debug) {
super(debug);
}
public int[] sort(int[] arr, int start, int end) {
printArray(arr);
if (end > arr.length-1) { return null; }
for (int i=start; i < end; i++) {