Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -- coding: utf-8 --
import numpy,os,caffe
import scipy.misc
import numpy as np
MODEL_FILE="models/bvlc_alexnet/deploy.prototxt"
PRETRAINED_MODEL_FILE="models/bvlc_alexnet/bvlc_alexnet.caffemodel"
CATEGORY_FILE="data/ilsvrc12/synset_words.txt"
@peryaudo
peryaudo / gpa.go
Last active March 10, 2016 05:30
使い方: https://www2.adst.keio.ac.jp/rcs/topMenu の中身を投げ込む(POSTなのでChromeはCtrl+Sで保存できないので注意)
package main
import (
"fmt"
"github.com/PuerkitoBio/goquery"
"os"
"strconv"
)
func gradeToScore(grade string) float64 {
@peryaudo
peryaudo / jobobjectinformation.patch
Created May 30, 2015 15:39
Implement NtQueryInformationJobObject and NtSetInformationJobObject to ReactOS
Index: include/ndk/pstypes.h
===================================================================
--- include/ndk/pstypes.h (revision 67961)
+++ include/ndk/pstypes.h (working copy)
@@ -826,6 +826,77 @@
#ifndef NTOS_MODE_USER
//
+// Job Information Structures for NtQueryInformationJobObject
+//
@peryaudo
peryaudo / bf.hs
Last active January 2, 2016 03:09
import System.Environment
import System.IO
import Data.Bits
run :: String -> String -> String
run source input = run' ([], source) ([], (repeat 0)) input
run' :: (String, String) -- a zipper for instructions
-> ([Int], [Int]) -- a zipper for memory
import Debug.Trace
import Data.List
import Data.Bits
--main = putStrLn (imageToPpm (render 640 480 4 2))
main = putStrLn (imageToPpm (render 320 240 8 4))
-- it takes about one hour in my laptop
-- constants
import Control.Monad
charToInteger c = toInteger (fromEnum c - fromEnum '0')
cutDown x
| x >= fromIntegral 0 = floor x
| otherwise = ceiling x
-- cards scores
solve :: String -> [Integer] -> [Integer]
@peryaudo
peryaudo / gist:7386521
Created November 9, 2013 15:19
AOJ1305 WA
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
class Solver {
@peryaudo
peryaudo / nu.rb
Last active December 15, 2015 18:59
「な〜ほ」に「ぬ」が含まれるか、みたいなのを判定する
#!/usr/bin/env ruby
your_class = 'ぬ'
hiragana = 'あいうえお' \
'かきくけこ' \
'さしすせそ' \
'たちつてと' \
'なにぬねの' \
'はひふへほ' \
'まみむめも' \
#include <cstdio>
#include <vector>
#include <set>
#include <cmath>
using namespace std;
class px {
public:
px(void){this->x = 0; this->y = 0;return;}
px(int x, int y){this->x = x;this->y = y;return;}
int x, y;
#include <cstdio>
inline int colour(int N, int a, int b){
if(a > N / 2) a = N - a + 1;
if(b > N / 2) b = N - b + 1;
if(a > b){
int t = a;
a = b;
b = t;
}
return ((a - 1) % 3) + 1;