This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TCCR0Bをいじっても同じ時間待てるようにするdelay | |
void delay_tccr0b(float ms){ | |
delay(ms * 64.0 / pow(8, TCCR0B-1)); | |
} | |
void setup(){ | |
//leonardoではTCCR0Bは3ピンに影響 | |
pinMode(3, OUTPUT); | |
//PWMの周波数が62.5kHzになる | |
TCCR0B=(TCCR0B & 0b11111000) | 0x01; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf_8 -*- | |
import sys | |
import subprocess | |
import pykakasi | |
def romaji(txt): | |
"Japanese->Romaji" | |
kks = pykakasi.kakasi() | |
kks.setMode('H', 'a') | |
kks.setMode('K', 'a') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import requests | |
url = 'https://slack.com/api/' | |
token = 'Slack Bot API Token' | |
def upload(filename, image, channels, filetype='jpg'): | |
joind_channels = ','.join(channels) | |
arguments = { | |
'token': token, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = 'https://slack.com/api/' | |
token = 'Slack Bot API Token' | |
def postMessage(msg, channel): | |
arguments = { | |
'token': token, | |
'channel': channel, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Example: | |
# ./sjis2utf8.sh sample8th/*.asm | |
for i in $@; do | |
echo $i | |
iconv -f SJIS -t UTF8 $i > tmp.sh | |
cp tmp.sh $i | |
rm tmp.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(int argc, char const *argv[]){ | |
int a[] = {10, 13, 13, 15, 20, 25}; | |
int b[] = {6, 6, 8, 8, 11, 13}; | |
int n = 6, w = 21; | |
int i = n-1, j = 0; | |
int i2 = i, j2 = j; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Start () { | |
StartCoroutine (WaitWhileExperiment ()); | |
} | |
IEnumerator WaitWhileExperiment(){ | |
int a = 0; | |
yield return new WaitWhile (() => { | |
a++; | |
Debug.Log(a); | |
return a < 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma kernel ShowData | |
StructuredBuffer<float> data; | |
RWTexture2D<float4> Result; | |
[numthreads(1024,1,1)] | |
void ShowData (uint id : SV_DispatchThreadID) | |
{ | |
for (int i = 0; i < 256; i++) { | |
uint2 idx = uint2(id, i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.UI; | |
public class ImageProcesser : MonoBehaviour { | |
public ComputeShader shader; | |
public RawImage srcImg; | |
public RawImage dstImg; | |
void Start () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma kernel CSMain | |
Texture2D<float4> srcTex; | |
RWTexture2D<float4> dstTex; | |
[numthreads(32, 32, 1)] | |
void CSMain(uint3 id : SV_DispatchThreadID) { | |
float4 up = srcTex[id.xy + int2(0, 1)]; | |
float4 down = srcTex[id.xy + int2(0, -1)]; | |
float4 left = srcTex[id.xy + int2(-1, 0)]; |
OlderNewer