Skip to content

Instantly share code, notes, and snippets.

Avatar

U-MA U-MA

  • Tokyo, Japan
View GitHub Profile
@U-MA
U-MA / sample_merge.vfl
Last active Apr 18, 2020
VEX でカスタム COP 作成
View sample_merge.vfl
#pragma opname sample_merge
#pragma oplabel "SampleMerge"
#pragma opmaxinputs 4
#pragma inputlabel 1 "R"
#pragma inputlabel 2 "G"
#pragma inputlabel 3 "B"
#pragma inputlabel 4 "A"
#pragma label useChannelOfR "Use channel of R"
#pragma choice useChannelOfR "0" "R"
#pragma choice useChannelOfR "1" "G"
@U-MA
U-MA / va_list_sample.cpp
Last active Oct 8, 2015
va_listのサンプル
View va_list_sample.cpp
#include <cstdio>
#include <cstdarg>
template<typename T>
T sumN(unsigned int n, ...)
{
va_list vl;
va_start(vl, n);
T sum = 0;
@U-MA
U-MA / count_if.vim
Created Sep 5, 2015
条件に一致する要素の個数を返す関数
View count_if.vim
function! s:count_if(list, string) abort
let copy = deepcopy(a:list)
call filter(copy, a:string)
return len(copy)
endfunction
View key_input_in_normal_command.vim
function! s:foo(second) abort
let l:start = reltime()
while str2float(reltimestr(reltime(l:start))) < float(a:second)
execute 'normal! r '
endwhile
endfunction
tabnew Sample
call setline(1, 'Please any keys for 2 seconds.')
@U-MA
U-MA / accum_sum
Created Jun 26, 2015
行列の和
View accum_sum
/* 行列の対応する要素をaccumulateする
*
* このプログラムはいたるところにバグが潜んでいる、もしくは
* バグを起こしやすいので注意
*/
#include <cstdio>
// 要素数がsize個の行列をmatrix_size個格納した配列matrixを
@U-MA
U-MA / now_loading.vim
Created May 17, 2015
文字列"Now loading..."がアニメーションする
View now_loading.vim
" Now loadingというアニメーションする文字列を表示する
" Version: 0.8
" Author: U-MA
" License: VIM LICENSE
" USAGE:
" Command: :NowLoading
"
" Please press 'q' for stop to this program.
@U-MA
U-MA / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@U-MA
U-MA / hpc2014_answer.cpp
Created Nov 11, 2014
ハル研プロコンの回答プログラム
View hpc2014_answer.cpp
//------------------------------------------------------------------------------
/// @file
/// @brief HPCAnswer.hpp の実装 (解答記述用ファイル)
/// @author ハル研究所プログラミングコンテスト実行委員会
///
/// @copyright Copyright (c) 2014 HAL Laboratory, Inc.
/// @attention このファイルの利用は、同梱のREADMEにある
/// 利用条件に従ってください
//------------------------------------------------------------------------------
View gist:ff295e4114f979d8788d
#include <stdio.h>
#include <stdlib.h>
// read the array a of n elements from fp
void reada(FILE *fp, int *a, int *n);
// output the array a of n elements
void printa(int *a, int n);
// randomized quick sort
View dasensor.java
import java.awt.geom.Arc2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Random;
// 普通のセンサクラス
class SensorBase {
private Point2D.Double position;
private double battery;
You can’t perform that action at this time.