Skip to content

Instantly share code, notes, and snippets.

View musaprg's full-sized avatar
🐱
meow meow

Kotaro Inoue musaprg

🐱
meow meow
View GitHub Profile
@musaprg
musaprg / rotating_cube.cs
Created December 6, 2014 12:40
Rotating cube(Unity)
using UnityEngine;
using System.Collections;
public class myscript : MonoBehaviour {
private float v;
// Use this for initialization
void Start () {
v = 2.0f;
@musaprg
musaprg / moving.cs
Created December 6, 2014 16:59
Moving Rotating Cube(Unity)
using UnityEngine;
using System.Collections;
public class myscript : MonoBehaviour {
// Use this for initialization
void Start () {
}
@musaprg
musaprg / split.rb
Created January 22, 2017 16:34
Split num with any digit you want.
if ARGV.count < 1
puts "Usage: ruby split.rb hoge.txt <split_num>"
exit
end
fname = ARGV[0]
n = ARGV[1]
fn = fname.split(".")
File.open(fname, 'r') do |f|
File.open(fn[0] + '_r.txt', 'w') do |rf|
@musaprg
musaprg / reset_deleted.sh
Created February 2, 2017 07:32
gitでdeletedしちゃったやつを全部checkoutするワンライナー
git status | grep deleted | awk '{print $2}' | while read line ; do git checkout $line ; done
@musaprg
musaprg / awk_001.sh
Created February 2, 2017 08:02
フラグとかの解析用
echo --hoge=3 --fuga=3 --piyo=3 | awk '{for(i=0;i<$NF;i++){printf("%s\n",$i)}print $NF}'
@musaprg
musaprg / sample.css
Created February 3, 2017 03:26
リスト等の複数要素を均等配置する。
.wrap {
display: flex;
flex-flow: row;
justify-content: center;
align-items: stretch;
}
@musaprg
musaprg / mnist.py
Last active February 4, 2017 17:58
MNIST For ML Beginners - Tensorflow Tutorials
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
@musaprg
musaprg / CAPSPageMenu.swift
Created March 4, 2017 13:50
PageMenuをSwift3.0対応させた
// CAPSPageMenu.swift
//
// Niklas Fahl
//
// Copyright (c) 2014 The Board of Trustees of The University of Alabama All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
//
@musaprg
musaprg / readingdirimgs.py
Created March 6, 2017 23:10
一括読み込み
import os, sys
import imghdr
import cv2 #PILでも良いと思います
import logging
logger = logging.getLogger(__name__)
#わたされたパスがディレクトリかどうかチェック
if os.path.isdir(inpath):
imgs = []
@musaprg
musaprg / sample001.v
Last active March 11, 2017 06:19
Lチカ with CycloneIV @ FPGAスタートアップ講座第5回
//module name must be set the same one as Project Name.
//module name must be set with alphabet, not only number.
module sample (out,clk);
//signal input and output of module
input clk;
output out;
//set 25bit variable. [24][23][22]...[3][2][1][0] as "count"
reg[24:0]count;