Skip to content

Instantly share code, notes, and snippets.

View switch_tester.rs
use serde::Deserialize;
use wasm_bindgen::prelude::*;
use yew::prelude::*;
use yew::services::console::ConsoleService;
use yew::services::fetch::{FetchService, FetchTask, Request, Response};
use yew::services::keyboard::{KeyListenerHandle, KeyboardService};
use yew::web_sys::KeyboardEvent;
use yew::{
format::{Json, Nothing},
prelude::*,
View switch_tester.rs
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use yew::prelude::*;
use yew::services::console::ConsoleService;
use yew::web_sys::KeyboardEvent;
mod constants;
struct Model {
key: String,
link: ComponentLink<Self>,
View hitoslot.rs
async fn get_command_type(msg: &Message) -> (CommandTypeId,u8){
let command_str = &msg.content;
if let Ok(n) = scan_fmt(command_str, "!ひよこスロット*{d}", u8) {
if n >= 10 {
return (CommandTypeId::HiyokoSlot,1);
} else {
return (CommandTypeId::HiyokoSlot,n);
}
} else if command_str.starts_with("!ひよこスロット") {
@adeonhy
adeonhy / crypter.js
Created Sep 23, 2020
うまく動かなかったやつ
View crypter.js
const fs = require('fs')
const crypto = require('crypto')
const readline = require('readline');
const ALGORITHM = 'aes-256-cbc';
// main
// node crypter.js [enc/dec] [in filename] [out filename]
(async () => {
const args = process.argv.slice(2);
View 三目ならべ.re
type square =
| Blank
| O
| X;
let stringOfSquare = square =>
switch (square) {
| Blank => "b"
| O => "o"
| X => "x"
View avrdude_for_🐥
#!/bin/sh
printf "Detecting USB port, reset your controller now."
ls /dev/tty* > /tmp/1
while [ -z $USB ]; do
sleep 0.5
printf "."
ls /dev/tty* > /tmp/2
USB=`comm -13 /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`
mv /tmp/2 /tmp/1
View index.elm
module Main exposing (Model, Msg(..), init, main, update, view)
import Browser
import Html exposing (Html, button, div, input, p, text)
import Html.Attributes exposing (class, href, placeholder, src, style, type_)
import Html.Events exposing (onClick, onInput)
import Time exposing (Posix, Zone, utc)
@adeonhy
adeonhy / clickpost_from_booth.rb
Created Dec 24, 2018
BOOTHの注文データからクリックポストの印字データにするやつ
View clickpost_from_booth.rb
require 'csv'
CLICKPOST_HEADER = %w(お届け先郵便番号 お届け先氏名 お届け先敬称 お届け先住所1行目 お届け先住所2行目 お届け先住所3行目 お届け先住所4行目 内容品)
booth_order_csv_path = ARGV.shift
booth_order_csv = CSV.read(booth_order_csv_path, 'r:BOM|UTF-8', headers: true)
click_post_data = booth_order_csv.map do |row|
[
row['郵便番号'],
@adeonhy
adeonhy / 40_percent_emulation.json
Created Dec 14, 2018
karabiner-elementsで40%キーボードみたいにqwerty行で記号入力(space押しながらで入力) ※SpaceFNのパクリ
View 40_percent_emulation.json
{
"title": "40percent",
"rules": [
{
"description": "add new layer(Space+?)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "spacebar",
@adeonhy
adeonhy / gist:9c90c5bcf34b796ce7d3d2869f58a4e7
Created Oct 7, 2018
ファームウェアパッケージ書き込み時エラー
View gist:9c90c5bcf34b796ce7d3d2869f58a4e7
[hy@hyPro]% sudo nrfutil dfu usb-serial -pkg ble_master.zip -p /dev/tty.usbmodem14125
Password:
Traceback (most recent call last):
File "/usr/local/bin/nrfutil", line 11, in <module>
sys.exit(cli())
File "/Library/Python/2.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/Library/Python/2.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)