Skip to content

Instantly share code, notes, and snippets.

// 参考: https://qiita.com/takusemba/items/f05ff78b39d40937901f
inline fun <reified T> List<T>.filterInstance(): List<T> {
val destination = mutableListOf<T>()
this.forEach {
//これはできない
//println(it::class)
if (it is T) destination.add(it)
}
return destination
}
@fullmated
fullmated / main.go
Last active January 5, 2020 17:12
historyコマンドの標準出力結果から.zsh_historyに変換する(stdoutに出力)
package main
import (
"bufio"
"fmt"
"os"
"regexp"
"strconv"
"time"
)
@fullmated
fullmated / main.cpp
Created March 10, 2019 08:46
Effective C++ #9 after
#include <iostream>
#include <memory>
class Info {
public:
Info(int id, std::string name){ this->id = id; this->name = name; }
int id;
std::string name;
};
@fullmated
fullmated / main.cpp
Last active March 10, 2019 08:46
Effective C++ #9 before
#include <iostream>
#include <memory>
class Base {
public:
Base() { init(); }
virtual void log() const = 0;
private:
void init() {
std::cout << "do something" << std::endl;
@fullmated
fullmated / 0557.cpp
Created January 2, 2015 13:24
AOJ0557 A First Grader
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#define INF 1e+8
#define EPS 1e-8
#define PB push_back
#define rep(i,j) for(int i = 0; i < (j); i++)
#include <stdio.h>
#include <stdlib.h>
#define N 81
/* N: 長桁計算に用意する桁数 */
int main(int argc, char *argv[]){
char a[N],b[N],p[N];
@fullmated
fullmated / task0429_1a.c
Created April 30, 2014 15:27
0429課題まとめ
#include <stdio.h>
int main( int argc, char *argv[] ) {
int a, x;
a = 1;
scanf("%d", &x);
if( x <= 0 ){
printf("the data is less than 0\n");
}else{
while( a <= x ){
import serial
import time
ser = serial.Serial(5, 9600, timeout = 0)
print ser.portstr
c = "\0"
while True:
time.sleep(0.016);
print ser.read(30)
using System;
using System.Windows.Forms;
class Sample1 : Form {
private Label lb, lb2;
private Button bt;
public static void Main() {
Application.Run( new Sample1() );
}
using System;
using System.Windows.Forms;
class Sample1 : Form {
private Label lb, lb2;
private Button bt;
public static void Main() {
Application.Run( new Sample1() );
}