Skip to content

Instantly share code, notes, and snippets.

kotaroito kotaroito

Block or report user

Report or block kotaroito

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View my-cnn.py
# coding: utf-8
# In[1]:
import os
import tensorflow as tf
import glob
import random
from numpy.random import randint
View preprocess_cnn.py
# coding: utf-8
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
View thread_with_mutex.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
int x = 0;
int n = 100;
pthread_t tid[100];
pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
View thread_without_mutex.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
int x = 0;
int n = 100;
pthread_t tid[100];
@kotaroito
kotaroito / array_to_hash.rb
Created May 26, 2015
Ruby: Array to Hash
View array_to_hash.rb
array = %w(a b c)
hash = Hash[array.collect.zip(array.map{|c| c.upcase})]
p hash
# {"a"=>"A", "b"=>"B", "c"=>"C"}
View flyweight.js
var MyImmutableArray = (function() {
var flyweight = {};
return function(from, to) {
var k = from + ':' + to;
if (!flyweight[k]) {
var array = [];
for (var i = from; i <= to; i++) {
array.push(i);
View decorator.js
var Crepe = function() {
this.cost = function() { return 200; };
this.toppings = function() { return []; };
};
var Topping = function(crepe) {};
Topping.prototype = {
cost: function () {
return this.crepe.cost() + this.settings.cost;
},
View abstract_factory.js
var abstractBallFactory = (function() {
var types = {};
return {
getBall: function(type, customizations) {
var constractor = types[type];
return ( constractor ? new constractor(customizations) : null );
},
registerBall: function(type, constractor) {
types[type] = constractor;
return abstractBallFactory;
View printer.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div>
<form id="print-form">
<p>
View jsbin.nopof.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
</html>
You can’t perform that action at this time.