Skip to content

Instantly share code, notes, and snippets.

View pocket7878's full-sized avatar
🏠
Working from home

Masato Sogame pocket7878

🏠
Working from home
View GitHub Profile
@pocket7878
pocket7878 / rainbow.py
Created June 28, 2015 06:13
rainbow.py
from PIL import Image, ImageDraw
import photos
base = photos.capture_image()
w = base.size[0]
h = base.size[1]
rainbow = Image.new(base.mode, base.size, "white")
@pocket7878
pocket7878 / solver.py
Created November 15, 2014 09:50
0hh1-solver writte in Python
#coding: utf-8
import sys
colors = 'rb'
def same_line(l1, l2):
if len(l1) == len(l2):
for i in range(len(l1)):
#include <iostream>
#include <string>
#include <opencv2/opencv.hpp>
#include <opencv2/nonfree/nonfree.hpp>
using namespace std;
using namespace cv;
int main(int argc, char* argv[]) {
// load color image
package jp.dip.poketo7878;
/**
* Created by masato on 2014/05/24.
*/
public class StringEditor {
private String str;
public Edit[] edits;
public StringEditor(String sr) {
@pocket7878
pocket7878 / 0_reuse_code.js
Created March 20, 2014 04:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pocket7878
pocket7878 / MultiSplitPane.java
Last active April 10, 2018 11:40
MultiSplitPane.java
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
public class MultiSplitPane extends JPanel {
private int orientation;
private Boolean needSplit;
private Boolean splited;
private Component firstChild;
private MultiSplitPane private_second_child;
@pocket7878
pocket7878 / gist:6680752
Created September 24, 2013 05:36
ナムドット問題僕の回答 出力の行数を減らすためにSetを使ってる。
require 'set'
k = [0]*5; m = [0]*5
begin
puts Set.new([*1..5]).divide{|i| k[i-1]}.map{|i| i.to_a*""}*"."
end while
(if i = [4,3,2,1].index{|i| k[i] <= m[i-1]}; then i=4-i
k[i]+=1; m[i] = m[i]>k[i] ? m[i] : k[i]
((i+1)..4).each{|j| k[j] = k[0]; m[j] = m[i]; }
end)
@pocket7878
pocket7878 / gist:6561697
Created September 14, 2013 12:36
Shibuya.Lisp Meetup8のライブコーディングを僕もやってみた。
(load "~/quicklisp/setup.lisp")
(let* ((*standard-output* (make-broadcast-stream))
(*error-output* *standard-output*))
(ql:quickload :split-sequence))
(defun parse-ls-l ()
;;Throught first line
(read-line)
(loop for line = (read-line t nil nil)
@pocket7878
pocket7878 / gist:1091515
Created July 19, 2011 06:48
little change for outputz.vim
let l:cmd = printf('curl --form-string key=%s --form-string uri=%s --form-string "size=%d" http://outputz.com/api/post',
\ fnameescape(g:outputz_secret_key),
\ fnameescape({g:outputz_uri_function}()),
\ a:n)
if s:V.has_vimproc()
call vimproc#system_bg(cmd)
else
call system(cmd)
endif
@pocket7878
pocket7878 / gist:1084085
Created July 15, 2011 04:44
little change for syncj
func! s:sync(bang, bundle) abort
let git_dir = expand(a:bundle.path().'/.git/')
if isdirectory(git_dir)
if !(a:bang) | return 0 | endif
let cmd = 'git pull'
if (has('win32') || has('win64'))
"let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives
let cmd = '"'.cmd.'"' " enclose in quotes
endif
"cd to bundle path"