Skip to content

Instantly share code, notes, and snippets.

View yswallow's full-sized avatar

Sanagi yswallow

View GitHub Profile
@yswallow
yswallow / SerialURIdecoder.ino
Created January 13, 2020 08:37
ArduinoでURIエンコードされた文字列をデコードする
#include <Arduino.h>
void setup() {
Serial.begin(9600);
delay(500);
}
void loop() {
Serial.println("URI decoder!");
while( Serial.available()>0 ) {
@yswallow
yswallow / jugem.ino
Created June 5, 2019 23:09
Digisparkでじゅげむをタイピングする
#include "DigiKeyboard.h"
void setup() {
// don't need to set anything up to use DigiKeyboard
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(0, INPUT_PULLUP);
digitalWrite(2, LOW);
}
@yswallow
yswallow / gpa.rb
Created March 22, 2019 00:32
開設学類別のGPAを計算する
str = File.read("SIRS201519198.csv")
def hyoka2gp(c)
case c
when 'A+'
4.3
when 'A'
4
when 'B'
3
@yswallow
yswallow / itf.py
Last active December 2, 2017 05:06
イッマージン ザ フューチャーーーーーー!!!!!
#for trinket M0
import pulseio
import time
import board
import simpleio
while True:
simpleio.tone(board.D2, 350 , 0.337)
simpleio.tone(board.D2, 466 , 0.506)
@yswallow
yswallow / make-twitter-cat.rb
Created September 27, 2017 14:21
Twitterを平和にするmikutterプラグイン
# RTされたツイートは平和にならない
Plugin.create :make_twitter_cat do
filter_update do |service, msgs|
msgs.map! { |m| m[:message]="にゃ〜ん🐱"; m }
msgs.each { |m| p m.body }
[service, msgs]
end
end
li {
list-style: none;
}
h2 {
text-align: center;
}
@yswallow
yswallow / float-bit.c
Last active March 24, 2023 02:05
浮動小数点数のビット列を見る
#include <stdio.h>
#include <stdint.h>
typedef union {
float f;
uint32_t l;
} float_bits_t;
int main(void) {
float_bits_t num;
@yswallow
yswallow / fizzbuzz.rb
Created April 18, 2017 20:49
RubyにSmallTalk的な「メソッドとしての条件分岐」を追加する
require './smalltalklike'
100.times { |i|
( i%15 == 0 ).if {
puts 'FizzBuzz'
}.else {
( i%3 == 0 ).if {
puts 'Fizz'
}.else {
( i%5 == 0 ).if {
@yswallow
yswallow / text
Last active April 14, 2017 22:45
pic2shopのコールバックurl
pic2shop://scan?callback=https%3A%2F%2Fgoogle.co.jp%2Fsearch%3Fq%3DEAN
@yswallow
yswallow / half_hour_mute.rb
Created April 11, 2017 13:54
右クリックメニューで指定したユーザーを30分間ミュートするmikutterプラグイン
Plugin.create(:half_hour_mute) do
mutes = []
command(:half_hour_mute,
name: '半時ROMれ',
condition: lambda{ |opt| true } ,
visible: true,
role: :timeline) do |opt|
opt.messages.each do |message|
user = message.user.to_s